Is Reminders App Linkable?

I’ve been using this code for a while now, thanks @zsbenke

@ethanschoonover Thank you! I’m honored. :slight_smile:

I actually gave up using this script, because Reminders Apple Script integration is so slow, it is barely usable.

1 Like

Yeah I’ve been trying to use shortcuts to pull the selected reminder title as that would speed things up, but no joy so far. regardless, appreciate the script!

1 Like

That’s pretty much why we don’t include it with Hookmark. If the Manifesto for Ubiquitous Linking gains in popularity, Apple might take notice. Would be so easy for them to provide an API for this. Internally they have the IDs. Same goes for Notes and Messages. They use Message URLs between their apps (Calendar), but don’t give consumers and competitors the same benefits, as I discussed here:

Thank you for your script, but it seems that it no longer works in the latest macOS Sonoma. It still displays “No linkable item”.

Sorry about this issue.
What’s your system language?
Does the reminder have priority?
Is it a nested reminder? Nested reminder is not accessible via AppleScript.

Thank you

Here is the revised script, Please give it a try:

Summary
set sysinfo to system info
set osver to system version of sysinfo

considering numeric strings
	set isMonterey to osver ≥ "12"
end considering

tell application "System Events" to tell process "Reminders"
	set wn to name of menu bar item 2 of menu bar 1
end tell


set sysinfo to system info
set osver to system version of sysinfo

considering numeric strings
	set isMonterey to osver ≥ "12"
end considering

tell application "System Events"
	tell its application process "Reminders"
		tell its window wn
			tell its splitter group 1
				tell its UI element 3
					tell its UI element 2
						tell its UI element 1
							if isMonterey then
								set reminderOutline to first UI element whose selected of UI element 1 is true
								set ele to UI element 2 of UI element 1 of UI element 1 of reminderOutline
								set uiName to class of ele as string
								if uiName is "text field" then
									set theReminderName to value of ele
								else
									set theReminderName to value of UI element 3 of UI element 1 of UI element 1 of reminderOutline
								end if
							else
								set reminderOutline to first UI element whose selected is true
								set theReminderName to value of UI element 2 of UI element 1 of reminderOutline
								
								
							end if
						end tell
					end tell
				end tell
			end tell
		end tell
	end tell
end tell

tell application "Reminders"
	try
		set theReminder to the first reminder whose name is theReminderName
		set theURL to the id of theReminder as text
		set theURL to do shell script "echo \"" & theURL & "\"|sed 's/x-apple-reminder:\\/\\//x-apple-reminderkit:\\/\\/REMCDReminder\\//g'"
		
		return "[" & theReminderName & "](" & theURL & ")"
		
	on error errMsg
		display dialog "ERROR: " & errMsg
	end try
end tell
set sysinfo to system info
set osver to system version of sysinfo

considering numeric strings
	set isMonterey to osver ≥ "12"
end considering

tell application "System Events" to tell process "Reminders"
	set wn to name of menu bar item 2 of menu bar 1
end tell


set sysinfo to system info
set osver to system version of sysinfo

considering numeric strings
	set isMonterey to osver ≥ "12"
end considering

tell application "System Events"
	tell its application process "Reminders"
		tell its window wn
			tell its splitter group 1
				tell its UI element 3
					tell its UI element 2
						tell its UI element 1
							if isMonterey then
								set reminderOutline to first UI element whose selected of UI element 1 is true
								set ele to UI element 2 of UI element 1 of UI element 1 of reminderOutline
								set uiName to class of ele as string
								if uiName is "text field" then
									set theReminderName to value of ele
								else
									set theReminderName to value of UI element 3 of UI element 1 of UI element 1 of reminderOutline
								end if
							else
								set reminderOutline to first UI element whose selected is true
								set theReminderName to value of UI element 2 of UI element 1 of reminderOutline
								
								
							end if
						end tell
					end tell
				end tell
			end tell
		end tell
	end tell
end tell

tell application "Reminders"
	try
		set theReminder to the first reminder whose name is theReminderName
		set theURL to the id of theReminder as text
		set theURL to do shell script "echo \"" & theURL & "\"|sed 's/x-apple-reminder:\\/\\//x-apple-reminderkit:\\/\\/REMCDReminder\\//g'"
		
		return "[" & theReminderName & "](" & theURL & ")"
		
	on error errMsg
		display dialog "ERROR: " & errMsg
	end try
end tell

Thank you

Thank you! It works!

I updated my Reminders integration script recently to make it faster on Sonoma. I also made sure that I have a “New Item” part too, so I can create reminders directly from Hookmark.

The “Get Address” script uses the backing SQLite database to find the ID of the selected reminder by title.

There are some caveats to keep in mind:

  1. We have to replace the remindersDatabasePath property with the proper database path which is different for everyone.
  2. Reminders are matched by title, so if we have multiple reminders with the same title, the script may fail to link the proper one.

Here are the scripts updated for Sonoma:

Get Address:

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

-- Replace this with your Reminders database path.
property remindersDatabasePath : "/Users/yourusername/Library/Group Containers/group.com.apple.reminders/Container_v1/Stores/Data-some-UUID.sqlite"

tell application "System Events"
	tell its application process "Reminders"
		tell its window "Reminders"
			tell its splitter group 1
				tell its UI element 3
					tell its UI element 2
						tell its UI element 1
							set reminderOutline to first UI element whose selected of UI element 1 is true
							set theReminderName to value of UI element 2 of UI element 1 of UI element 1 of reminderOutline
						end tell
					end tell
				end tell
			end tell
		end tell
	end tell
end tell

set theSQLCommand to "/usr/bin/sqlite3 \"" & remindersDatabasePath & "\" \"SELECT ZCKIDENTIFIER from ZREMCDREMINDER WHERE ZTITLE = '" & theReminderName & "'\""
set theReminderIdentifier to do shell script theSQLCommand
set theURL to "x-apple-reminderkit://REMCDReminder/" & theReminderIdentifier
return "[" & theReminderName & "](" & theURL & ")"

New Item (this one can be a bit slow unfortunately)

tell application "Reminders"
	set theName to "$title"
	set theBody to "$user_link"
	set theReminder to make new reminder with properties {name:theName, body:theBody}
	set theReminderURL to the id of theReminder
	set theReminderURL to do shell script "echo \"" & theReminderURL & "\"|sed 's/x-apple-reminder:\\/\\//x-apple-reminderkit:\\/\\/REMCDReminder\\//g'"
	activate
end tell

theReminderURL

I haven’t tested these on earlier systems.