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