Skip to main content
jimm7329411
Known Participant
January 4, 2019
Question

Could not complete the command because Photoshop was unable to find the JavaScript file.

  • January 4, 2019
  • 3 replies
  • 5917 views

Hello,

I am getting the message...

"Could not complete the command because Photoshop was unable to find the JavaScript file."

This happens when I try to run a script that will detect if the active document is Landscape or Portrait.

The script works just fine when used manually, and even when I record it into an action.  But when the

action is tested it gives this error message.

I have called adobe but they said it's a script issue so they cannot help me. 

I have many other actions using the exact same script that work just fine so I have no idea

what is wrong. 

I recently added the #target photoshop part at the front of the script

and that seemed to work for awhile but now even that is not helping it.

Any help is greatly appreciated, here is the script....

#target photoshop

var doc = app.activeDocument;

if(doc.width.value>doc.height.value){//Landscape

  doAction("AddHorBack", "Automations");

  }else{//Portrait

  doAction("AddPortBack", "Automations");

}

This topic has been closed for replies.

3 replies

Zesty_wanderlust15A7
Known Participant
May 18, 2022

I just got the same thing trying to record my first script in PS 23.3.1 under Win 10. Wherever I put my simple script (that works fine during recording), it is "not found back" when playing... 😞

I tried placing it in all recommended spots and more — nothing works.

I'm newish to Win 10 and I suspect it's involved somehow, especially its folder protection systems. I'm gonna try to disable those.

In fact, coming from Win 7, I was suspecting I had to re-record my many actions calling scripts, as PS or Win 10 might not allow them to be in a folder on drive C. Funnily enough, all my actions calling these "old" scripts on c:\PS scripts DO work, yet when I record a new one nothing works (so far)...

Legend
May 18, 2022

You can't record a script, but you can record an action. We need a LOT more information, as in show the action you recorded with all steps to start with. Are your scripts in the correct folder?

Zesty_wanderlust15A7
Known Participant
May 18, 2022

To be more clear: I'm new to Win 10, not to PS Scripting. You can record a script into an action.
It's working now. I had to add a shortcut to my c:\PS scripts folder in Presets\Scripts so the scripts show up in PS. If I select it from that list during recording, PS will find it back.

Before it also worked when the script was browsed for. Its sucks that I have to make a new "active scripts" folder that doesn't have every possible script in it, but anyway...

JJMack
Community Expert
Community Expert
January 4, 2019

If that script file is there post it so I can see it includes other scripts

JJMack
JJMack
Community Expert
Community Expert
January 4, 2019

Please post a screen capture that shows Photoshop UI with the Error message. Also post the two Automations Actions AddHorBlack and AddPortBlack where the actions are fully expanded so can see if these actions have scripts steps. The script you posted will play one of these two actions.  That script is basically a one line if else statement and does not include other scripts.  The Actions may.   That script also will not work correctly if Photoshop's ruler units is set to  percentage for  width and height will always be equal to 100% no matter what orientation the document has.  It will always play AddPortBlack.....

JJMack
jimm7329411
Known Participant
January 4, 2019

Hi JJMack,

Thanks for responding!

Here is what you requested.  The two actions do have another script in them but

they both work fine when ran manually.

The hangup comes when running "Step 3 Same Back"

The Place happens fine, and then the "Scripts" is what throws up the error message.

Also, the rulers are set to inches so that is fine, good idea to check that!

Let me know if you need any other info.

THANK YOU!!!!

JJMack
Community Expert
Community Expert
January 4, 2019

You did not post Photoshop screen capture showing Photoshop UI with the error message showing so I could see which action was failing and in which step.  You also did not post the two actions fully expanded so I could see the setting and script names the actions uses.

You posted just the error popup and the action showing steps but no step information. If an other action "Step 3 Same Black" Place in a file and uses a script  we would need to see the the script name is and the contents of that script the seems to be the step that the  "Step 3 Same Black"  action has highlighted which may be the script step that is not being found.

Use the ALT Key when you expand the action so you can read what steps do.

JJMack