Created
October 14, 2014 20:59
-
-
Save pbkhrv/a67b79e6b217f0314db5 to your computer and use it in GitHub Desktop.
Alfred workflow to schedule todos in Things for certain number of days in the future
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
-- make a workflow, call it with "task name +days" | |
on alfred_script(q) | |
if application "Things" is running then | |
else | |
tell application "Things" to activate | |
tell application "Finder" | |
set visible of process "Things" to false | |
end tell | |
delay 1 | |
end if | |
tell application "Things" | |
set daysFromNow to 0 | |
set taskTitle to q | |
if word -2 in q is "+" then | |
set daysFromNow to word -1 in q | |
set wrds to length of words in q | |
set {tid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, " "} | |
set taskTitle to (words 1 thru (wrds - 2) of q) as text | |
set AppleScript's text item delimiters to tid | |
end if | |
set newToDo to parse quicksilver input (taskTitle) | |
if daysFromNow > 0 then | |
schedule newToDo for (current date) + daysFromNow * days | |
end if | |
end tell | |
end alfred_script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://downloads.culturedcode.com/things/download/ThingsAppleScriptGuide.pdf