Guest
2010-03-24, 06:04 AM
Quote:
Originally Posted by flutegirl
Does anyone know of a script that will simply push out the start date of an action (or project) to x hours from now?
|
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"
try
set oWin to front window
on error
return
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
try
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
Last edited by RobTrew; 2010-03-24 at 10:34 AM..
Reason: fixed bug