Jump to content

Inline output for workflows


Recommended Posts

Hello! I'm not sure what these were called so I had some trouble googling. I'm making a molar mass calculator and I want the output to look like the attachment.

 

Eg: molm H2O

 

 should then show in the next line "18.01528 g/mol"

 

I have the logic for figuring out the input and calculations, but I can't for the love of god figure out how to do the output like the photo. I'm using keyword to script with bash. Thanks!

 

Screen Shot 2020-01-13 at 5.23.00 PM.png

Edited by Conanap
Clarified language
Link to comment

You need to emit the output in a certain format in order For Alfred to recognize it and automatically insert it into its windows.

 

If you share what language you are writing it in, I will get an example for you.

 

The screen below will give you the results.

 

bIBpWWT.png

Edited by Terminal
Link to comment

Yup I'm referencing with $title, but it doesn't show; I did something like {"items":[ { "title":$title } ] } . I'll keep the Python library in mind, but rn since I'm just reading from a CSV file and adding numbers together I'll probably implement it in a bit.  

For Python though, I just need to do sys.stdout.write(json obj)?

Link to comment
Just now, Conanap said:

Yup I'm referencing with $title, but it doesn't show; I did something like {"items":[ { "title":$title } ] } . I'll keep the Python library in mind, but rn since I'm just reading from a CSV file and adding numbers together I'll probably implement it in a bit.  

For Python though, I just need to do sys.stdout.write(json obj)?

 

That is odd.

 

And yes, for python that call should work just fine.

Link to comment
11 minutes ago, Conanap said:

Thanks! I'll explore that option for now and see what I can do. I appreciate your help!

 

Just because I am curious minded. Maybe test this?

 

query="{\"items\":[{\"title\":\"$1\", \"subtitle\":\"$title\", \"arg\": \"HIJ\"}]}"

echo -n $query

VVMZUGI.png

 

7DZctCq.jpg

 

qe5k5q4.png

Link to comment
On 1/14/2020 at 3:27 PM, deanishe said:

 

What do you mean exactly? You set the variable $query yourself. You can call it whatever you want.

On earlier attempts of outputting variables other than query seemed to failed, and it continue to copy $query to clipboard anyways; I'll give it another try though

Link to comment
4 minutes ago, Conanap said:

On earlier attempts of outputting variables other than query seemed to failed, and it continue to copy $query to clipboard anyways; I'll give it another try though

 

I don't follow you. There is no variable called $query unless you create it.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...