Jump to content

Recommended Posts

Hi All,

 

I'm new here, and I've just created my first workflow: Percent Change. For some reason, I can never do this in my head, and I'm tiring of looking up the formula.

 

This workflow lets you calculate the percent of change between two values, using the % symbol:

% <value1> <value2>

So, something like % 3 6 would give you a result of 100. The result is displayed in Large text and copied to the clipboard.  You can find it, here:

 

http://www.packal.org/workflow/percent-change

 

I'd love any feedback.

 

 

Share this post


Link to post

Interesting! How about adding more percentage stuff to the workflow as well? If it houses other formulas it'd become utterly useful i believe!

Share this post


Link to post

I'd be all for this. Do you have anything in mind?

 

I'd be awesome if we had a list of things people would expect from this workflow.

 

Interesting! How about adding more percentage stuff to the workflow as well? If it houses other formulas it'd become utterly useful i believe!

Share this post


Link to post

Thanks for this perfect workflow. It would be great to have the output in a smaller way or as a sort of "live output" just like the normal calculations I can do within Alfred. 

 

Besides percentage change it would be great to get the basics of calculations of percentage, e.g. the percentage of something. 

 

Just my first thoughts, will think about this in more detail as this workflow is just awesome as I assume I will use it very often. 

 

Thanks for that! 

Share this post


Link to post

Thanks for the feedback!  I admit, that I don't like the large output either. I've found that I tend to do 2 or 3 calculations in a row, so I'll try to figure out how to get live output.

 

As for other calculations, I can think these might be useful:

  • What percent of X is Y
  • What is X percent from Y

I'd be happy to incorporate any others!

 

Thanks for this perfect workflow. It would be great to have the output in a smaller way or as a sort of "live output" just like the normal calculations I can do within Alfred. 

 

Besides percentage change it would be great to get the basics of calculations of percentage, e.g. the percentage of something. 

 

Just my first thoughts, will think about this in more detail as this workflow is just awesome as I assume I will use it very often. 

 

Thanks for that! 

Share this post


Link to post

Yeah, great that would be very useful to get another output format, if possible (which I think it is). 

 

And yes, the suggestions you have made are exactly the ones I was currently thinking about. Mainly the ones I use regularly at work. 

 

Cheers! 

Share this post


Link to post

Thanks for the feedback!  I admit, that I don't like the large output either. I've found that I tend to do 2 or 3 calculations in a row, so I'll try to figure out how to get live output.

To get live output, you need to implement the workflow as a Script Filter.

Seeing as you're using Python, you might find my Python library useful (no need to mess around with XML yourself).

Share this post


Link to post

Updated to version 1.2.0, which includes new calculations.

 

http://www.packal.org/workflow/percent-change

 

1. Percent Change (increase/decrease): `% 3 6` -> 100%
2. Percent of; What is 3 percent of 100: `% 3 of 100` -> 3%
3. Percent Difference; What is 2 percent from 100: `% 100 - 2%`
4. Percent Increase; What is 100 + 2%: `% 100 + 2%`
 
Next version will be converted to a Script Filter.

Share this post


Link to post

Hi All, I've finally gotten a chance to convert this workflow over to a Script filter (Alfred-workflow is awesome, by the way), so you should now see results instantly, instead of having to wait for the large output.  I've also removed the copy to clipboard, since I never seemed to use that anyway.

 

You can get version 1.3.0 from http://www.packal.org/workflow/percent-change, or from https://github.com/bradmontgomery/alfred-percent-change

 

Let me know what you think.

Edited by bkmontgomery

Share this post


Link to post

Great idea! I usually just struggle in the calculator until I get the answer that looks correct. I have a few thoughts on how it would be more useful...for me at least.

 

2. Percent of; What is 3 percent of 100: `% 3 of 100` -> 3%

 

A. The wording seems to be incorrect. "3 percent of 100" is indeed 3, but if you type "3 of 10" (which, in your wording would be "3 percent of 10") you get 30, presumably 30% - which is wrong of course. I suggest you change the example wording to "What percentage of 100 is 3:" or to keep the order and English correct, "3 is what percentage of 100:" and the subtext with the answer could be renamed to "Percentage of" to differentiate it from...

 

B. I expected, and would find useful, the ability to do exactly what your example text suggests: find out what 3% of 100 is. Or to make the examples more clear, what 3% of 10 is: 0.3. A command could be as simple as "3% of 10" - note the % symbol after the 3. The subtext of this would more accurately be "Percent of".

 

Because of some of the confusion, I think it would be a good idea to add a % symbol to the answer where applicable. Since you're not using copy to clipboard anymore, I don't imagine that would be a burden on anyone. And with all the new features being added and proposed, I think it would add a lot of clarity when trying different formulas.

 

Vhp5Uu9.png

2TjUDQW.png

 

 

 

 

New feature:

due0qBo.png

 

 

 

 

I also made a new icon so it's visible in the black:

6P7b113.png

 

Alone here:

XYkFGPo.png

 

FYI, if you delete the 3rd argument on line 92 of percent.py, it will use the % icon above for completed calculations. (I'm not sure if you intended to use the info icon. I prefer the percent symbol the whole time, but don't really care.)

Share this post


Link to post

Hi sudopeople,

 

This is great feedback!  I can see where the phrasing is confusing.  I won't get  a chance to work on this for about a week, but once I do, I'll come back to it and push out a new release incorporating your suggestions.

 

Thank you!

Share this post


Link to post

A new version is out! 1.4.0 changes the former 'percent of' to 'portion of', and introduces a new 'percent of' that makes more sense.  Here's the examples:

 

1. Percent Change (increase/decrease): `% 3 6` -> 100%
2. Portion of; 3 is what percent of 100: `% 3 of 100` -> 3%
3. Percent of: 5 percent of 100 is 5: `% 5 percent of 100` -> 5, or `% 5% of 100` -> 5
4. Percent Difference; What is 2 percent from 100: `% 100 - 2%`
5. Percent Increase; What is 100 + 2%: `% 100 + 2%`
 
Thanks for all the feedback!  Keep it coming :)

Share this post


Link to post

Would be great to copy it to the clipboard on enter. I tried to add "copy to clipboard" Output to the WF but result will not be copied.

 

Done, change line 111 in percent.py from

wf.add_item(title=results, subtitle=subtitle)

to

wf.add_item(arg=results,valid=True,title=results, subtitle=subtitle)

and add WF step "Copy to Clipboard"

Share this post


Link to post

FWIW, as long as something is set for arg or copytext in wf.add_item(), you can hit ⌘+C on an Alfred result to copy it to the clipboard (i.e. you don't need valid=True if that makes no sense otherwise). By preference, copytext will by copied to the clipboard. If copytext isn't set, arg will be copied instead.

Edited by deanishe

Share this post


Link to post

Thanks for the great work @bkmontgomery!

 

I forked your repo and added two calculations that I frequently find useful:

 

1. What is the original number that number is b% less than?

2. What is the original number that number is b% more than?

 

These are tricky to remember how to calculate. These can be accessed by:

 

`% 100 is 2% lt`

`% 100 is 2% gt1`

 

You can grab the updated workflow here: https://github.com/AdamWagner/alfred-percent-change

 

@bkmontgomery, feel free to integrate changes into your original repo. 

 

I haven't made it available on Packal because, honestly, I'm not sure how ?

Edited by adam_wagner

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.

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