Adobe Extendscript is an extension of JavaScript (in the following we always talk about JavaScript), which serves to convert various Adobe software into scripts. The Adobe Extendscript Toolkit serves as IDE and is generally installed together with Illustrator, InDesign®, etc...

In contrast to InDesign®, the extension of JavaScript in Illustrator by external plugins is very limited. Only one single interface is provided:

Application.sendScriptMessage (pluginName: string , messageSelector: string , inputString: string ): string

This function is the interface to use the priint:comet Illustrator plugins via Extendscript.

The parameters must be as follows:

Function parameters are passed as string representation of a JSON object. This string usually represents a list of key/value pairs.

Adobe ExtendScript does not provide standard functionality for JSON, although it is supposed to be an extension of JavaScript. If you don't always want to create the parameter strings manually, you should consider using external libraries (e.g. JSON-js or JSON 3)

Please note that string parameters containing quotation marks or backslashes must be escaped accordingly (see executeCScript Example).

Executing a cScript in the current document context

Parameter

Name Data type Description
kScript String The cScript to execute as String

Examples

Easy to call a "Hello World" message as cScript

app.sendScriptMessage('CoreService', 'executeCScript', '{ "kScript" : "int main() { showmessage(\\"Hello World\\"); return 0; }" }');


Same script as above, but here the escaping of quotation marks is automated

var script = 'int main() { showmessage("Hello World"); return 0; }'
script = script.replace(/"/g, '\\"');

var parameter = '{ "kScript" : ';
parameter += '"' + script + '"; }';

app.sendScriptMessage('CoreService', 'executeCScript', parameter);