I would like Photoshop to automatically execute the following task for a given folder:
- Load all PNG files in a given folder.
- Convert each file's mode to
RGB color
- Add one layer to each file
- Save the files as PSD in the same folder
I have been told that this can be done with Photoshop scripting, but I don't know how to get started since unfortunately I don't have much experience with JavaScript.
One thing I know is that I can't run the task above using Actions
because when I record the last step (4), Photoshop records the action to save the PSD files in the folder that I use when recording the macro (instead of the one used to load the original PNG files). In other words, it fixes the destination folder to the one used in the macro.
This takes me to the following question: Is there a way to automatically generate the Photoshop Javascript code that runs a given action?
If so, I wouldn't mind learning how to modify the script to fix the above folder problem.
I made a script which does the required job:
It can be improved in many ways, but I hope it helps.
To update Kevin's answer, ScriptListener is now hidden in a different place:
http://www.adobe.com/devnet/photoshop/scripting.html
inside "Scripting Listener Plug-in". The plugin directory in Windows has also changed, typically:
C:\Program Files\Common Files\Adobe\Plug-Ins\CC
Let me answer the question you actually asked in bold: There is a tool that automatically generates the Javascript for the actions and events that are taking place in Photoshop. It is called the Script Listener. After using the script listener to record your actions, review the log and make your selective edits.
To begin using the Script Listener
To get your new fangled script into Photoshop place the file you've created with a jsx extension into C:\Program Files\Adobe\Adobe Photoshop CS5\Presets\Scripts.
Lynda.com has a great course on using scripting and the script listener. It is a membership based site however and is not free ($25-$35 month).
I realize this is an old question, but what the original post is asking for can be done entirely in a Photoshop Action. Photoshop actions are easy to record - you just hit record and do the steps manually. - including the Open, operations and save step.
The only trick left is to make the action run in a specific folder rather than the place you record the action. That's easy, however. Use the "Override Open" and "Override Save" options. You invoke this action using File -> Automate -> Batch or from Adobe Bridge using Tools -> Photoshop -> Action
See this for an example:
For some additional tips look here
look for the file SaveAsDifferentFileType.jsx on your computer, i think you could use this as starting point.
There is now way that i know of to generate this code automatically. I think there is no way around learning how it works:
Here the documentation: http://www.adobe.com/devnet/photoshop/scripting.html And here a tutorial that will tell you where to begin: http://morris-photographics.com/photoshop/tutorials/scripting1.html
If you are using a MAC you could try the Automator Photoshop actions: http://www.completedigitalphotography.com/?p=339
They will let you do what you want, without any programming know-how.