Support Produced by OmniGraffle 7.5 test 2017-09-15 03:22:04 +0000 phone/email/twitter +1 206-523-4152 or 800-315-OMNI

AppleScript changes in OmniFocus 2.0

Here is a list of changes to AppleScript in OmniFocus 2. If you’re looking for help with scripting, our forums are a great place to connect with other users.

We’ve maintained backward compatibility where we could, but there are a lot of changes between OmniFocus 1 and OmniFocus 2. Here’s what you should be aware of as you update your OmniFocus scripts.

AppleScript is supported only in the Pro edition of OmniFocus.

Our rich text class is now called rich text instead of text, matching other applications on the system. Compiled scripts should continue to work. The AE code is now ‘OSrt’ with an synonym of ctxt. Other apps do other things:

Apple apps:

  • Xcode.app rich text / ‘ricT’
  • AppleScriptKit.framework rich text / ‘ricT’
  • iChat rich text / ‘rtfx’
  • Mail rich text / ‘ctxt’
  • Aperture rich text / ‘ctxt’
  • TextEdit uses scriptSuite/scriptTerminology and ends up with text / ‘ctxt’

AppleScript related apps:

  • Script Debugger.app rich text / ‘ricT’
  • FastScripts.app rich text / ‘ctxt’

Omni apps (already changed via OmniStyle.sdef):

  • OmniPlan rich text / ‘ctxt’
  • OmniFocus rich text / ‘ctxt’

Other apps:

  • Scrivener rich text / ‘ctxt’
  • PDFpen rich text / ‘ctxt’
  • VoodooPad rich text / ‘rtfx’
  • Adium rich text / ‘ricT’
  • Acorn rich text / ‘ctxt’

In order to work with application sandboxing, file or POSIX file must be used for saving and opening instead of passing strings as file paths.

When making a new document with AppleScript (a fairly rare operation, except for our testing scripts), a file property must be specified.

The name of document is now the display name instead of the last path component (including the path extension). This means that name based lookups need to not include the path extension. Additionally, name based lookups are case- and diacritical-insensitive.

The file name property of the file attachment must be a file or POSIX file due to sandboxing.

The autosave interval property on document has been removed.

The value property on the attribute class now returns a generic color record for color-typed attributes. This is a record with specific components, including alpha (with numeric components ranging from 0 to 1).

The regexp argument of the replace command has been named regular expression and given a new type code so that old scripts using that form will neither compile or execute. The format of this regular expression is now based off the ICU syntax used by Apple’s frameworks.

The select command has been removed. Instead the add, remove, and set commands can be used to update the selected trees element.

Added the pbcopy, pbpaste and pbsave commands to copy items to and from the pasteboard.

The library and inbox properties have been removed from the sidebar tree class.

The document window class now has a selected sidebar tab property.

The selected view mode identifier property on document window is gone, replaced by the selected sidebar tab property. The available view mode identifiers property is also gone as the available list of tabs is described by the type of the selected sidebar tab property.

The available smart group identifiers and selected smart group identifier properties on sidebar tree don’t map directly to the view settings set up by the interface and are deprecated (marked hidden, but still in the suite). If you need scripting access to the view settings, please let us know what we are trying to accomplish so we can add appropriate access.

The import command has been replaced by the import into command, which specifies the destination document explicitly. Additionally, this now takes a file typed parameter for the from argument.

The parse tasks command has been replaced by the parse tasks into command, which specifies the destination document explicitly.

The code for default value on the style attribute class has changed from ‘OSdv’ to ‘OFdv’. Scripts using this terminology may need to be recompiled.

If you have any specific scripting questions, please feel to start new threads in the OmniFocus Automation area of our forums!

Last Modified: Dec 13, 2023

Can we help?

support@omnigroup.com
+1 206-523-4152 or 800-315-OMNI

Was this article helpful?

Still need help?

support@omnigroup.com
+1 206-523-4152 or 800-315-OMNI