Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
3

Question regarding adding a script to a Photoshop Action

New Here ,
Oct 09, 2023 Oct 09, 2023

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: 

matthewh50263964_0-1696863572783.png

 

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. 
TOPICS
Actions and scripting , Windows
191
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Oct 09, 2023 Oct 09, 2023

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 09, 2023 Oct 09, 2023
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines