Thread: due date format
View Single Post
And of course, as whpalmer4 reminds me, it's not quite a simple as that, because you probably want the tasks to have the default due date time, as specified in OF preferences.

By the time you have looked for a way of doing this, the advantages of the parse tasks approach are beginning to be quite clear :-)

Code:
tell application "OmniFocus"
	tell default document
		set Val1 to "foo5"
		
		set dteBase to (current date)
		set dteBase to dteBase - (time of dteBase) + (my GetDefaultDueTime())
		
		make new inbox task with properties {name:Val1, due date:dteBase + 1 * days}
		make new inbox task with properties {name:Val1, due date:dteBase + 3 * days}
		make new inbox task with properties {name:Val1, due date:dteBase + 7 * days}
	end tell
end tell

on GetDefaultDueTime()
	tell application id "OFOC"
		tell default document
			set dteBase to current date
			set dteBase to dteBase - (time of dteBase)
			return (my date (short date string of dteBase & space & (value of setting id "DefaultDueTime"))) - dteBase
		end tell
	end tell
end GetDefaultDueTime

Last edited by RobTrew; 2012-07-31 at 01:33 PM..