Created
June 29, 2011 18:43
-
-
Save gibbonweb/1054552 to your computer and use it in GitHub Desktop.
Shows all "Today" items of Things.app
This file contains 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
tell application "Things" | |
set outputString to "" | |
set newLine to " | |
" | |
set jetzt to current date | |
set scheduledToDos to to dos of list "Today" | |
repeat with scheduledToDo in scheduledToDos | |
if status of scheduledToDo is open then | |
if due date of scheduledToDo is not missing value then | |
set deltaT to (due date of scheduledToDo) - jetzt | |
set outputString to outputString & my hrTime(deltaT) & " - " | |
else | |
set outputString to outputString & " - " | |
end if | |
set outputString to outputString & name of scheduledToDo & " | |
" | |
end if | |
end repeat | |
copy outputString to stdout | |
end tell | |
to hrTime(dt) | |
if dt is less than 0 then | |
set dt to dt * -1 | |
set due to true | |
else | |
set due to false | |
end if | |
if dt is greater than 3600 * 24 then | |
if due is true then | |
return "(since " & (round (dt / 3600 / 24) rounding down) & " days) " | |
else | |
return "(in " & (round (dt / 3600 / 24) rounding up) & " days) " | |
end if | |
else | |
return "(today) " | |
end if | |
end hrTime |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You don't need to add newlines in quotes; when constructing strings you can just use & return to add a new line