Add a reminder to Reminders.app

I was a Todoist power user, but recently I have switched to Apple Reminders.

The main reason was, that todoist was saving the tasks on their servers. There was no way sync to a local filesystem or a private cloud.

Apple Reminders supports both these features natively. It has a nice natural date input mechanism, which was all I needed.

The only thing needed for good usability was a global input. You can easily do this through apple script and a global hotkey.

A good starting point for me was this tutorial: https://michaelkummer.com/tech/apple/reminders-shortcut/

However, this feature was too bloated for me, as it contained making reminders based on Apple Mail. Also I wanted integration with Alfred, so I do not have to memorize multiple shortcuts, but just my Alfred one and a keyword.

Also I wanted the script to be compact and simple, so I can grasp what it is doing in less than a minute … even in a year.

Et Voila:

on alfred_script(q)
	set RemindersList to "Privates"


	# Parse the Date

	set remindMeDate to (current date)
	
	if q contains "tomorrow" then
		set remindMeDate to (current date) + 1 * days
	else if q contains "in 2 days" then
		set remindMeDate to (current date) + 60*24*2 * minutes
	else if q contains "in 3 days" then
		set remindMeDate to (current date) + 60*24*3 * minutes
	else if q contains "in 4 days" then
		set remindMeDate to (current date) + 60*24*4 * minutes
	else if q contains "in 5 days" then
		set remindMeDate to (current date) + 60*24*5 * minutes
	else if q contains "in 6 days" then
		set remindMeDate to (current date) + 60*24*6 * minutes
	else if q contains "in 7 days" then
		set remindMeDate to (current date) + 60*24*7 * minutes
	else if q contains "in 14 days" then
		set remindMeDate to (current date) + 60*24*14 * minutes
	else if q contains "next week" then
		set curWeekDay to weekday of (current date) as string
		if curWeekDay = "Monday" then
			set remindMeDate to (current date) + 7 * days
		else if curWeekDay = "Tuesday" then
			set remindMeDate to (current date) + 6 * days
		else if curWeekDay = "Wednesday" then
			set remindMeDate to (current date) + 5 * days
		else if curWeekDay = "Thursday" then
			set remindMeDate to (current date) + 4 * days
		else if curWeekDay = "Friday" then
			set remindMeDate to (current date) + 3 * days
		else if curWeekDay = "Saturday" then
			set remindMeDate to (current date) + 2 * days
		else if curWeekDay = "Sunday" then
			set remindMeDate to (current date) + 1 * days
		end if
	else if q contains "in 1 week" then
		set remindMeDate to (current date) + 10080 * minutes
	else if q contains "in 1 month" then
		set remindMeDate to (current date) + 43200 * minutes
	else if q contains "in 3 months" then
		set remindMeDate to (current date) + 129600 * minutes
	else if q contains "in 1 year" then
		set remindMeDate to (current date) + 525600 * minutes
	end if

	tell application "Reminders"
	
		tell list RemindersList
		
			make new reminder with properties {name:q, remind me date: remindMeDate}
		
		end tell
	
	end tell

	return {"Task: added to " & RemindersList & "\nDate: " & remindMeDate}

end alfred_script

The reminders use pre-defined natural language keywords as I could not get Reminders.app to parse them from the query title … If you know how to do this, shoot me a mail to arne@codetactics.de or make a github pull request here: https://github.com/ArneTR/add_reminder

Also reminders are saved by default to the list “Privates”. You can either change this easily in Alfred by inspecting the workflow or just create this list in Reminders.app.

The flow is triggered by the keyword “r”.

For now I am leaving the date keyword in the note for debugging. But this might be replaced later, when I consider it error-free.

Attached: Compiled alfred workflow

Code inspired by https://michaelkummer.com/tech/apple/reminders-shortcut/ and https://www.alfredforum.com/topic/917-reminders/