A general script (to be run from the OS X Terminal command line with osascript), which generates custom lists of records from the OmniFocus database. (Standard output text, which can be redirected to text files, or piped through further Terminal commands).
Differs from earlier scripts in that the fields to be exported can be specified in a SELECT list.
(Note that its function is essentially the same as the script on which the set of Geektool scripts in another thread are based (and this could also be used, of course for Geektool).
The key difference is that the other script uses SQL to query the OF cache, whereas this script restricts itself to Applescript and the OF Applescript library.
Each approach has its profile of cost and benefit.
Vanilla Applescript:
NAME
Differs from earlier scripts in that the fields to be exported can be specified in a SELECT list.
(Note that its function is essentially the same as the script on which the set of Geektool scripts in another thread are based (and this could also be used, of course for Geektool).
The key difference is that the other script uses SQL to query the OF cache, whereas this script restricts itself to Applescript and the OF Applescript library.
Each approach has its profile of cost and benefit.
Vanilla Applescript:
+SQL + Cache :
The syntax is more user-friendly, and the approach is more durable. The Applescript library is likely to remain fairly stable across OF builds. Officially supported.
-
A bit slower, and only works when the OmniFocus application is running. Some blind patches in its access to information. Sorting not directly supported.
+(In short if the Geektool lists of OF actions on your desktop are broken by a future build of OF, you can use this script until OFGeekTool.scpt is updated. It will work, though only when OF is running. It will also be slower, and will tie up your processor more, so you would probably need to reduce the refresh interval.)
Rather fast, and works even when OmniFocus is not running. Allows reading of some data fields which are not accessible through the Applescript library. Lists can be quickly and simply sorted by any field.
-
The syntax is more opaque, and the approach is less durable. Scripts using this approach will need to be updated whenever a new build of OmniFocus changes the schema of the cache. An OmniGroup comment: "at the deep end of not officially supported" :-)
NAME
OF-AQL OmniFocus for Mac Applescript-syntax Query LanguageSYNOPSIS
Run from the OS X terminal:DESCRIPTION
osascript ~/Library/Scripts/Applications/Omnifocus/OF-AQL.scpt -?
osascript ~/Library/Scripts/Applications/Omnifocus/OF-AQL.scpt --help
osascript ~/Library/Scripts/Applications/Omnifocus/OF-AQL.scpt query [header]
[query]: (single-quoted argument on the command-line)
SELECT field1, field2, fieldn FROM tasks|projects|folders|contexts [WHERE condition(s)][header]: (single-quoted argument on the command-line)
Any single-quoted descriptive string. Defaults to an upper-case version of the query. Suppress by specifiying an empty string.
OF-AQL.scpt is a draft Applescript which generates custom lists, in text format, of tasks, projects, folders, or contexts in the default OmniFocus database. The list description language is essentially that of the OmniFocus Applescript library. The Where in OF script can be used to explore this language interactively.DOWNLOAD
EXAMPLES (OS X terminal command lines):
osascript ~/Library/Scripts/Applications/Omnifocus/OF-AQL.scpt 'select name, due date from tasks where next is true' 'Next Action' > NextAction.txt
osascript ~/Library/Scripts/Applications/Omnifocus/OF-AQL.scpt 'select folder, name, due date from projects where completed is false and status=active' 'Active Projects'
osascript ~/Library/Scripts/Applications/Omnifocus/OF-AQL.scpt 'select folder, project, name from tasks where completed=false and name of its context="Phone"' 'Phone:' > Phone.txt
From http://bit.ly/OF-AQL--
Unzip and copy to your OmniFocus script folder, so that it has the path:
~/Library/Scripts/Applications/Omnifocus/OF-AQL.scpt
Last edited by RobTrew; 2012-07-17 at 06:11 AM.. Reason: Updated link to Where in OF