Subject: Auto-importing screenshots into Photos via a Folder Action – FolderActionsDispatcher fails reliably
Hi everyone,
I’ve been trying for a while to have newly created screenshots automatically imported into the Photos app via a Folder Action (FolderActionsDispatcher), with the original file deleted afterward. Despite extensive troubleshooting I can’t get it to work — maybe someone here has run into the same issue or has an idea.
System: MacBook Air M3, macOS 15.6.1 (24G90)
Setup:
-
Screenshot destination folder changed via
defaults write com.apple.screencapture location ...(tested on a separate internal volume as well as on the boot volume Macintosh HD, with and without iCloud Desktop sync) -
Folder Action assigned via “Folder Actions Setup”, with the following AppleScript attached:
on run {input, parameters}
display notification “Ordneraktion ausgelöst”
delay 2
try
repeat with aFile in input
set posixPath to POSIX path of aFile
tell application “Photos”
import (POSIX file posixPath)
end tell
tell application “Finder”
delete aFile
end tell
end repeat
do shell script “echo ‘Erfolg’ > /tmp/ordneraktion_test.txt”
on error errMsg
do shell script “echo " & quoted form of errMsg & " > /tmp/ordneraktion_test.txt”
end try
return input
end run
What I’ve already checked/ruled out:
-
Automation permission (FolderActionsDispatcher → Photos) granted under Privacy & Security
-
Full Disk Access enabled for FolderActionsDispatcher, Automator, and Photos
-
Reset the TCC database (
tccutil reset AppleEvents) and restarted the Mac -
The identical
importcommand works fine when run manually in Script Editor (returns a valid media item id) -
When triggered via the Folder Action, the import always fails with the same error:
“Photos” got an error: “POSIX file ‘…’” can’t be read.
-
The error occurs with both
aliasandPOSIX filereferences -
Added a 2-second delay before the import to rule out a timing issue (file not fully written yet) — no change
-
Tested on a separate internal volume and on Macintosh HD, with iCloud Desktop sync both on and off — same error every time
-
Console/logs show: the dispatcher process fires correctly and launches the Automator XPC runner, but the import command itself fails inside the Photos app
My guess is that this is some kind of sandbox restriction, where Photos.app handles file access from XPC services (like the Automator runner inside a Folder Action) differently than access from an interactively launched Script Editor process — regardless of the TCC permissions already granted.
Has anyone solved this, or does Photos import via Folder Action work reliably for you? I’m also open to suggestions for more robust alternatives (e.g. Hazel, or a Shortcuts automation triggered by “When a file is added to a folder”).
Thanks for any pointers!