Created
March 18, 2016 18:27
-
-
Save drobbins/86c39acdd7037fa4ce08 to your computer and use it in GitHub Desktop.
Omnifocus ToggleHold
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* Customize Review Intervals *) | |
using terms from application "OmniFocus" | |
property onHoldReviewInterval : {unit:month, steps:1, fixed:false} | |
property activeReviewInterval : {unit:day, steps:4, fixed:false} | |
end using terms from | |
tell application "OmniFocus" | |
tell front document | |
tell document window 1 -- (first document window whose index is 1) | |
set theSelectedItems to selected trees of content | |
if ((count of theSelectedItems) ≠ 1) then | |
-- try sidebar selection | |
set theSelectedItems to selected trees of sidebar | |
end if | |
end tell | |
if ((count of theSelectedItems) < 1) then | |
display alert "You must first select a project" message "Select a single project." as warning | |
return | |
end if | |
if ((count of theSelectedItems) > 1) then | |
display alert "You must select just one project." message "Select a single project." as warning | |
return | |
end if | |
set selectedItem to value of item 1 of theSelectedItems | |
set theProjectName to name of item 1 of theSelectedItems | |
if (class of selectedItem is not project) then | |
display alert "The selected item, “" & theProjectName & "” is not a project." message "The script only works with projects, not actions or folders. Please select a project to use the script." as warning buttons {"OK"} default button 1 | |
return | |
end if | |
if (status of selectedItem is active) then | |
my makeItemOnHold(selectedItem) | |
else if (status of selectedItem is on hold) then | |
my makeItemActive(selectedItem) | |
end if | |
end tell | |
end tell | |
on makeItemOnHold(theItem) | |
using terms from application "OmniFocus" | |
set status of theItem to on hold | |
set review interval of theItem to onHoldReviewInterval | |
end using terms from | |
end makeItemOnHold | |
on makeItemActive(theItem) | |
using terms from application "OmniFocus" | |
set status of theItem to active | |
set review interval of theItem to activeReviewInterval | |
end using terms from | |
end makeItemActive |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cool! Works for me.