Friday, June 18, 2021

#26 2020-09-29 01:05:52 am

From:: Greece
Registered: 2019-03-03
Posts: 1898

Re: Photos - Remove Photos from Album


Apple's slap... There is no way to automatically detect the (selected) album of the selected photo. At least I didn't find it. You can, of course, delete the selected photo from all albums, and someone will be happy with that. But this is not the best solution.

Hopefully in the future Apple will provide a parent property of selected message, or, better, selected album property of In the meantime, for those who are satisfied with deleting the selected photo from all albums, I give below a recursive script to get a list of all albums in the nested structure of


property theAlbums : {}

on run {}
   tell application "Photos"
       set theAlbums to albums
       repeat with aFolder in folders
           my getAlbumsAndFolders(aFolder)
       end repeat
   end tell
   return theAlbums
end run

on getAlbumsAndFolders(aFolder)
   tell application "Photos"
       set thisAlbums to albums of aFolder
       if thisAlbums is not {} then
           repeat with anAlbum in thisAlbums
               set end of theAlbums to contents of anAlbum
           end repeat
       end if
       set thisFolders to folders of aFolder
       if thisFolders is not {} then
           repeat with thisFolder in thisFolderss
               my getAlbumsAndFolders(thisFolder)
           end repeat
       end if
   end tell
end getAlbumsAndFolders

Last edited by KniazidisR (2020-09-29 01:33:47 am)

Model: MacBook Pro
OS X: Catalina 10.15.4
Web Browser: Safari 14.1
Ram: 4 GB



Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)