In the time since you first reported your issue to the community, you may very well have found alternative means to meet your objective.
As others have clarified, the Automator process crashes when attempting to import photos into Photos.app using the Add to Album action. Photos are imported, however the workflow cannot continue beyond this action.
In case you might still need a workaround, AppleScript can be used instead, and also gives the added benefit of being able to import photos into any album in Photos.app rather than being limited to a top-level album.
--on adding folder items to ImportFolder after receiving SomeFiles
--Allowable file types imported by Photos.app:
--The ones preceded by a dash are importable, but are probably less
--likely to be wanted and won't be imported after they are filtered
--out below.
Remove the dash to permit importing of these filetypes.
set AppleScript'stext item delimiters to " "
set AllowedExtensions to "jpeg jpg tiff tif png gif heic heif -pdf " & ¬
"raw dng mov -qt -avi -vfw -mpg -mpeg mp4 mp4v m4v " & ¬
"-3gp -3gpp -3g2 -3gp2 -3gpp2"
--The variables ImportFolder and SomeFiles are defined either
--explicitly by the the following two variable declarations, or implicitly
--by the event handler above.
Comment in/out as appropriate.
set ImportFolder to POSIX file "/Path/To/Camera/Uploads" as alias
tell application "Finder" to set SomeFiles to files of ImportFolder
if number of SomeFiles is 0 then ¬
return 0
--Set the album into which media will be imported.
Leave it
--empty to import the photos without putting them into an album.
--If the album name doesn't contain any meaningful characters or
--isn't unique, the photos will be imported without being placed in
--an album.
set AlbumName to "Kameraimporte"
--The files in the import folder are filtered by file extension
set MediaFiles to {}
repeat with TheFile in SomeFiles
tell application "Finder" to tell TheFile to ¬
if its name extension is in ¬
(text items of AllowedExtensions) then ¬
set end of MediaFiles to it as alias
end repeat
if number of MediaFiles is 0 then ¬
return 0
--The Photos application is opened in the background and
--the media files are added to the designated album.
tell application "Photos"
try
with timeout of 120 seconds
run--Prevents the app from coming into the foreground
end timeout
delay 2
on error
return -1
end try
--Files are imported.
They are not placed in an album yet
set MediaItems to (importMediaFiles with skip check duplicates)
--Once imported, the Finder files can be deleted
tell application "Finder" to deleteMediaFiles
--If no album name or no unique album name was specified above
--then the script if finished.
It returns the number of new media
--items added to the Photos library.
if (countwords in AlbumName) = 0 or ¬
(count (albums whose name is AlbumName)) > 1 then ¬
return number of MediaItems
--If a unique album name is specified, then the album is created
--if it does not yet exist, and the imported media items are added
--(copied) into the album.
The script returns the number of new
--library imports.
tell (albumnamedAlbumName)
if not (it exists) then makenewalbumnamedAlbumName
addMediaItemsto it
return number of MediaItems
end tell
end tell
--end adding folder items to
The script will work as a standalone script in its current form, or as part of an Automator workflow using the Run AppleScript action.
The first and final lines that are commented out can be uncommented in order to create a folder action script that will run each time whichever folder it is attached to receives new files (be sure to comment out the explicit variable declarations for ImportFolder and SomeFiles if these variables are being defined as part of the event handler in the first line).
This script is a modified version of the one I’ve been using for a couple of months, and it seems to work reliably thus far.
CK