Migrating and using AppleScripts


I read the “What to know section…”, but there are 2 areas that I couldn’t actually figure out:

  1. what needs to change in the scripts to work with OF2?

     tell application "OmniFocus" to activate

    activates OF1 (even if it was renamed)

  2. how can I add scripts to the toolbar in OF2?


:- a

I haven’t noticed the naming issue you mention. I have my old OmniFocus build renamed to “OmniFocus 1.x” (in the same folder as my OmniFocus 2 build, which is just named “OmniFocus”). If I do:

  tell app "OmniFocus 1.x"
    log "test"

I can see 1.x logs the string. If you continue to run into this problem, we’d love details on how to reproduce it. But, you can explicitly target OmniFocus 2 by using a different form for the application:

  tell app id "com.omnigroup.OmniFocus2"


tell app "Volume Name:Path:to:the:OmniFocus.app"

For user toolbar scripts, because OmniFocus 2 is sandboxed, you need to place the scripts in a new place. In Finder, use the Go → Go to Folder… menu and enter “~/Library/Application Scripts”. Inside that folder, create a new folder “com.omnigroup.OmniFocus2” and put your scripts there.

Sadly, the system wide scripts menu that AppleScript Editor can display (via its Preferences pane) doesn’t open this new location – I’ll log a bug with Apple on that.


Thanks, that works great for toolbar scripts.

Let me try to explain this differently:

  1. I have renamed OmniFocus.app to OF1
  2. installed OmniFocus 2 in the same folder (/Applications) with its default app name (OmniFocus)

Now considering a script:

tell application "OmniFocus" to activate

I was expecting to see OmniFocus 2 being activated, but actually it activate OF1.

I can definitely modify my scripts to use the tell app id approach while moving them to the new folder location.

Update: interestingly, if I run the above script directly from the AppleScript editor without saving, the “OmniFocus” string is automatically transformed into “OF1” (which explains the behavior at least). I’m not sure though I understand why ASE is doing that part, but I also don’t think this is related to OF2.

I’ve tried this and restarted OF2 several times, but I don’t see the scripts.

Can you try the following to help double-check what is going on:

• Launch Terminal
• Drag the folder with your OmniFocus 2 scripts (~/Library/Application Scripts/com.omnigroup.OmniFocus2) from Finder onto Terminal
• Enter these commands in Terminal:

  ls -l

origamimbp:com.omnigroup.OmniFocus2 helma$ pwd
/Users/helma/Library/Application Support/com.omnigroup.OmniFocus2
origamimbp:com.omnigroup.OmniFocus2 helma$ ls -al
total 3224
drwxr-xr-x 15 helma staff 510 Mar 30 10:35 .
drwx------ 163 helma staff 5542 Mar 30 19:51 …
-rw-r–r--@ 1 helma staff 4940 Jul 8 2011 Clear Dates.scpt
-rw-r–r--@ 1 helma staff 8440 Jul 30 2009 Clear “Missing NA” Suffixes and Mark Completed.scpt
-rw-r–r--@ 1 helma staff 8004 Jul 30 2009 Clear “Missing NA” Suffixes.scpt
-rw-r–r--@ 1 helma staff 7690 Jul 11 2011 Defer.scpt
-rw-r–r--@ 1 helma staff 55784 Nov 5 2012 Populate Template Placeholders.scpt
-rw-r–r--@ 1 helma staff 5409 Jul 8 2011 Snooze.scpt
-rw-r–r--@ 1 helma staff 19662 Aug 27 2013 Support.scpt
-rw-r–r--@ 1 helma staff 251364 Nov 23 19:19 Templates.scpt
-rw-r–r--@ 1 helma staff 5753 Jul 9 2011 This Weekend.scpt
-rw-r–r--@ 1 helma staff 8287 Jul 8 2011 Today.scpt
-rw-r–r--@ 1 helma staff 8088 Jul 8 2011 Tomorrow.scpt
-rw-r–r--@ 1 helma staff 3652 Jul 8 2011 Total Time.scpt
-rw-r–r--@ 1 helma staff 35780 Dec 9 09:49 Verify Next Actions Exist.scpt

Ah yeah – you want Application Scripts, not Application Support. Hopefully either Apple will add a way to get to this folder easily or we’ll have time to add it ourselves.

In the latest build (r206599), you can get to that folder by choosing “Open Scripts Folder” from the Help menu.

Doing both of these things made several of my scripts appear in the toolbar editor and also work for OF2

change this in your scripts:

put your scripts in this new folder: