Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davidnunez/2778762 to your computer and use it in GitHub Desktop.
Save davidnunez/2778762 to your computer and use it in GitHub Desktop.
Script that resets Omnifocus project's next review date to a random day in the next week (ex. to distribute review dates across the week)
tell application "OmniFocus"
tell document 1
tell (first document window whose index is 1)
set SelectedItemInMainView to selected trees of content
repeat with i from 1 to (count of SelectedItemInMainView)
set theSelectedTask to value of item i of SelectedItemInMainView
--display dialog "" & (class of theSelectedTask)
if (class of theSelectedTask as string is equal to "project") then set next review date of theSelectedTask to (current date) + days * (random number from 0 to 6)
end repeat
end tell
end tell
end tell
-- notification of success
set the_file to "/System/Library/Sounds/Glass.aiff"
set the_file to POSIX file the_file
set file_path to quoted form of (POSIX path of (the_file as alias))
do shell script ("afplay " & file_path & " > /dev/null 2>&1 &")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment