The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   Export from the command line or AppleScript for specific contexts/projects? (http://forums.omnigroup.com/showthread.php?t=18247)

xuinkrbin. 2010-09-30 07:09 AM

Export from the command line or AppleScript for specific contexts/projects?
 
Hi,

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 or can Anyone point Me in the direction of information of how to do this in AppleScript? (I've looked at other AppleScripts but, due to My limited knowledge of the language, I am not exactly sure if they are for what I am looking.)

Thanks.

RobTrew 2010-09-30 03:21 PM

[QUOTE=xuinkrbin.;86484]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 [/QUOTE]

One approach would be to use something like my [I]QueryOF2Text[/I] script (attached below) which is a draft command-line version of [URL="http://bit.ly/OF-Find2"]Where In OF[/URL].

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[/CODE]
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[/CODE]

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:[LIST=1][*]Searches may be prefixed by the term 'archived'[*]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)[*]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[*]you can query on the properties of repetition and location records (this is not possible in raw applescript filters)[/LIST]
It would probably make sense to begin by experimenting with Where in OF? ([url]http://bit.ly/OF-Find2[/url]) 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.

[COLOR="White"]--[/COLOR]


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

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