Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

From Photoshop actions to Photoshop scripting?

I would like Photoshop to automatically execute the following task for a given folder:

  1. Load all PNG files in a given folder.
  2. Convert each file's mode to RGB color
  3. Add one layer to each file
  4. 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.

like image 412
Amelio Vazquez-Reina Avatar asked Apr 26 '11 21:04

Amelio Vazquez-Reina


People also ask

How do I import Photoshop actions into Photoshop?

Launch Photoshop and choose Window > Actions. Choose Load Actions from the Actions panel flyout menu. Select the *. atn file you want to import.

How do I run a Script in Photoshop?

Go to File > Scripts > Browse. Navigate to your script, and then press open. Your script will immediately run. If you would like to see your script in this script menu, then you need to copy it into the appropriate folder.


1 Answers

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

  1. Close Photoshop
  2. Copy the ScriptListener.8li file from the C:\Program Files\Adobe\Adobe Photoshop CS5\Scripting\Utilities folder
  3. Paste the file to the C:\Program Files\Adobe\Adobe Photoshop CS5\Plug-ins\Automate folder.
  4. Run Photoshop, perform actions you want to happen in your script.
  5. Close Photoshop, delete the copy of the script listener from the Automate folder.
  6. Edit the log file that is placed on your desktop by 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.

like image 121
Kevin Scharnhorst Avatar answered Oct 13 '22 18:10

Kevin Scharnhorst