1

I have with 'Folder Action' that automatically runs a Photoshop script on each file that is added to the folder.

The folder action has two steps:

  1. Open this file with Adobe Photoshop CC

  2. Run the following AppleScript:

    on run {input, parameters}
    
        tell application "Adobe Photoshop CC"
            do action "frame for print" from "Zak's actions"
        end tell
    
        return input
    end run
    

This folder action works fine when only one item is added to the folder at a time, but if multiple items are added, the folder action fires on each of the new files almost instantaneously so they all open in Photoshop but the Photoshop action only runs on the most recently opened file. (I'm assuming that is because each time the Photoshop action is started it halts the execution of the previous instance)

I tried adding a pause after the AppleScript hoping that Automator was just thinking that the folder action was done after the AppleScript fired without waiting for it to finish, but even with the pause the folder action was activated for all new files at the same time.

Is there a way to make sure my folder action only runs on one file at a time and waits for the AppleScript to execute before moving onto the next file?

  • 1
    Upvoting and accepting an answer are a polite way to show your thanks for all the effort the poster did to provide you the right answer. If the anser is what you were looking for, please accept it, if not, tell why not. – CousinCocaine Jul 14 '14 at 9:21
1

You can do this multilpe ways, one is to use applescript to do a 'for each' loop.

Take this applescript code snippet as an example and work it out from there.

on adding folder items to this_folder after receiving these_items
   repeat with an_item in these_items
       tell application "Adobe Photoshop CC"
           activate
           open an_item
           do action "frame for print" from "Zak's actions"
       end tell
   end repeat
end adding folder items to
  • If I run this from Automator, will it re-execute the loop for every item that has been added? Or after the first time will it "know" that the items aren't considered new after the first time the loop completes? – Zak Jul 10 '14 at 13:35
  • It will run the action on every item in the folder, that is what a folder action is for (developer.apple.com/library/mac/documentation/applescript/…). You can move the files outside the folder or give them labels and select files in you a-script that do not have a label yet. – CousinCocaine Jul 10 '14 at 15:38
  • @Zak ...did it work? – CousinCocaine Jul 12 '14 at 9:42
  • Sorry for the delay @CousinCocaine - unfortunately, it didn't work. When the script runs now PhotoShop doesn't even open the files. – Zak Jul 17 '14 at 18:43
  • @Zak, you do know you have to change the script first to your likings? – CousinCocaine Jul 18 '14 at 6:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .