A lot of people were excited by the recent release of Calca, a new text editor for iOS and OS X that allows you to solve equations right there in your text document, automatically.
It does look pretty great, and I’d recommend taking a look if you’re a scientist or engineer, but personally I don’t need anything this feature-rich, nor do I want to start using yet another text editor.
However, I did like the idea of quickly solving equations in the middle of writing without having to go to another app or Spotlight. So I put together these Applescripts and turned them into TextExpander snippets and a Keyboard Maestro macro. They give you the ability to quickly solve math in a text document.
If you don’t own TextExpander or Keyboard Maestro it’d be pretty simple to save these as system services using Automator.
Snippet which shows working
property equation : "%filltext:name=Math to do%" property solved : %filltext:name=Math to do% set working to equation & "\n= " & solved return working
Snippet which just gives the result
property solved : %filltext:name=Math to do% return solved
To use these expand the snippet and then input the equation you want to solve. One will return both the result and the equation you entered, the other will just return the result.
Keyboard Maestro macro
Triggered by this hotkey: ⌃⌥⇧⌘M
To use this, select some math, for example
(20+5)*2, and press the hotkey. The result will be returned below on a new line.
UPDATE: @keyboardmaestro let me know that there is another way to do this using the built in calculation engine in KM. Apparently there are advantages and disadvantages to doing that instead — I have no idea what they are. It’s certainly a slightly simpler workflow, so there’s that. Here it is:
Published on July 28th, 2013