The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   Applescript: Loop through all open tasks (http://forums.omnigroup.com/showthread.php?t=24015)

djqx 2012-04-23 05:30 AM

Applescript: Loop through all open tasks
 
Sorry for asking that basic question, but I looked through the whole forum and have not found an answer to this:
how can I loop through ALL tasks of the whole database - not just the tasks of a perspective or a project, and not just the tasks I previously selected. What I'd like to do:
Some tasks I import (from mail or OmniOutliner) possess a due date that is set to midnight. I'd like to run a script every day that changes the due date to some time in the early evening.

It would be nice if someone could give me a hint for that.

Thanks for your help.

RobTrew 2012-04-23 09:03 AM

Assuming that you are bringing the time ahead, rather than deferring it to the morrow, perhaps something roughly like this:

[CODE]set plngHours to 19 -- e.g. 7pm

tell application id "OFOC"
tell default document
set lstTasks to flattened tasks where (due date is not missing value)
repeat with oTask in lstTasks
set dteDue to due date of oTask
if hours of dteDue = 0 and minutes of dteDue = 0 then
set dteDue to (dteDue - days) -- previous day
set hours of dteDue to plngHours
set due date of oTask to dteDue
end if
end repeat
end tell
end tell

[/CODE]

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

djqx 2012-04-24 12:27 AM

Hello RobTrew,
fantastic! That is exactly what I was looking for.
Thanks very much for your great help!


All times are GMT -8. The time now is 08:19 PM.

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