Skip to main content
Inspiring
December 16, 2023
Answered

How to know if a jsx script has been launched from Photoshop or from Applescript?

  • December 16, 2023
  • 1 reply
  • 324 views

Hello,

Is there a way to know if a jsx script has been launched directly from Photoshop or from an Applescript?

 

I have a jsx which can be launched by an Applescript or directly from Photoshop and I would like to know if it has been launched directly from Photoshop.

 

AS

 

set myJSXFile to "/Volumes/SSD/SOUK/test.jsx"
tell application "Adobe Photoshop CS6" 
   activate
   do javascript of file myJSXFile with arguments {"test1", "test2"}
end tell

 

 

JSX

 

if (arguments !== undefined) {
	alert("Launched from Applescript");
}else{
	alert("undefined arguments: launched from Photoshop."); ///// never executed
}

 

 

My problem is that the arguments variable never seems undefined, whether the jsx is launched from Applescript or directly from Photoshop.

 

Thank you.

 

This topic has been closed for replies.
Correct answer r-bin

alert(arguments.length)

 

 

1 reply

r-binCorrect answer
Legend
December 16, 2023

alert(arguments.length)

 

 

c.pfaffenbichler
Community Expert
Community Expert
December 17, 2023

Neat!