I have an applescript that moves all files with the extension .jpg from one folder to another. It works fine if I click run from the script editor or if I use it manually from the menubar scripts dropdown.
What doesn’t work is I want newly added .jpgs to automatically be moved when they are created in the original location by another app so I tried to add the script as a folder action but it does not automatically move .jpgs when they are added to the folder. The source finder window blinks as though the script is running but the files are not moved.
What am I doing wrong?
Here is my script.
tell application "Finder"
try
set the this_folder to "RacerX:Users:cameron:Desktop:something" as alias
set the that_folder to "RacerX:Users:cameron:Desktop:another" as alias
move (every file of this_folder whose name contains ".jpg") to that_folder
on error
move (every file of this_folder whose name contains ".jpg") to that_folder
end try
end tell
Also what would be the correct code so that I can use the script on any folder I attach it to rather than hard coding a specific source folder?