Quote:
Originally Posted by skillet
I need help in understanding why an action would get whisked away if you duplicate it and you are still in the same view you were currently seeing the action. Wouldn't it have all the same values and still be visible?
|
I mentioned the whisking away would happen after you modified the duplicate (setting a new due or start date, for example, when grouping or sorting by same).
Quote:
I am really just trying to duplicate an action that has a weekly or monthly repeating value and get back to it in a few days later. I don't want to just change the start day because when I complete the action, in the following week it will show up on the day I forwarded it to. I don't want to leave the original start date and keep seeing it the next few days as an available or next action and have to remind myself that I can't do that today.
|
Okay, you've got a repeating task with a regular schedule, but this time around the schedule needs to be different. I just leave it as scheduled and mark it off when it gets done; my start and due perspectives (and forecast view on iPhone/iPad for due items) show me the things haven't been done on schedule, so they aren't immediately out of sight and out of mind. I have a look back at the start of the day and try to knock off any leftover items I can before turning to the new day's items, and when I exhaust the day's list or get near the end of the day, I'll look back again. Doing my project reviews also helps provide a safety net.
That said, I think it wouldn't be too hard to make a script that marked the item as complete (so the next one would be generated), then changed the original to be incomplete and non-repeating. But what do we do about the date? Does the script prompt for the new date, or just assign one, or leave that to the user? I'll give you three guesses as to which option is easiest to code :-)
If you were to create such a script, it might look something like this:
Code:
-- Reschedule Repeating Task
-- Solves issue of a repeating task that needs the current instance rescheduled without
-- disturbing the scheduling of future instances. Current instance is marked complete to
-- generate the next instance, then set not to repeat and optionally rescheduled.
-- if pOffertoReschedule is true, prompt user for rescheduling, otherwise leave dates unmolested
property pOffertoReschedule : true
on run
tell application "OmniFocus"
tell front document
tell document window 1
set oTrees to selected trees of content
set lngTrees to count of oTrees
if (lngTrees > 0) then
if (lngTrees = 1) then
set oTask to value of (first item of oTrees)
if (repetition of oTask is not missing value) then
my RescheduleRepeatingTask(oTask)
else
display alert quote & name of oTask & quote & " is not a repeating task, ignoring"
end if
else
display alert "Select only one row!"
end if
else
display alert "No content selected!"
end if
end tell
end tell
end tell
end run
on RescheduleRepeatingTask(oTask)
using terms from application "OmniFocus"
set completed of oTask to true -- cause OmniFocus to duplicate task
set repetition of oTask to missing value -- clear repeat
set canReschedule to false
if (pOffertoReschedule is true) then
display dialog "Reschedule by how many days?" buttons {"Cancel", "OK"} ¬
default button 2 default answer "1"
set rescheduleDays to (text returned of the result) as integer
-- attempt to move start and due dates back by rescheduleDays
try
tell oTask to set {theStartDate, theDueDate} to {start date, due date}
set {newStartDate, newDueDate} to {theStartDate, theDueDate}
if (theDueDate is not missing value) then
set newDueDate to (theDueDate + (days * rescheduleDays))
set canReschedule to true
end if
if (theStartDate is not missing value) then
set newStartDate to (theStartDate + (days * rescheduleDays))
set canReschedule to true
end if
if (canReschedule) then
tell oTask to set {start date, due date} to {newStartDate, newDueDate}
else
display alert "No start or due date for existing task, duplicated but not rescheduled"
end if
on error
display alert "Failed to reschedule existing task"
end try
end if
set completed of oTask to false -- reactivate original task
end using terms from
end RescheduleRepeatingTask