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.
page 11 in the user manual
Automatic jsxbin Conversion
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:
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]:
"ExtendScript Toolkit.exe" -cmd compiler.jsx
"ExtendScript Toolkit.app/Contents/MacOS/ExtendScript Toolkit" \
Here is a sample compiler script (compiler.jsx) with the source script's file path hardcoded.
var fileIn = File("/c/jsxbin_test/source.jsx");
var s = fileIn.read();
var t = app.compile(s);
var fileOut = File( fileIn.absoluteURI + "bin" ) ;
Try this code:
var path = app.scriptArgs.getValue( "indd_path" );
sampleclient -host localhost:185 C:\Script\main.jsx indd_path="a.indd"
can you elaborate on sampleclient -host localhost:185
i using indesign server.
sampleclient is used to send a SOAP command to InDesign Server.
While this is an old discussion, let me add this command to cover the Mac side with InDesign Desktop:
osascript is a shell command to launch an AppleScript.
application id "com.adobe.indesign" is a version independent way to address InDesign.
From Windows one can use.
powershell -command "$ind = new-object -comobject InDesign.Application.CC.2018; $ind.DoScript('PathToFile', 1246973031)"
From Mac to run a script File (which can be more convenient) one can use
One question I have is at least on Windows are methods or properties available by connecting directly to the com that are not available from the scripting dictionaries. I.e. are any SDK properties available?
1 person found this helpful
The COM interface is described by a "TLB" Type Library. InDesign generates it from the same ScriptInfo resources that it also uses for the AppleScript Terminology, the ExtendScript object model and even for INX and IDML. So in most cases the exposed functionality is the same, with few intentional (extra developer work) differences, e.g. "delete" renamed to "remove" where it collides with a reserved keyword, or properties excluded from a specific engine (not in IDML ...).
I'm not aware of any list of actual differences.
I would like to be able to call a script by targeting the the host apps pid
Any ideas of how I can do this?
tell application "System Events"
-- 14883 and 14654 are the PIDs of my running instance of InDesign
set proc to item 1 of (processes whose unix id is 14883)
--set proc to item 1 of (processes whose unix id is 14654)
-- AppleScript works
tell application proc to do script "/Applications/Adobe InDesign CC 2018/Scripts/Scripts Panel/Samples/AppleScript/PathEffects.applescript"
1 person found this helpful
"tell application proc" does not work, there is no coercion from process to application.
From error messages with jsx attempts I guess that your AppleScript is still executed because the "tell" will end up at that script's object, and inside the script there'll be another tell to target InDesign. It should also fail with your posix path, but why complain?
Given that all InDesign versions have the same bundle identifier, I see no way to address a specific one by means of "tell". Unfortunately
the Carbon psn seems to be unsupported nowadays, that eliminates other approaches. I'd try to make the process frontmost via System Events, then hope that "tell" prefers that frontmost. Something along
tell application "Finder"
set jsx to (file "test.jsx" of desktop) as alias
set proc to first process whose bundle identifier is "com.adobe.InDesign"
set frontmost of proc to true
That's seems to work well.
I tested it with multiple simultaneous instances of Indesign and it targets the version that it's called from.
My next task it to get it working also on Windows and on the other apps as well.
I'll try work on it in the next month or 2.