Jump to content

jamescridland

Member
  • Posts

    7
  • Joined

  • Last visited

Posts posted by jamescridland

  1. That did the trick, thank you!


    To help others, this code takes a simple API which gives four nicely-formatted numbers on separate lines, and makes them available as variables.
     

    # fetch contents of URL and save them to variable "count"
    count="$( curl -fsSL https://www.example.com/api )"
    a=("${(f)count}")
    # output to next action
    
    echo -en '{
      "alfredworkflow" : {
        "arg" : "egg",
        "config" : {
        },
        "variables" : {
         "subscribers" : "'
    echo -e $a[1]'"'
    echo -n ',
        "views" : "'
    echo -e $a[3]'"'
    echo -n ',
        "downloads" : "'
    echo -e $a[2]'"'
    echo -n ',
        "pbjsubscribers" : "'
    echo -e $a[4]'"'
    echo -n '
        }
      }
    }'

     

    ... I'm sure there's a nicer way of doing the above, but it works for me!

    They're then available to the next building block (copy-to-clipboard and paste) as {var:subscribers} as one example.

     

     

  2. I have a /bin/zsh script that pulls in an API from an external website with some numbers in it.

     

    I'd like to assign these as variables for the next step of the workflow. Is that possible?

     

    Currently I'm just sending one big block of text through as the {query}. But I'd like to have the bash script assign, for example, {var:subscribers} so I can then use that as a query in the next workflow block.

  3. Oh, that's awesome, thank you.

     

    Just pointing me in the right direction to get started was really helpful - I didn't have much idea what to do here. I must get to use Alfred more, I bet it'll do rather more than just open programs (which is all I'm really using it for up to this point).

     

    Now I have a nice snippet writer. Yay! :)

    Screen Shot 2021-05-15 at 5.22.19 pm.png

  4. I am currently using Espanso for snippets, in spite of owning and using Alfred for about ten years now, because my use of Alfred is only just scratching the surface.

     

    Snippets. What you can do with Espanso is you can say... "I currently have :SUB: subscribers", and then define :SUB: as the results of opening https://example.com/subscriber-count. That itself returns "18,456", and so the snippet is filled-out as "I currently have 18,456 subscribers".

     

    Is that sort of thing possible in Alfred, using Snippets or something else?

  5. Running a MacBook Air with 2GB memory, OSX 10.8.4, and a 1.4 GHz Intel Core 2 Duo. (The memory, in particular, might be important). I'm running Alfred v2.0.5 (202). My hotkey is changed to CTRL+SPACE. I have only one workflow added - the Rdio control from David Ferguson.

     

    If I try to invoke Alfred after not using it for a bit, it's very slow in appearing. Sometimes it takes a few seconds for it to appear. During this time, it's not capturing keypresses. This means that regularly you'll see me apparently typing "ynote" or even "te" instead of "keynote".

     

    I can't instantly replicate it: but after a while of not using Alfred, it is, once more, sluggish to appear.

     

    I never had this issue with Alfred v1; and wondered whether Alfred v2 is significantly heavier on memory or something? Is there anything I can help you with to return Alfred to his snappier self?

×
×
  • Create New...