Bottom Line: A few tweaks to my OmniFocus 2 “Search All Tasks” AppleScript.

Most of my readers know I’m a big fan of OmniFocus. Lately I’ve been trying to get used to OmniFocus 2, with a few little bumps along the way. One issue was that I had an AppleScript to search all tasks that I used all the time in OmniFocus (1) that quit working.

The script is a standalone AppleScript that I run with a Quicksilver trigger, but would work equally well with whatever hotkey / keyboard shortcut setup you prefer. Because the script first activates OmniFocus, I can invoked this from whatever screen or app I’m using, and it appropriately bring OmniFocus into focus and finds the task in question. It’s without a doubt my most used OmniFocus script, so having it broken was a bummer.

Luckily for me, a few of the kind folks at the new OmniGroup forums helped me out and got it mostly working again. However, today I realized that, presumably due to the new way OmniFocus 2 separates the inbox from projects, the script was appropriately searching “all projects” but missing tasks in the inbox — which didn’t used to be a problem.

I decided to tinker around a bit, and as usual got frustrated with AppleScript (Python just makes everything else seem so difficult). Then, I realized that instead of trying to script all of the view options to ensure all tasks were visible (including the inbox), I could just make a new perspective, set all my view options with the GUI. Then, all I had to do was figure out how to activate the perspective in the script, which wasn’t too bad.

I added two new perspectives, one to search all tasks (including completed), and one to search only remaining tasks (default). As currently written, you have to name the perspective the same thing as the button names in the script (Search Remaining and Search All as currently written), but that could easily be changed if you wanted. The settings I used for my perspectives are in the comments at the top of the script.

It seems to work great and really simplifies the AppleScript. Only other thing I really changed was to move the dialog to the beginning of the script, so if you accidentally invoke it or change your mind, it will cancel before stealing your focus and activating OmniFocus.

Let me know what you think. Thanks to Sven Luetkemeier and Rob Trew for their effort on (much fancier) earlier versions.