The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus 1 for Mac (http://forums.omnigroup.com/forumdisplay.php?f=38)
-   -   Manually adjusting start date with a repeating task (http://forums.omnigroup.com/showthread.php?t=24841)

LLBean 2012-07-07 05:11 PM

Manually adjusting start date with a repeating task
 
I have a repeating task (repeat every 3 months). However, when enter or change a start date, it appears as though the next start date shifts 3 months as well.

What I'd like to have happen is that the task's due date repeats at the end of every quarter, but the start date can be changed independently. For example, lets say it is next due 9/30 and the current start date is today, 7/7. I complete the task today, and the next start date should be 10/1. Instead what it appears to do is create the next start date of 10/7. In other words, I only want to push the start date back this cycle.

Any advice or is this a limitation?

Thanks-

LL

whpalmer4 2012-07-07 05:22 PM

Sounds like you want a script I wrote: [url]http://forums.omnigroup.com/showpost.php?p=109341&postcount=2[/url]

LLBean 2012-07-07 05:34 PM

Cool!

Only problem is the single-shot duplicate's original due date shifts with the start date. Any way the due date can persist?

Everything else looks great. Thanks!

Ladd

whpalmer4 2012-07-07 06:47 PM

Oh, I forgot that the script also adjusted the due date! So you want the task to retain its original due date, and just shift the start date?

You could replace this line:
[code]

tell oTask to set {start date, due date} to {newStartDate, newDueDate}

[/code]

with this line:

[code]
tell oTask to set start date to newStartDate
[/code]

and I think you would get the desired result (start date adjusted, due date left as it was).

LLBean 2012-07-07 06:56 PM

Tried it and got "Failed to reschedule existing task"

Hmmm

It did everything correct up to changing the duplicated start date.

whpalmer4 2012-07-07 07:25 PM

Before I waste any more of our time, let's make sure I'm correctly understanding what you want to do. You have a task which is normally starting 7/1, due 9/30, repeat every 3 months. You want to change it this time around to start on 7/7, but still keep the due date and repeat intact. Is that correct?

I'm puzzled as to why the code is getting that error. Can you take a snapshot of the inspector showing the repeating action before you try running the script? I haven't been able to reproduce it.

LLBean 2012-07-07 07:36 PM

1 Attachment(s)
Repeating task, current start date 7/1, current due date 9/30.

What I want is to be able to change the current start date without affecting the start date of the next iteration. So if I change the current start date to 7/9, the start date for the next iteration will remain 10/1, not 10/9, which is OF current behavior. Due date remains the same, either 9/30 for the current iteration or 12/31 for the next.

Not sure why the revised code returned an error code.

I appreciate the help-

L

LLBean 2012-07-07 07:41 PM

1 Attachment(s)
If it helps, here is revised code-

whpalmer4 2012-07-07 07:59 PM

Ah, that does help — you've changed the wrong line. The line to be changed is inside the "if (canReschedule) then" statement. Your version sets the start date before calculating the value of newStartDate, and that causes an error.

Here's the entire routine:

[code]

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 to newStartDate
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

[/code]

LLBean 2012-07-07 08:07 PM

Works like a charm! Thanks again!!!!


All times are GMT -8. The time now is 04:53 AM.

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