View Single Post
Quote:
Originally Posted by xuinkrbin. View Post
I want to export the due-today tasks of a particular project/context to a plain text file for digestion by other tools. Can this be done from the command line
One approach would be to use something like my QueryOF2Text script (attached below) which is a draft command-line version of Where In OF.

You can use it from the shell prompt in the OS X terminal like this:

Code:
osascript ~/Library/Scripts/Applications/Omnifocus/queryof2text.scpt 'tasks where ("library" is in name of its context) and (due date < now)' > listA.txt
or
Code:
osascript ~/Library/Scripts/Applications/Omnifocus/queryof2text.scpt 'tasks where ("write" is in name of its containing project) and (due date < now)' > listB.txt
where osascript calls the script in the specified path, and gives it the query (NB: in single quotes) as an argument, sending the output lines into the named text file.

The query syntax is essentially that of an Applescript WHOSE / WHERE clause,
(The query should begin with the words "where"/"whose" and folders/ projects / tasks / contexts)
There are currently a few minor extensions to the applescript query language:
  1. Searches may be prefixed by the term 'archived'
  2. The terms today/yesterday/tomorrow/soon/now may be used in place of dates. 'today' (but no other expressions) may be modulated with interval strings: today + 2d, today - 1w, today +2m, today +1y
    ('now' is the current system time, 'today' is 00:00 hours this morning)
  3. symbols in the range <jan> to <dec> are interpreted as 00:00 hours at the start of the next (or current) month of that name
  4. you can query on the properties of repetition and location records (this is not possible in raw applescript filters)

It would probably make sense to begin by experimenting with Where in OF? (http://bit.ly/OF-Find2) to get the query right.

Where in OF contains a simple property browser, with which you can start to explore the query language from which filters can be built.

--

Last edited by RobTrew; 2012-07-17 at 06:53 AM..