Skip to main content
Participant
October 9, 2023
Question

Question regarding adding a script to a Photoshop Action

  • October 9, 2023
  • 2 replies
  • 199 views

Hi, to preface this conversation I am quite new to scripting. I have added a few scripts to Photoshop actions in the past however when I try to run the below script using the File>Script>Browse feature to add it as part of an action. The script runs succesfully once, but when I try and play the whole action again it says it cannot find the jsx file.

I want the script to check that if either the height or width are over 2000 pixels to run one action and if neither are above then it should run another action. 

This script is coming up with the 'Name:""'' section below it in the action menu. Which I have never seen before but I am guessing is due to something wrong with the script? 

Screenshot of the script as it appears in the Photoshop Action: 

 

And then the Script itself: 

 

#target photoshop
 
app.bringToFront();
 
 
if (app.activeDocument.width > 2000)
{
// Run this action if the IF statement is true.
doAction("Check Cutout Action 2365","Brandbank Check Cutout Actions");
}
else
 
if (app.activeDocument.height > 2000)
{
// Run this action if the IF statement is true.
doAction("Check Cutout Action 2365","Brandbank Check Cutout Actions");
}
else
{
// Run this action if the IF statement is false
doAction("Check Cutout Action 750","Brandbank Check Cutout Actions");
}
;
 
 
 
 
 
Thanks for any help. 
This topic has been closed for replies.

2 replies

Legend
October 9, 2023

Its not going to work unless the script is loaded at Photoshop launch. Put the .jsx in one of the script folders.

c.pfaffenbichler
Community Expert
Community Expert
October 9, 2023

Why don’t you put the Script in the Photoshop’s Presets/Scripts-Folder so you don’t need to browse for them?