Skip to content

Instantly share code, notes, and snippets.

@y-ogi
Created August 16, 2011 09:59
Show Gist options
  • Save y-ogi/1148759 to your computer and use it in GitHub Desktop.
Save y-ogi/1148759 to your computer and use it in GitHub Desktop.
Copy today's report from Things(Mac App) to clipboard
tell application "Things"
-- define cr and tab
set cr to ASCII character (13)
set tab to " "
set repStr to ""
-- get projects
repeat with pr in projects
-- get today
set {year:todayYear, month:todayMonth, day:todayDay} to (current date)
-- the list of which has been done
set doneList to {}
-- the list of which has to be done
set todoList to {}
-- get the todo of projects
set toDos to to dos of project (name of pr as string)
repeat with toDo in toDos
set todoStatus to ((status of toDo) as string)
set todoName to ((name of toDo) as string)
if todoStatus is equal to "open" then
set the end of todoList to todoName
end if
if todoStatus is equal to "completed" then
set {year:compYear, month:compMonth, day:compDay} to (completion date of toDo)
if todayYear is equal to compYear and todayMonth is equal to compMonth and todayDay is equal to compDay then
set the end of doneList to todoName
end if
end if
end repeat
-- combile all dones
set doneStr to tab & "- DONE" & cr
repeat with toDo in doneList
set doneStr to doneStr & tab & tab & " - " & toDo & cr
end repeat
-- combine all todos
set todoStr to tab & "- TOOD" & cr
repeat with toDo in todoList
set todoStr to todoStr & tab & tab & " - " & toDo & cr
end repeat
set repStr to repStr & cr & "- " & (name of pr as string) & cr & doneStr & cr & todoStr
end repeat
-- set to clipboad
set the clipboard to repStr
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment