OmniFocus Sync Speeds

Recently, I've noticed that the syncing of my OmniFocus database has been painfully slow. I've resorted to other ways of tossing items in OmniFocus, particularly on iOS where I can't let OmniFocus sync in the background. I tweeted out my frustration and Ken Case, CEO of the Omni Group, kindly got back to me:

@pxldots Unless you have big attachments, archiving doesn’t affect sync times nearly as much as stale devices do. /cc @dirckxd @ediventurin (link).

and:

@pxldots If you have more than 150 zip files (check the bottom of settings in the iPhone app), that’s probably the problem. (link)

As Ken mentioned in his tweets, you can check whether you have an excess of zip files (the result of some syncing voodoo to manage the eventual sync of "stale" devices, those that haven't been synced in awhile) in the settings of the iPhone and iPad apps. My iPad, which hadn't been synced in ages, looked like this:

iPad Sync Settings

1,100 files! On my final sync before resolving the issue, the iPhone sync took over a minute and the iPad, which had gone much longer since its last use, took over 9 minutes.

You can get a sense for which devices are registered (and which may be clogging the pipes) in the Sync preferences of the Mac version (OmniFocus > Preferences > Sync) by clicking on the Show Clients button.

Mac Sync Settings

To resolve the slow sync, just sync each of the clients, unregister each on the preference pane of the Mac client, and then re-sync each again. Subsequently, the zip file count should drop, as should the sync time. I can confirm that the times were much improved on my end, so give this a shot if you are having similar troubles!

iPhone Sync Settings Before and After

Templates.scpt

Once again, I managed to spend a day ignoring my corporate tax and business ethics assignments and make a handy (to me, anyway) OmniFocus script. This one tackles one of the big missing pieces of OmniFocus: templates.

You can download the script here: Templates.scpt. In short, the script looks for a template folder and offers to do all the heavy lifting of creating a new instance of the template. Here's the detailed process, if you're interested:

(1) You make a template folder and some template projects. The variables are designated by a symbol of your choosing (I chose "$" as the default as a tribute to my favorite CSS preprocessor, SASS), with any variables used listed in the last paragraph of the project's note field (i.e., "$Person $Topic $Location"). Variables will be recognized in the project name and in the sub-task names, notes, and contexts. Thanks to Sven Fletcher, it also handles projects without variables gracefully.

0 - Template Folder

(2) Run the script. On the first run, the script will ask what variable you are using and whether you want to be prompted for viewing new template instances after they are made.

1 - Variable Definition

(3) Script goes hunting for templates. The script will try and find a folder that contains "Template" in its name. If it can find one, it will show you all remaining projects in that folder. If it can't, it will ask you to pick a folder that contains your templates, and you can then select from that list.

2 - Select Template

(4) You select destination folder.

3 - Select Folder

(5) You feed script variables. Based on the notes field of the project, the script will prompt you to fill in your desired values for each variable it finds.

4 - Variables

(6) Script works hard. It might take a little while for the whole thing to finish, especially if it is a big template. Be patient! The script replaces any instances of the variables in the project name, task name, task note, and task context. The task context replacement is especially neat: it looks to see if, in replacing the variable in the context, it would create a context you already have. If so, it assigns that context to the task. If not, it creates a new context in the same containing folder as the context with the variable. This process is particularly useful if you use a "Waiting" container to store multiple individual-specific waiting contexts like I do.

In addition, you can specify a relative date (from today) for any number of tasks (or the project as a whole) to start or become due. To do so, simply put "Start" or "Due" at the beginning of a new paragraph, and use the smart date syntax you usually do in OmniFocus (for example, "2d", "4d at 5pm", "3w 2d 14:00", etc). The script will pull that out, assign the calculated date to the start/ due date of that task, and then strip it out of the task notes.

(7) Script finishes. If you told it to prompt you, you will now be asked whether you want to see the new instance, which will open a new OmniFocus window with that project focused on.

5 - View in Context

(8) Admire results.

6 - Completed Templates

Many thanks to the Omni Group for making such an amazing tool (with such excellent Applescript support). Also, I took a lot of inspiration from Curt Clifton's template script, which is amazing.

If you're interested in seeing my past projects, you can check out the Project page. If you want to see what my distracted mind comes up with next, you can follow me on Twitter or subscribe to the RSS feed.

OmniFocus "Mail Complete" AppleScript

Some days, I just feel like blowing off most of the tasks I thought I'd do and work on projects I really enjoy.

That was today.

In addition to the OmniFocus scripts I posted earlier, I built the first version of a pretty neat tool that connects Mail and OmniFocus. If you read my OmniFocus setup post, you'll know that I have many sequential OmniFocus projects with "Waiting For" contexts whenever I need something from someone else to move a project along. I have "Waiting For" contexts for each of the people who I communicate with frequently. The problem is, I often receive emails from these individuals but fail to remember to check off the associated "Waiting For" task. This script solves all that.

The script grabs the senders of all selected tasks and compares this to the list of contexts in your OmniFocus library. For the script to work, the individual waiting contexts must be together in a context group with the string "Wait" somewhere in the name. It then grabs every task that has a "Waiting For" context associated with that sender and has yet to be completed. The tasks it finds will show up in a picker list which allows you to automatically complete one or more. If it doesn't find any tasks, it will look to see if you have a perspective that looks like it's meant to look at "Waiting For" tasks and will offer to open it for you.

Download the script from the Projects page!

An illustration of the picker based on the selected messages.

An illustration of the picker based on the selected messages.

OmniFocus Utility Applescripts

I've been having lots of fun polishing some existing scripts and working on some new OmniFocus Applescripts. Time to do a bit more sharing.

Later.scpt, which allows you to batch-defer selected tasks by a given amount of time/ to a given date and time, has been updated with the ability to specify specific dates and times in a number of new syntaxes, an escape to temporarily change the due/ start date preference, and some general code improvements.

Paraquential.scpt is a very small script that switches the current group/ project between sequential and parallel ordering.

Finally, Name Replace.scpt is a find-and-replace tool for OmniFocus task/ project names. You define the replacement pair using the following syntax: currentString > replacementString. You can also specify how many of the replacements you want to do using "* numberOfReplacements"; for example, appending "* 2" will replace only the first two instances of the replacement pair. You can also do multiple find-and-replace actions simultaneously by separating each with "//". All of these syntax items can be changed in the script file.

All of these are available on the Projects page — I'm learning how to use git and Github so I will (hopefully) soon be able to put these in a more appropriate spot.

AppleScript Experiments: "Later" in OmniFocus and Save As PDF

Update (January 1, 2013): Later.scpt has been updated to allow for absolute date and day of the week date syntaxes. For the most recent version of these and future projects, please take a trip to the Projects page.

On Christmas I received a number of books (which, if the past is any indication, will still be largely unread by next Christmas) on the topic that has really been grabbing my attention these days: programming. From the pile of dead trees I decided to start with Learn AppleScript: The Comprehensive Guide to Scripting and Automation on Mac OS X. Since Christmas day, I have been reading voraciously (though, still not at a swift enough pace to make a significant dent in the 1000-page behemoth), and built two practice scripts that I am pretty excited about. I decided to share these here in the hopes that you, too, might have a use for them1.

Deferring OmniFocus Tasks With OmniFocus-like Syntax: "Later"

Download the script: Later.scpt

I have been a happy user of Dan Byler's OmniFocus AppleScripts (in particular, the "Defer" script that postpones a task's start date by a user-determined number of days) for awhile, but the inability to define the desired start date in OmniFocus's excellent date syntax has always frustrated me. I decided to have a go at replicating the date parser in AppleScript so that I could push a task to a very specific amount of time from today.

The script I built does what I need it to, though your mileage may vary. The script will initially ask if you want to automatically flag tasks while deferring them (which is the basis of my OmniFocus workflow), and will then present a dialog box for you to enter the amount of time to defer the task for. The syntax is the same as OmniFocus's: you can use "weeks", "w", "days", "d", and 24- or 12-hour time specifiers (with or without the AM/a/PM/p). So, for example, writing "2w 4d 12:40pm" would defer the start date of that task for two weeks, and four days, and would set the start time to 12:40pm. You can exclude any of the three pieces and it will still work (as long as you specify at least one item).

A few things: OmniFocus is frustratingly slow at setting the start date of tasks via AppleScript. Every script I looked at, including my own, took about half a second to set the start date for each task no matter what I did. Also, if you have a Retina Mac, be warned: AppleScript does not seem to have access to retina-fied dialog windows, so those look absolutely awful.

Additionally, I have left a lot out that I might add in sometime in the future: the ability to defer due dates instead of (or in addition to) start dates (which I disagree with on a technical level, by the way), the ability to set the date directly instead of relatively, and the use of Growl for notifications.

Saving Word and PowerPoint Files as .pdf

Download the script: Save MS Office as PDF.scpt

The second script was a little simpler and one I wish I didn't need. However, as a student, I receive an enormous amount of .doc/.docx and .ppt/.pptx files. Setting aside the fact that I find Word and PowerPoint to be inferior to Pages and Keynote, respectively (or, in the case of Word, inferior even to a plain text file), viewing these files on iOS devices can result in weird layout problems, and their long-term portability is anything but assured.

The script initially asks whether you use Path Finder or Finder for your file browsing. It then takes the file selection from your preferred application, ignores any non-Word and non-PowerPoint files selected, and starts saving them to the same directory as the original file. It also asks if you want to convert both the Word and PowerPoint files (or only one or the other) if it detects that you have selected both types.

For this script, I will probably work on improving the Path Finder/ Finder selection process, and I may add the option to have the script automatically delete the original Word and PowerPoint files. Other than that, I am fairly happy with this script, though it is still limited by the speed of Word and PowerPoint. It's still miles ahead (both in terms of speed and reliability) of the GUI scripting-based process I had done in Keyboard Maestro.

If you have any comments about the scripts or would like to see something added, feel free to shout at me on Twitter as @pxldots.


1. I find it an incredible part of the world we live in that, with just one good book and the internet at your disposal, even a non-programmer can learn so much, so quickly.  ↩