I’m trying to create a script that will randomly print/display/return a task from the current perspective. Can anybody lend a helping hand?
I found http://forums.omnigroup.com/showthread.php?t=5181 that is similar, but for OF1 from 2007. I also checked out OmniFocus’s AppleScript guide, and while there were many examples for adding tasks, I couldn’t find one for selecting all tasks into a list.
What I have so far that isn’t working is
tell application "OmniFocus"
tell the default document to tell the front document window
set perspective name to "Home"
activate "OmniFocus"
tell content
set theVisibleTasks to tasks
end tell
end tell
end tell
which returns the error error “OmniFocus got an error: Can’t get every task of content of document window 1 of default document.” number -1728 from every task of content of document window 1 of default document"
Update: This looks like it could be a good reference: https://github.com/Matthewspear/OFList/blob/master/OFList.scpt