Skip to content

Instantly share code, notes, and snippets.

@23maverick23
Created July 9, 2014 15:16
Show Gist options
  • Save 23maverick23/61b415f491dac1cfab35 to your computer and use it in GitHub Desktop.
Save 23maverick23/61b415f491dac1cfab35 to your computer and use it in GitHub Desktop.
AppleScript: Print reminders
--https://github.com/statonjr/techshow-2013
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
@smarj
Copy link

smarj commented Dec 12, 2020

Still works with Big Sur.

Replace the innermost loop with the following to avoid outputting completed reminders:

repeat with k from 1 to length of todos
	set this_todo to item k of todos
	set isCompleted to (get completed of this_todo)
	if not isCompleted then
		do shell script "echo [  ] " & (quoted form of (get name of this_todo)) & " >> ~/Desktop/todos.txt"
	end if
end repeat

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