Hi everyone,
I am trying to put together a script that you can put “natural language” dates in like you can in the OF Sidebar (mon+1w for Monday in a week) and use those to defer / due a set of tasks. I try to use transport text
for this, but have to clean up (delete) the automatically needed task afterwards.
Any ideas for a more elegant implementation?
tell application "OmniFocus"
tell content of first document window of front document
set tasksSelected to value of (selected trees where (class of its value is not item) and (class of its value is not folder))
if length of tasksSelected is 0 then
display alert "You didn't select any OmniFocus tasks."
return
end if
end tell
end tell
tell application "OmniFocus"
tell default document
set myDeferDate_list to parse tasks into with transport text "no task #mon+1w #" with as single task
set myDeferDate_task to first item of myDeferDate_list
set myDeferDate_prop to properties of myDeferDate_task
set myDeferDate to get defer date of myDeferDate_prop
delete myDeferDate_task
end tell
end tell
repeat with otask in tasksSelected
tell application "OmniFocus"
set defer date of otask to myDeferDate
end tell
end repeat