Defer to Tomorrow
Summary: Changes the Defer Until date of the selected actions to tomorrow.
Requires: OmniFocus Pro 2
Install Location: ~/Library/Scripts/Applications/OmniFocus/
Last Modified: 2019-10-02
Description
This script changes the Defer Until date of the selected actions to midnight tomorrow (if there was no defer date) or the same time tomorrow (if there was already a defer date).
Installation Instructions · Download in Compiled Format · Download in Text Format
Script
on
run
{}
repeat
with
_action
in
my
selectedActions()
my
processAction(
_action)
end
repeat
end
run
on
selectedActions()
tell
application
"OmniFocus"
return
my
filterValues(
my
selectedValues(), {
inbox task
,
task
,
available task
,
remaining task
})
end
tell
end
selectedActions
on
selectedValues()
tell
application
"OmniFocus"
return
value
of
selected trees
of
content
of
first
document window
of
front
document
end
tell
end
selectedValues
on
filterValues(
_values,
_classes)
tell
application
"OmniFocus"
set
_result
to
{}
repeat
with
_value
in
_values
if
_classes
contains
_value's
class
then
copy
_value
to
end
of
_result
end
if
end
repeat
return
_result
end
tell
end
filterValues
on
processAction(
_action)
tell
application
"OmniFocus"
set
_action's
defer date
to
my
calculateDate(
_action's
defer date)
end
tell
end
processAction
on
calculateDate(
_oldDate)
if
_oldDate
is
missing value
then
return
my
midnightTomorrow()
else
return
(
my
midnightTomorrow()) + (
time
of
_oldDate)
end
if
end
calculateDate
on
midnightTomorrow()
set
_date
to
current date
set
day
of
_date
to
((
_date's
day) + 1)
set
time
of
_date
to
0
return
_date
end
midnightTomorrow