View Single Post
Hello,

I have drafted a script that when called will export my Omnifocus data to a text file. I then use Geektool to display this on my desktop as shown. This is working so far, but my script is VERY clumsy.

It sends keyboard commands to OmniFocus via system events which set the perspective, call up the export menu item, export the list to taskpaper format, sync (iPhone) and close the program. Because of the script's nature I've set it to only run if OmniFocus is closed else it might interrupt me as I'm working within the program. The script is called automatically every ten minutes by Geektool.

It is obnoxious to watch the program open, the keystrokes do their thing, and then watch the program close. It is also bothersome that I can't leave OmniFocus open to sync with the phone automatically every hour, or for an easy inbox dump via hotkeys.

Basically I'm looking for a more elegant solution for my goal: A script that operates at the program level rather than the system events level. I just don't know how to command OmniFocus to export a specific persepctive to the taskpaper format without using keyboard commands.

Is what I'm looking to do possible? Are there any resources I should consult? Would anyone be able to offer advice/help?

Anyhow, I've appended a link to a shot of the desktop and the clumsiness in question below. Thanks for any time spent helping,

Justin

http://gallery.me.com/jbaile38#10002...&bgcolor=black

tell application "System Events"
set num to count (every process whose name is "OmniFocus")
end tell
if num = 0 then
tell application "OmniFocus"
activate
end tell
tell application "System Events"
tell process "OmniFocus"

keystroke "p" using {control down, command down}
keystroke return -- return key
keystroke "e" using {command down, option down}
keystroke return -- return key
keystroke "r" using {command down}
keystroke "q" using {command down}
keystroke "s" using {control down, command down}
end tell
end tell
end if