The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > OmniFocus Extras
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Custom text exports from OmniFocus (applescript-based query language) Thread Tools Search this Thread Display Modes
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:
+
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.
SQL + Cache :
+
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" :-)
(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.)

NAME
OF-AQL OmniFocus for Mac Applescript-syntax Query Language
SYNOPSIS
Run from the OS X terminal:

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.
DESCRIPTION
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.

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
DOWNLOAD
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
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Query based on completion date cdavaz OmniFocus 1 for Mac 3 2012-07-17 09:20 AM
AppleScript to query the user data key/value pairs apl OmniGraffle General 2 2012-01-14 01:05 AM
What language is closest to HyperTalk besides AppleScript? omnibob Omni Lounge 0 2009-09-02 08:14 AM
what is the fastest way to search tasks based on custom data in AppleScript cope360 OmniPlan Extras 2 2009-07-16 02:57 PM
OG exports Visio XML with all Greek text fnn OmniGraffle General 2 2009-03-09 10:15 AM


All times are GMT -8. The time now is 09:07 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.