AppleScript can't find Smart Albums on Catalina

I've been using an AppleScript to export photos in a Smart Album in Apple Photos for a while now. After upgrading to Catalina, it seems that my query for all albums no longer returns Smart Albums.

Specifically, I have a line that loads all albums like this:

tell Application "Photos"
    set theseAlbums to every album
    ...
end tell

Previously,

theseAlbums
would contain regular and smart albums. After upgrading to Catalina, they only contain the regular (non-smart) ones.

Is there anything I can do to query for smart albums?


I looked at the Photos Dictionary and didn't see anything. I also tried changing

every album
to
every container
with no luck.


Here's the code in context - a helper function that finds an album by name:



on getAlbumNamed(thisName)
  tell application "Photos"
    set theseAlbums to every album
    repeat with i from 1 to the count of theseAlbums
      set thisAlbum to item i of theseAlbums
      if the name of thisAlbum is thisName then
        return thisAlbum
      end if
    end repeat
  end tell
end getAlbumNamed


Thanks in advance for any help.

Replies

I have exactly the same problem. This certainly worked with Photos in High Sierra. Not with Catalina my scripts don't see the smart albums anymore. Very annoying.

Did you find any good workaround in the meantime?