Tyler Eich Posted June 27, 2014 Share Posted June 27, 2014 This workflow extends Alfred's built-in calculator function. It recognizes durations as input and allows them to be added / subtracted. For example, if you type "8:00:18 - 4:19:23" into Alfred, you'll get "3:40:55". You may add or subtract as many durations as you like (e.g. "3:32:55 - 5:57 + 4:50:14"). Download Preview: arsenty, DJay and tanc 3 Link to comment
dfay Posted June 28, 2014 Share Posted June 28, 2014 I'd love to see the source of this. The workflow just has an executable. Am curious as to how you extended the built-in calculator. Link to comment
Tyler Eich Posted June 28, 2014 Author Share Posted June 28, 2014 I'd love to see the source of this. The workflow just has an executable. Am curious as to how you extended the built-in calculator. I'll probably post the source code on GitHub at some point. Here's a quick look in the meantime: http://cl.ly/code/3a402k0D1s2v By the way, I'm not actually extending the codebase for Alfred's calculator. The workflow feels like an extension of the calculator because it is triggered by the same characters that trigger the normal calculator (i.e. 0-9 and +-). These keywords act as a bridge to the binary, which returns results very similar to Alfred's normal calculator. It's also very fast, mainly because it's written in C. Link to comment
unnamed777 Posted December 14, 2019 Share Posted December 14, 2019 I found some issues with calculator. For instance, "01:10+00:10+00:10" returns "01:21:00" instead of "1:30:00". Even example from the main screenshot has an error (result should be "7:40:38"). I used source code from post above and has fixed issues. The fixed code and updated binary are available on github. Link to comment
Nils Posted February 18, 2020 Share Posted February 18, 2020 For your latest code. I had to change from const char sep = ':'; to const char sep[2] = ":"; to get it to work. Compiled, ran, happy. Test for me was: "03:50+ 10:40" which di not result in 14:30, but in something with a 5 in the end - 13:45 I think it was. The first value did not get parsed to 3h 50min, but to 3h 5min. The latter worked!? Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now