New Hookmark scripts for Reminders

I updated my Reminders/Hookmark 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:

We have to replace the remindersDatabasePath property with the proper database path which is different for everyone.

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.