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

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

Contributor ,
Dec 16, 2023 Dec 16, 2023

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.

 

TOPICS
Actions and scripting , macOS
312
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

correct answers 1 Correct answer

People's Champ , Dec 16, 2023 Dec 16, 2023

alert(arguments.length)

 

 

Translate
Adobe
People's Champ ,
Dec 16, 2023 Dec 16, 2023

alert(arguments.length)

 

 

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
Community Expert ,
Dec 17, 2023 Dec 17, 2023
LATEST

Neat! 

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