The Omni Group Forums

The Omni Group Forums (
-   OmniFocus 1 for Mac (
-   -   Set new Start Date script? (

flutegirl 2010-03-23 06:21 AM

Set new Start Date script?
Does anyone know of a script that will simply push out the start date of an action (or project) to x hours from now?

I have a lot of active tasks, but there are some times when I know I'm not going to be able to get to something until some time in the future, so I'd love to be able to move them off my "Available" list with only a click or two.

I currently have (and use often!) Daniel Byler's Defer by days script, and modified it to also have a Defer by hours script, but since a majority of the actions I currently have do not have a start date, those scripts don't work. Additionally, if there is a start date, it's not easy to figure out how many days/hours I need to push it out to get it to be only an hour or two from now.

I'd love to have a way to do this quickly without having to manually modify the start date of the action(s) in question.

Anyone know where I might be able to find a way to do this? I've tried modifying the scripts mentioned above, but can't seem to figure out how to get them to do what I want... Or, do any of you have suggestions on a better workflow which provides similar results?

Any assistance would be greatly appreciated!

mmb32 2010-03-24 02:24 AM

Me too :-) - but I would like an automatic way of setting start date the same as due date as i work mainly with the latter, and dont want to see all these items . Iknow that perspectives can filter out a lot of stuff but a quick script to set start date would be great.




RobTrew 2010-03-24 07:04 AM

[QUOTE=flutegirl;74954]Does anyone know of a script that will simply push out the start date of an action (or project) to x hours from now?[/QUOTE]

Here is a rough sketch, which you may be able to adapt.

[CODE]-- Ver 0.2 fixed bug
-- Set the start date of selected tasks/projects to N hours from now ...
-- (Prompts user for the number N)
on run
set dblHours to GetNumber()
set strReport to DeferSelected(dblHours)
if length of strReport > 0 then display dialog strReport
end run

on DeferSelected(dblHours)
tell application "OmniFocus"
set oWin to front window
on error
end try

set dteWhen to current date
set hours of dteWhen to (hours of dteWhen) + dblHours

set strReport to ""
set lstTrees to selected trees of content of oWin
repeat with oTree in lstTrees
set oValue to value of oTree
tell oValue
set cClass to class
if (cClass is task) or (cClass is project) then
set start date to dteWhen
set strReport to strReport & name & return
end if
end tell
end repeat
if length of strReport > 0 then
set strReport to "Deferred start date of:" & return & return & strReport & return & "to: " & (dteWhen as string)
end if
end tell
return strReport
end DeferSelected

on GetNumber()
tell (display dialog "Number of hours from now: " default answer "0")
set strNum to text returned
end tell

set dblNum to strNum as number
on error
display dialog strNum & " is not recognizable as a number"
return missing value
end try
return dblNum
end GetNumber

mmb32 2010-03-24 07:15 AM

Thanks for sharing this, works great.


Greg Jones 2010-03-24 10:44 AM

@RobTrew, did you change anything in the script other than adding comments? No matter what I enter for the hours, the start time is set to the current time.

RobTrew 2010-03-24 11:35 AM

Thanks Greg - I have fixed the bug now. (Ver 0.2 still above)

Greg Jones 2010-03-24 11:40 AM

Works for me now-thank you!

flutegirl 2010-03-24 06:58 PM

[QUOTE=RobTrew;74984]Here is a rough sketch, which you may be able to adapt.


Thank you, thank you, thank you!

That script is perfect, and does exactly what I was looking for!

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

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