When writing Emails or replies to friends I often find myself typing in the browser until I remember that it things can go pear shaped resulting in me having to start from all over again. This happened way to often to me… mostly when writing longer replies. My usual procedure is to copy the text and fire up my favorite editor and continue writing there. Since Lion native text editors provide a more secure writing environment which prevents you from losing data thanks to the auto-resume feature. When I’m finished I return to where I started, paste the text and send it off. Every time after such a copy and paste action I see an equation in my head, on its right side is a text in all-caps, bold and colored in a kind of redish orange saying “AUTOMATE THIS”.
So, instead of postponing the matter again I opened up Keyboard Maestro and started fiddling. I got stuck and didn’t know how to make Keyboard Maestro remember the app I copied the text from, making it impossible to return to that exact application. Bummer.
The next best thing was to search the web for a smart person who already made this happen. Turns out there is one and I already had Kaushik Gopal’s “Edit with BBEdit” in my Keyboard Maestro Library.
Koushik has a lot of smart stuff going on and I rewrote his macro to work with FoldingText. His macro had the same flaw that it didn’t remember the starting point of writing. So, if one is switching applications while writing, the macro’s “Activate Last Application” is like a call for trouble.
Today I started from scratch with my own macro to see if I missed something. Turns out there is a token called
%CurrentApplication%. I stumbled upon this by trial and error – it’s not in the Keyboard Maestro documentation - and thanks to the token I was able to make to macro work like I want it to.2
Update: The macro now remembers the initial application better even when it is not located in the Applications folder. The download and the screen shot are up to date too. Also… there’s indeed a token in Keyboard Maestro to set the FrontApplication. My thanks go to @peternlewis.
Here’s how the macro works:
- Where ever I write I can press
- All text gets selected and cut. FoldingText opens with the selected.
- When I’m done I press
⇧⌘W, FoldingText closes and edited text appears in where I’ve started writing.
So, if you’re really want to replicate QuickCursor’s functionality and also want to choose your editor I would advise you the fine-tune the macro to work with all your editors3 and put all those macros in a Keyboard Maestro palette.
It’s no longer on sale but that there’s a link to the source code which is available on GitHub. It wasn’t the solution for me since in the FoldingText forums there was some talk about it having problems with FoldingText (which I wanted to use). ↩
As of writing this little post I wanted to make sure that it really isn’t in the documentation. In my researched I found the following post: Keyboard Maestro Variables: Remember Current Application. Turns out Gabe already found this out in 2011 (Why am I not surprised?)… and I have to practice on my search query skills. ↩
For instance when trying to close Byword, it doesn’t show you a “Delete” button but rather a “Don’t Save” button. ↩