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.

 

 

Link to comment

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! 

Link to comment

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! 

Link to comment

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

Link to comment

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.
Link to comment

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
Link to comment
  • 3 weeks later...

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

Link to comment

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 :)
Link to comment
  • 1 year later...

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"

Link to comment

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
Link to comment
  • 1 year later...
  • 9 months later...

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
Link to comment
  • 4 months later...
  • 2 years later...
  • 2 weeks later...

I've loved this workflow for a long time and appreciate all the fine work @bkmontgomeryand others. But I'm still not able to have this copy to the clipboard upon hitting return or enter (in fact, nothing happens at all when I do that) and can only do it by hitting cmd-C, which is nice but different from other workflows I use that work with copying to the clipboard. Any way to fix this? Thanks so much.

Link to comment
  • 10 months later...
  • 1 month later...

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