Create a Reminder

Here is a handler that makes creating Reminders convenient:

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

on makeReminder(reminderName, reminderBody, reminderDueDate, reminderListName)
	tell application "Reminders"
		if not (exists list reminderListName) then
			make new list with properties {name:reminderListName}
		end if
		
		-- See if there is an existing reminder.  This could happen if the rule was accidently
		-- trigged more than once.
		set existingReminder to reminders where due date = reminderDueDate and name = reminderName
		if existingReminder is {} then
			-- No existing reminder found, create one...
			return make new reminder ¬
				with properties {name:reminderName, body:reminderBody, due date:reminderDueDate} ¬
				at list reminderListName
		end if
		return missing value
	end tell
end makeReminder


set today to current date
set tomorrow to today + 60 * 60 * 24 -- + 1 day

makeReminder("Return Library Book", "Return Library Book 1234", tomorrow, "Library Books")
4 Likes

I’m using Reminders to create timers:

set heure to (time string of (current date))

display dialog "Il est " & heure & "
Alerte dans 30 minutes, à " & (time string of ((current date) + 1800)) & " ? " default answer "30" buttons {"Cancel", "Create"} default button 2 cancel button 1 giving up after 60 with icon path to resource "Reminders.icns" in bundle (path to application "Reminders")

set minutes to (text returned of result as integer)

if minutes < 2 then
	set message to " minute s'est passée"
else
	set message to " minutes se sont passées"
end if

set reminName to (minutes as text) & message

set reminTime to ((current date) + minutes * 60)
tell application "Reminders"
	tell list "Timer"
		make new reminder with properties {remind me date:reminTime, name:reminName}
	end tell
end tell
2 Likes