Help with Apple Script to Import Pictures to Photos, then Move to Folder

I am trying to setup an automatic backup of my pictures from my iPhone, by utilizing my Synology Disk Station NAS and then uploading those pictures to Photos App, then moving those pictures to another folder on the DS. Synology has pretty good photo app to automatically upload pictures on wifi network, so my first thought was to write an Automator Script to accomplish this. I've spent so much time trying to make the Automator work properly, but I keep running into an error that Automator times out.


I even tried this Script within the Automator Script:


on run {input, parameters}


tell application id "com.apple.photos"


try


with timeout of 7200 seconds


run



if input is not {} then


import input with skip check duplicates


end if


end timeout


on error errorMessage


display alert "IMPORT ERROR" message errorMessage



end try


end tell


return input


end run


It seems to work OK most of the time when I have Automator running and there are not too many pictures/videos to upload to Photos. However I want this to run as an application opened each night via a calendar event. Every time it runs it fails. Therefore, I want to try running this entire thing as an Apple Script.


*If you know of a workaround within Automator to get around the application timing out, please tell!


I'm completely new to Apple Script, but am somewhat aware of some simple programming languages, so I'm not scared to give this a try.


So far I have:


on run {input, parameters}


with timeout of 7200 seconds


tell application "Finder"


try


mount volume "smb://DS413/photo"


end try


end tell


tell application id "com.apple.photos"


try


with timeout of 7200 seconds


run



if input is not {} then


import input with skip check duplicates


end if


end timeout


on error errorMessage


display alert "IMPORT ERROR" message errorMessage


end try


end tell


return input


end timeout


end run



Please Help! Thanks!


Mac Pro

Posted on Feb 15, 2022 1:04 PM

Similar questions

There are no replies.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Help with Apple Script to Import Pictures to Photos, then Move to Folder

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.