Skip to main content
frameexpert
Community Expert
Community Expert
January 8, 2015
Answered

Call an ExtendScript Script from the Command Line

  • January 8, 2015
  • 3 replies
  • 15294 views

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

Correct answer Sunil Yadav

check this out, this might help you!

Run script from command line

3 replies

Sunil Yadav
Sunil YadavCorrect answer
Legend
September 14, 2018

check this out, this might help you!

Run script from command line

jasons46431568
Participant
August 18, 2024

link is broken?

Robert at ID-Tasker
Legend
August 18, 2024
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 

 

daitranthanhoa
Inspiring
December 27, 2017

Try this code:

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

cmd:

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

Trevor:
Legend
December 27, 2017

can you elaborate on  sampleclient -host localhost:185

daitranthanhoa
Inspiring
December 28, 2017

i using indesign server.

Trevor:
Legend
January 9, 2015

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);