Created
October 25, 2015 01:54
-
-
Save sobolevnrm/dd91af972eb46e7f6686 to your computer and use it in GitHub Desktop.
Applescript to extract tasks from 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 todo_output to " | |
" | |
repeat with the_list in lists | |
set list_name to name of the_list | |
set list_todos to to dos of the_list | |
repeat with the_todo in list_todos | |
if status of the_todo is open then | |
set todo_name to name of the_todo | |
set todo_due to due date of the_todo | |
set todo_start to activation date of the_todo | |
set todo_tags to tag names of the_todo | |
set todo_notes to notes of the_todo | |
set todo_str to "TASK SMART: " & todo_name | |
if todo_due is not equal to missing value then | |
set todo_str to todo_str & " ^" | |
set todo_str to todo_str & month of todo_due | |
set todo_str to todo_str & " " & day of todo_due | |
set todo_str to todo_str & ", " & year of todo_due | |
end if | |
if todo_start is not equal to missing value then | |
set todo_str to todo_str & " ~" | |
set todo_str to todo_str & month of todo_start | |
set todo_str to todo_str & " " & day of todo_start | |
set todo_str to todo_str & ", " & year of todo_start | |
end if | |
set todo_str to todo_str & " #" & todo_tags & " | |
" & todo_notes | |
set todo_output to todo_output & todo_str | |
end if | |
end repeat | |
end repeat | |
return todo_output | |
end tell | |
on write_to_file(this_data, target_file, append_data) | |
try | |
set the target_file to the target_file as string | |
set the open_target_file to open for access file target_file with write permission | |
if append_data is false then set eof of the open_target_file to 0 | |
write this_data to the open_target_file starting at eof | |
close access the open_target_file | |
return true | |
on error | |
try | |
close access file target_file | |
end try | |
return false | |
end try | |
end write_to_file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment