Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How can I identify which albums photos are assigned to in Photos.

When I view a photo in the Photos stack or in any album, I would like to be able to identify the albums it has been assigned. Does anyone know how to do that? Please understand that I know how to use a smart album to find Unassigned photos, but how to you find albums assigned to photos?


And explanation as to why: It's a very important tool for me to remain consistent in 'filing' photos away and being able to verify they have been filed properly. And it might be a surprise to Apple, but I do not think in terms of date/time/gps when using my photos program. Those are meaningless delineations to me, although they can be useful flags for secondary info in the metadata. Many photos over the years were and still are received via mail or scanned and do not have an appropriate date or gps location attached. Faces is useful, but viewing 5k pictures of 'mom' without knowing which album they are in, is not helpful.

iMac, OS X El Capitan (10.11), 3.1Ghz i7; 8GBRam;TmeCap;iPad/Phone

Posted on Jan 8, 2016 11:21 AM

Reply
Question marked as Best answer

Hello,


socraties wrote:


Would it work to program an Apple Script, then insert it in the contextual menu so that I can select any picture and run the script? If so it would be a great workaround!!! Do you think there may be an automator or Apple script out there that already exists? I'm hopeful.


This AppleScript show the name of albums which contains the selected photo:


tell application "Photos"
    set sel to selection
    if sel is {} then return -- no selection
    set thisId to id of item 1 of sel
    set theseNames to name of (albums whose id of media items contains thisId)
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}
else
    set t to "No album"
end if
activate
display dialog t buttons {"OK"} default button "OK" -- you can press the Enter key or the return Key to close the dialog



You can run this AppleScript from an Automator's service, and you can assign a shortcut to this service.


Or, you can run this AppleScript from some third party utilities (some free) which run (shell script, AppleScript script or javascript), and you can assign a shortcut to this action

Posted on Jan 8, 2016 8:37 PM

29 replies

Jan 9, 2016 12:37 PM in response to Jacques Rioux

Jacques - I'm having trouble setting this up. Maybe it's easy for you to see what I'm doing wrong. Two problems:


1 - I receive this error when clicking on the "Step" button in Automator.

User uploaded file


This is the syntax I copied and manually typed into the Automator Script window:


User uploaded file


Second Problem:


I added it to Services twice. But it doesn't show up in the Services Menu in Photos (or anywhere).


User uploaded fileUser uploaded file


Is it possible to see what I'm doing wrong or am I simply too remedial on this subject? Thanks for your help on this. I hope it helps a lot of other people too!


russ

Jan 10, 2016 11:11 AM in response to socraties

Hello,


socraties wrote:


Jacques - I'm having trouble setting this up. Maybe it's easy for you to see what I'm doing wrong. Two problems:


1 - I receive this error when clicking on the "Step" button in Automator.

User uploaded file


This is the syntax I copied and manually typed into the Automator Script window:


User uploaded file




It lacks the "s" character in the first button word.

display dialogtbuttons {"OK"} default button "OK"


Or, you can use this line (the dialog show two buttons, a default and a cancel buttons).

display dialogt
-- you can press the Enter key or the return Key to close the dialog

Jan 10, 2016 11:39 AM in response to socraties

socraties wrote:


Second Problem:


I added it to Services twice. But it doesn't show up in the Services Menu in Photos (or anywhere).



This is because Photos doesn't work with a service of type (Images).

Don't try to change it on your service, it will not change the original type on the already saved service


You must create a new service.

Select "No Input" from the first popup button --> Service receive: "No Input" from application: "Photos"


After the saving, this service will be in the "General" services, not in the "Images" services

Jan 11, 2016 1:44 PM in response to Jacques Rioux

Hi Jacques - This is beautiful. Thank you so much for this script. I followed your advice and it works great. Ultimately I used "display dialogt" and dropped the

"buttons {"OK"} default button "OK" ". It runs great and presents a dialog with the list of Albums. To release the dialogue, I simply click OK or the Return Key.

Wow, wow, wow, wow. I could pee in my pants. Thank you SOO much for your time and effort.

russ

Jun 25, 2016 1:55 AM in response to socraties

I have found a useful workaround for any timeout errors (error message -1712) that occur with any or Jacques Rioux's excellent scripts - for example this solved the timeout issues I was getting for the import folders as albums scripts. You just need to give the Mac a bit more time to count images etc: the default is 60 seconds, which often isn't enough. So rather than workarounds involving creating a parent folder, all you need to do is edit the script and add a timeout instruction and a close instruction after every event. So for this script I modified it thus:

tell application "Photos"

set sel to selection

with timeout of 10000 seconds

if sel is {} then return -- no selection

set thisId to id of item 1 of sel

set theseNames to name of (albums whose id of media items contains thisId)

end timeout

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}

else

set t to "No album"

end if

activate

display dialogtbuttons {"OK"} default button "OK" -- you can press the Enter key or the return Key to close the dialog

May 7, 2017 12:35 AM in response to léonie

On macOS 10.12.4 Sierra we do no longer need the work-around with the top level album.


This version of the script is using the current selection, but has a few added error tests:


-- Select the photo in Photos, then run this script by pressing the "Run" button in the script editor or from the scripts menu.


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 errTexttwonumbererrNumtwo

display dialog "No photos selected " & errNumtwo & return & errTexttwo

return

end try


set imagename to "unknown filename"

try

set targettoitem 1 of sel-- the image to seach for

tell target

set imagename to the filename of target

end tell

on error errTexttwonumbererrNumtwo

display dialog "Cannot get the filename of the first image: " & errNumtwo & return & errTexttwo

end try

set resultcaption to (resultcaption & imagename)

end tell


try


display alertresultcaptionbuttons {"Cancel", "OK"} asinformationalgiving up after 2

on error errTextnumbererrNum

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 errTextnumbererrNum

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 errTexttwonumbererrNumtwo

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 errTextnumbererrNum

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 errTexttwonumbererrNumtwo

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 toresultcaption

display dialogresultcaptionbuttons {"OK"} default button "OK" -- you can press the Enter key or the return Key to close the dialog

returnresultcaption-- léonie

Nov 27, 2017 10:49 AM in response to léonie

I have somewhat the same problem. I just need to select the images that are not in any album so I can complete organizing; very simple request.

The smart album: 'Album - IS NOT - any' works only partially. It sorts out thousands of images properly but leaves out thousands more images not in any album.

High Sierra, 32G M OS 10.13.2


Why does this smart album logic work on some images and not on others?

I don't see anything specific in the info box that's different from an album image to an image not in an album.

How can I identify which albums photos are assigned to in Photos.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.