Jump to content

Store Variables from Run Script Output

Recommended Posts

Hey All! Long time listener, first time caller. 




  1. Is there a way to set an Alfred variable from within a Run Script (bin/bash) command? For reference I'm calling a python script (i.e., python my_script "{query}")
  2. If not, how can I store the output of the Python script when it is a complex data type like a dictionary?



I'm trying to write a workflow that utilizes an API, grabs some values, and then opens a URL. The user will enter an ID, the python Run Script will retrieve information about this via the API call, and then using the returned data I would like to open a web URL.


Currently the python script is creating a dictionary of useful data and storing like so:

useful_dict_info = {"key1" : "value1", "key2": "value2"} 


I think return from the Run Script by using print:

# some code to create useful_dict_info

print useful_dict_info


What I would like to do is either store key1 and key2 as Alfred workflow variables from within the script OR parse the output from Run Script and store them as Alfred workflow variables. Thoughts?




P.S. I'm a huge fan of Alfred and thanks for all the work you've put into it so far. It saves me minutes, if not hours, each day and I keep adding more and more workflows! :)

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...