Legacy Integration with Apple Photos (prior URL scheme)

Hook 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 Hook 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 Hook’s search tool.

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

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

With Hook Pro, simply:

  1. Access Hook’s preferences
  2. click on the Scripts tab,
  3. select Apple Photos on the left, and
  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