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

Run script from command line

Community Beginner ,
Sep 10, 2018 Sep 10, 2018

Copy link to clipboard

Copied

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

Views

7.3K

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

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

Votes

Translate

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

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.

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

yadavs92328

Thanks! It works like a charm!

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

Copy link to clipboard

Copied

Saved my life

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

Copy link to clipboard

Copied

What is 1246973031 in the VBScript?

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

Copy link to clipboard

Copied

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.

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

Copy link to clipboard

Copied

where can we get that  wscript.exe

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

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.

 

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