Last active
November 11, 2020 18:56
-
-
Save natcl/7a5c98aae8b21475caf9 to your computer and use it in GitHub Desktop.
OSX Folder Action to automatically import files added to a folder in Photos.app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
property imageFiles : {"jpg", "pef", "dng", "jpeg"} | |
on adding folder items to theWatchedFolder after receiving theDetectedItems | |
repeat with theItem in theDetectedItems | |
set theItemPath to POSIX path of theItem | |
set ImageFile to POSIX file theItemPath | |
tell application "System Events" | |
if name extension of theItem is in imageFiles then | |
tell application "Photos" | |
set DestinationAlbumName to "Inbox" | |
if not (exists container named DestinationAlbumName) then | |
make new album named DestinationAlbumName | |
end if | |
import ImageFile into container named DestinationAlbumName with skip check duplicates | |
end tell | |
tell application "Finder" | |
delete theItem | |
end tell | |
end if | |
end tell | |
end repeat | |
end adding folder items to |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I tried to use this script to import Camera uploads (dropbox) but Photos reports that an import is already started, is there a way that the import only starts after the folder content is unchanged for x seconds?