Skip to main content
frameexpert
Community Expert
Community Expert
Jan 8, 2015 8:08 PM UTC
Answered

Call an ExtendScript Script from the Command Line

Hi! I can call an ExtendScript script from a command line or batch file just by using its path, but is there a way to pass parameters to the script? Thanks. -Rick

Sunil Yadav
Sunil YadavCorrect answer
Legend
Sep 14, 2018 4:31 AM UTC

check this out, this might help you!

Run script from command line

13 replies

Sunil Yadav
Sunil YadavCorrect answer
Legend
Sep 14, 2018 4:31 AM UTC

check this out, this might help you!

Run script from command line

Translate
jasons46431568
Participant
Aug 18, 2024 9:41 AM UTC

link is broken?

Translate
Robert at ID-Tasker
Legend
Aug 18, 2024 11:57 AM UTC
quote

link is broken?


By @jasons46431568

 

Google "sunil run script from command line adobe forum": 

 

https://community.adobe.com/t5/indesign-discussions/run-script-from-command-line/td-p/10105689 

 

Translate
daitranthanhoa
Inspiring
Dec 27, 2017 10:17 AM UTC

Try this code:

var path = app.scriptArgs.getValue( "indd_path" );

cmd:

sampleclient -host localhost:185 C:\Script\main.jsx indd_path="a.indd"

Translate
Trevor:
Legend
Dec 27, 2017 12:40 PM UTC

can you elaborate on  sampleclient -host localhost:185

Translate
daitranthanhoa
Inspiring
Dec 28, 2017 7:25 AM UTC

i using indesign server.

Translate
Trevor:
Legend
Jan 9, 2015 6:57 AM UTC

Hi Rick

I answered the question over here Re: Create a build script for Extend Script

I have some more info on it if needed but don't have time to post it this week.

Regards

Trevor

page 11 in the user manual

Automatic jsxbin Conversion

The jsxbin format (Binary JavaScript) enables distributing a script without exposing its source code. The

ExtendScript ToolKit offers an Export to Binary feature that instantly converts a js(x) file into jsxbin. The

jsxbin export process can be done automatically without user interaction.

To do this:

1. Write a compiler script file that compiles .jsx files into a .jsxbin file.

 The script file must start with this target directive:

#target estoolkit#dbg

 Use the app.compile() method and pass the content of the script file as a String parameter.

 In the script, store the result in a new file with the extension .jsxbin.

2. Launch the ExtendScript ToolKit with the command-line parameter -cmd [path to compiler script file]:

Windows:

"ExtendScript Toolkit.exe" -cmd compiler.jsx

Mac:

"ExtendScript Toolkit.app/Contents/MacOS/ExtendScript Toolkit" \

-cmd compiler.jsx

Here is a sample compiler script (compiler.jsx) with the source script's file path hardcoded.

#target estoolkit#dbg

var fileIn = File("/c/jsxbin_test/source.jsx");

fileIn.open("r");

var s = fileIn.read();

fileIn.close();

var t = app.compile(s);

var fileOut = File( fileIn.absoluteURI + "bin" ) ;

fileOut.open("w");

fileOut.write(t);

Translate