Legacy Integration with Apple Photos (prior URL scheme)

Hookmark 3.3 improves the URL scheme for linking photos in Apple Photos. With the new hook://photos/ URL scheme, if you create a link to a photo in one macOS account, you will be able to open it on a different macOS account. The different macOS accounts can even be on different Macs, provided (of course) that the macOS account has the same iCloud account. The new scheme adds a few parameters to hook://photos/ URLs, which facilitate search.

If you created hook://photos/ links before Hookmark 3.3 was introduced (in October 2021), then you will still be able to use them, meaning:

  1. If you click on those links anywhere, they should still work, provided you have access to the photo of course.
  2. You will be able to find the bookmarks with Hookmark’s search tool.

However, the hooks (bidirectional links) will no longer be visible.

If you would prefer to stick with the previous hook://photos/ URL scheme, then simply replace Hookmark’s Photos integration script with the following. To do this you would copy and paste in Hookmark’s integration script editor.

With Hookmark Pro, simply:

  1. Access Hookmark’s preferences.
  2. Click on the Scripts tab.
  3. Select Apple Photos on the left.
  4. Replace the Get Address and Open scripts with the following, respectively.

Here are the two scripts (tabs)

Old Photos “Get Address” script

tell application "Photos"
    set selectedPhotos to selection -- Get the selected photo

    if selectedPhotos is {} then return

    try
        set selectedPhoto to item 1 of selectedPhotos
        set selectedPhotoId to id of selectedPhoto

    on error

        set photoRecord to selectedPhoto as record
        set selectedPhotoId to «class seld» of photoRecord
        set selectedPhotos to get media items whose id is selectedPhotoId
        set selectedPhoto to item 1 of selectedPhotos


    end try
    set selectedPhotoId to id of selectedPhoto
    set photoName to name of selectedPhoto
    if photoName is missing value or length of photoName is less than 1 then
        set photoName to filename of selectedPhoto
    end if
    return "[" & photoName & "](photos://" & selectedPhotoId & ")"


end tell

Old Photos Open script

tell application "Photos"
    activate
    set photoId to text 10 through -1 of "$0"
    set mis to get media items whose id is photoId
    try
        if mis is {} then error
    on error
        display alert "That photo is not in any albums"
    end try
    spotlight item 1 of mis

end tell