3 Replies Latest reply on May 23, 2013 11:15 AM by bizmac

    Run script with action.



      Please imagine that I have to combine 2 files. On first file I have to add some adjustments, etc +  secon file (multiply them (ambient occlusion)).

      What am I doing? I'm creating action which will do that, one thing I can't do is to open specific file.


      I have thousands of files like that:






      I've never used script before, but I think that would be solution for me.

      Question is: How to create script to open filename+sufix in the same folder. What's more is fact I have to run this scrip in single action (alt+F9)

        • 1. Re: Run script with action.

          var pathToOpenFile = activeDocument.path;

          var nameOfOpenFile = activeDocument.name.replace('.psd','');  // that removes a psd file extension if it has one

          var secondFile = new File(pathToOpenFile + '/' + nameOfOpenFile + '_ambientOcclusion.psd');



          this is written for psd files, but can be adjusted easily for other filetypes.Save that as a .jsx file in your scripts folder and restart photoshop if its open.  In your action, where you need to open the '_ambientOcclusion' file, insert this script. This page has info on where to put the script, and how to insert a script into an action.  Hope this helps with your goal.

          • 2. Re: Run script with action.
            keid Level 1

            I've written something like that already, but anyway: Thanks for help : ).

            • 3. Re: Run script with action.
              bizmac Level 1

              Maybe it will help someone else in the future.  Next time you ask a question and figure it out yourself,consider updatig your post so others in the same boat can find it here.