The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > OmniFocus Extras
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Applescript: Loop through all open tasks Thread Tools Search this Thread Display Modes
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.
Assuming that you are bringing the time ahead, rather than deferring it to the morrow, perhaps something roughly like this:

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

Last edited by RobTrew; 2012-04-23 at 10:40 AM.. Reason: edited code: added a 'previous day' line
Hello RobTrew,
fantastic! That is exactly what I was looking for.
Thanks very much for your great help!

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
Applescript Framework to Loop Through Projects and Tasks elrjax OmniFocus Extras 2 2012-01-23 11:04 PM
AppleScript to open bookmark folder in Safari urtlnomis OmniFocus Extras 0 2011-04-05 09:12 AM
Default window doesn't open after running Applescript ryans OmniFocus Extras 4 2010-10-29 09:48 PM
how to quickly see total open tasks for each context mwarner OmniFocus 1 for Mac 4 2009-05-08 04:20 PM
Open Archive of 1.1 with AppleScript digitalimago OmniFocus Extras 2 2008-10-20 10:31 PM

All times are GMT -8. The time now is 07:17 AM.

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