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

javascript doesn't run on image open etc

Community Beginner ,
Feb 09, 2023 Feb 09, 2023

Copy link to clipboard

Copied

Hi, it's no doubt known but this bug bothers my workflow a lot, I use actions with javascript and just about always after opening an image I need to wait a few seconds before running an action or I get this error "Javascript code was missing"    not sure if this is unique to my installation or not.

TOPICS
Actions and scripting

Views

58

Translate

Translate

Report

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
Community Expert ,
Feb 09, 2023 Feb 09, 2023

Copy link to clipboard

Copied

Please post the problem script and a screenshot of your actions panel fully expanded.

Votes

Translate

Translate

Report

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
Community Beginner ,
Feb 09, 2023 Feb 09, 2023

Copy link to clipboard

Copied

Thanks, i've attached my script, it resizes an image after loading.     

In my action I prompt a load dialog and load an image and then run the script.   many times it works but just as many times it fails with the attached message.    It usually works on a repeat try, though on rare occasions doesn't work at all until a PS restart.  

//script
// Call the source doc

var srcDoc = app.activeDocument;

// get original width and height
var w = srcDoc.width.value;
var h = srcDoc.height.value;

// adjust canvas size four times original
// with the anchor in the top left
srcDoc.resizeCanvas(w/3, h, AnchorPosition.TOPLEFT);Untitled-1 copy.png

Votes

Translate

Translate

Report

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
Community Beginner ,
Feb 09, 2023 Feb 09, 2023

Copy link to clipboard

Copied

the actions panel.   i've noticed it is time dependant, many times my scripts work if I wait a few seconds after opening an image

 

 

Untitled-2 copy.png

 

Votes

Translate

Translate

Report

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
Community Expert ,
Feb 09, 2023 Feb 09, 2023

Copy link to clipboard

Copied

LATEST

What happens if the action records the script being run from C:\ drive, rather than E:\ drive?

 

What happens if you install the action into the program folder for Photoshop > Presets > Scripts, then record the action from File > Scripts rather than browsing?

 

What happens if you create an action to resize? (it doesn't look like a script is really needed for the use case)

 

Votes

Translate

Translate

Report

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