Samantha Makes
Photoshop Scripts -  Automate your work - Part I

Photoshop Scripts - Automate your work - Part I

Have you ever wondered how to make your design process in photoshop more streamlined? There are a few tools Adobe offers to help you automate: actions and scripts. Actions are a series of steps that you can record and then replay. Here is how you can do it: In Photoshop, open the Actions panel You […]

Have you ever wondered how to make your design process in photoshop more streamlined? There are a few tools Adobe offers to help you automate: actions and scripts. 
Actions are a series of steps that you can record and then replay. Here is how you can do it:
  1. In Photoshop, open the Actions panel 
  2. You will see a button for recording, as highlighted in the image below
  3. Click the round button to start recording – and perform a set of actions.
  4. Hit the stop button when you are done.
Now you have an action recorded! You can repeat this action on other files, by clicking on the action – see image.
While this is great, you are limited to the file you have open and the menu options in photoshop (which are many, of course!). Enter Scripts – with a script, you can write some code and tell photoshop what to do with a file – or multiple files – without having to even open a single one. 
Wanna give it a try? Let’s get started. 
What you need:
  1. Photoshop
  2. A text editor – I use Sublime Text for this, but other options are: TextEdit on you Mac, Atom, or Notepad++
If you have some javascript knowledge that is great, and you can follow along, otherwise, you can just copy the final script at the bottom of this post. 
On your text editor, create a new file and write the following
Let’s break it down:
#target photoshop – this is to tell the software that we want to run this script in photoshop
main(); – This is javascript’s way of saying “Please, run the piece of code called main”
function main () {} – Here we define what we want to have happen when main is called. Inside the function, we define the variable name (var name) as the output of the prompt. Next we combine the strings “Hello” and “Name” to be displayed in an alert box. 
To see this in action, you need to save this file using a JSX extension in the following folder: /Applications/Adobe Photoshop 2021/Presets/Scripts/<Create a folder for your scripts>/ – I called my file NewDocument.jsx
I am using Photoshop 2021. If you are using a different version, the path to the folder will be that of your photoshop version. Things may be a little different on a windows machine. 
Now, you need to re-open Photoshop. Then click on File>Scripts>HelloWorld.
Your prompt will pop up and you can type your name and hit Enter.
Congratulations! You have written your first Photoshop Script. Next I am going to show you how to create new document.