Jump to content

How to run calculations in a workflow

Recommended Posts

Hi, I have a calculation I have to make a lot. 




How would I set this up in a workflow (so I can make calculations quicker than the normal calculator)?


Thanks in advance!

Share this post

Link to post

Here is 2 examples... If you don't want to do some scripting, the first example could be great to easily add a formula by modifying the "Arg and Vars" object (can duplicate to make more math functions). The second one is nicer if you prefer to have a direct feedback on the number you input





Share this post

Link to post

Here it is:  https://nofile.io/f/mPGnUHXWJVJ/Calculation+in+Workflow+Example.alfredworkflow


About commenting, we can't round to decimal using the builtin Alfred calculator since it rounds to the nearest integer. So, the trick for the first version is to multiply the result by 100 so we move the 2 decimals out and then round the value and divide back by 100.




For the second version, there's a builtin function in python to round a value and there's a second argument to specify the precision that we want, so 2 in this case


Hope this helps!

Share this post

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...