Skip to content

Instantly share code, notes, and snippets.

@statonjr
Created July 27, 2012 11:51
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save statonjr/3187570 to your computer and use it in GitHub Desktop.
Save statonjr/3187570 to your computer and use it in GitHub Desktop.
Write out Reminders to file on desktop
tell application "Reminders"
set todo_accounts to every account
-- accounts have lists. loop thru accounts to get their lists.
repeat with i from 1 to length of todo_accounts
tell account i
set todo_lists to get every list
-- lists have reminders. loop thru lists to get their reminders
repeat with j from 1 to length of todo_lists
tell list j
set todos to (get reminders)
-- if there are no reminders for a list, then ignore the list
if length of todos is greater than 0 then
-- Write out the name of the list
do shell script "echo " & (quoted form of (get name)) & " >> ~/Desktop/todos.txt"
-- loop thru the reminders to get properties
repeat with k from 1 to length of todos
set this_todo to item k of todos
do shell script "echo [ ] " & (quoted form of (get name of this_todo)) & " >> ~/Desktop/todos.txt"
end repeat
end if
end tell
end repeat
end tell
end repeat
end tell
@mgiugliano
Copy link

mgiugliano commented Jan 5, 2018

It still works (10.13.2) but takes several of second per entry in the Reminder list to execute!

I found a solution that is more than an order of magnitude faster but gives up writing the file from the AppleScript. It is based on the following concept

`

      tell application "Reminders"

                            set AppleScript's text item delimiters to "\n- "

			return "- " & (name of reminders in list MyList  whose completed is false) as string

	end tell

`

Packaging the above script inside an AppleScript (say MyScript) and then calling it from the command line by

$> MyScript >~/Desktop/todos.txt

works and it is very fast. Disclaimer: I am a total beginner of AppleScript (so much a beginner that I won't use it again ;-))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment