1 Reply Latest reply on Jan 8, 2015 10:57 PM by Trevorׅ

    Call an ExtendScript Script from the Command Line

    frameexpert Level 4

      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

        • 1. Re: Call an ExtendScript Script from the Command Line
          Trevorׅ Adobe Community Professional

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