A friend asked if there was a way in Photos to see which albums a selected photo had been added to. This is one of those things that would be incredibly easy for Apple to provide: Select a photo, press Command-I, and in the info window, you could see a list of all albums containing the selected photo.
Unfortunately, Apple doesn't seem to think people might care about what albums a photo is in, so this feature exists only in my mind. Thankfully, Mac users Jacques Rious and léonie wrote an AppleScript to solve the problem. I used the first instance (version 4) of the script in that post and it worked fine in High Sierra. (In case Apple ever decides to remove its forums, I've recreated the script below.)
To use the script, paste it all into AppleScript Editor and save it as an application (or you can just run it in AppleScript Editor). In Photos, create a top-level album (I named mine Find Albums Photo Is In), and place the photo you want to know about into that album. Leave it selected, then run the AppleScript. You'll see one dialog stating what photo is being used, then after a bit, you should see a results dialog, like this:
As you can see, the album used for the search is included in the results; someone with better AppleScript skills than I could probably modify the script to exclude that album (any takers?). While I'd much prefer Apple include this feature directly in Photos, at least there's an alternative when you need this information.
Here's the script in case the source ever goes away.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | tell application "Photos" activate -- Add the photo you want to search for to a top level album as the first item in the album set resultcaption to "Searching for: " try set sel to selection if sel is {} then error "The selection is empty" -- no selection on error errTexttwo number errNumtwo display dialog "No photos selected " & errNumtwo & return & errTexttwo return end try set imagename to "unknown filename" try set target to item 1 of sel -- the image to seach for tell target set imagename to the filename of target end tell on error errTexttwo number errNumtwo display dialog "Cannot get the filename of the first image: " & errNumtwo & return & errTexttwo end try set resultcaption to (resultcaption & imagename) end tell try display alert resultcaption buttons {"Cancel", "OK"} as informational giving up after 2 on error errText number errNum if (errNum is equal to -128) then -- User cancelled. return end if end try -- From Jacques Rioux's script: tell application "Photos" -- set sel to selection if sel is {} then return -- no selection try set thisId to id of item 1 of sel on error errText number errNum display dialog "Error: cannot get the image ID" & errNum & return & errText & "Trying again" try delay 2 set thisId to id of item 1 of sel on error errTexttwo number errNumtwo display dialog "Skipping image due to repeated error: " & errNumtwo & return & errTexttwo error "giving up" return end try --second attempt end try set theseNames to {} try set theseNames to name of (albums whose id of media items contains thisId) on error errText number errNum display dialog "Error: cannot get the albums" & errNum & return & errText & "Trying again" try delay 2 set theseNames to name of (albums whose id of media items contains thisId) on error errTexttwo number errNumtwo display dialog "Skipping image due to repeated error: " & errNumtwo & return & errTexttwo error "giving up" return end try end try end tell if theseNames is not {} then set {oTid, text item delimiters} to {text item delimiters, return} set {t, text item delimiters} to {theseNames as string, oTid} -- return oTid else set t to "No album" end if activate set resultcaption to resultcaption & ", found it in these albums: " & t as string set the clipboard to resultcaption display dialog resultcaption buttons {"OK"} default button "OK" -- you can press the Enter key or the return Key to close the dialog return resultcaption -- léonie |
I don't use Photos, but why shouldn't/couldn't it work just as in Contacts? Click on a contact (or photo) and see which groups (albums) light up in a list.
While that'd be great in theory, I think the problem would be one of scale: In Contacts, I have a handful of groups. In Photos, I have over 150 albums. That'd make for a lot of scrolling and opening/closing folders to see the highlighted locations.
-rob.
Comments are closed.