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

Run script from command line

Community Beginner ,
Sep 10, 2018 Sep 10, 2018

Greeting all,

What I am trying to do is to force InDesign to open a jsx file directly. It seems not working either using command line tool or opening jsx file directly. The error message is captured as below image.

Pasted_Image_10_09_2018__4_43_PM.png

Can anyone please advise the best way to trigger a script file from command line? The reason to do so is that the jsx file is generated dynamically by hardware.

Thanks in advance!

Best,

Hugo 

TOPICS
Scripting
8.2K
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

Advocate , Sep 10, 2018 Sep 10, 2018

Try this,

This is command line argument,

wscript.exe D:\SunilY\Test\vbScript.vbs

This is my vbScript.vbs

Set myInDesign = CreateObject("InDesign.Application.CC.2017")

dim myArray, myString

myTestJavaScript = "D:\SunilY\Test\test.jsx"

myInDesign.DoScript myJavaScript, 1246973031

Translate
Community Expert ,
Sep 10, 2018 Sep 10, 2018

Ask in the InDesign Scripting forum. I'll move your messge there now.

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
Advocate ,
Sep 10, 2018 Sep 10, 2018

You can't just open .jsx file into indesign application. If you want to execute jsx, you can call jsx from vb script, and call that vbscript from command line.

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
Advocate ,
Sep 10, 2018 Sep 10, 2018

Try this,

This is command line argument,

wscript.exe D:\SunilY\Test\vbScript.vbs

This is my vbScript.vbs

Set myInDesign = CreateObject("InDesign.Application.CC.2017")

dim myArray, myString

myTestJavaScript = "D:\SunilY\Test\test.jsx"

myInDesign.DoScript myJavaScript, 1246973031

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 Beginner ,
Sep 11, 2018 Sep 11, 2018

yadavs92328

Thanks! It works like a charm!

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
New Here ,
Jul 15, 2019 Jul 15, 2019

Saved my life

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
New Here ,
Nov 18, 2021 Nov 18, 2021

What is 1246973031 in the VBScript?

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
Valorous Hero ,
Nov 18, 2021 Nov 18, 2021
quote

What is 1246973031 in the VBScript?


By Sohum21815629kzif

It's enumeration — the 2-nd parameter of the DoScript command — Language: the language of the script to execute.
This number is equivalent to idJavascript.

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
Explorer ,
Nov 18, 2021 Nov 18, 2021

where can we get that  wscript.exe

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
New Here ,
Jul 11, 2023 Jul 11, 2023

Hello, can I ask for one more  thing?

 

How can I do if my .jsx need to pass agurments? And I still can't find the solution for this

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
Valorous Hero ,
Jul 11, 2023 Jul 11, 2023
LATEST

See an example here.

Also, you can use app's scriptArgs property to send arguments via doScript (withArguments parameter).

Here's an example of using it for all three languages: JS, AS, and VBS.

 

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