For js processors to work, you need a .js file specified in processors. Inside the file, there must be a function specified in function. JavaScript code is executed inside nodejs, so it is possible to include built-in modules such as path, fs, net, etc.
Following helper constants and functions have been added to the execution context:

  • __PROCESSOR_PATH__ is a constant containing the full path to the current processor file. To get a path without a filename, use the dirname method from the path module.

  • callFunc is a function to call host application code:

    function callFunc(method: string, …args: any): Promise<any>

    To execute arbitrary code inside the host application, use the csInterface.evalScript method.

    function evalScript(script: string, callback: (result: string) => void)
  • loadScriptFile is a function to include a JSX-file in the host application:

    function loadScriptFile(scriptPath: string): Promise<bool>
  • csInterface — is an object for working with the host application.

Пример процессоров:

  1. version_pre

First, an additional script is loaded into the host application that describes the dialog box and the function to open it. Next, the showWindow method from the example1.jsx script is called, which opens the window. Depending on the pressed button, the text of the report changes.

async function version_pre(task_info, args) 
await loadScriptFile(path.join(path.dirname(__PROCESSOR_PATH__),
const result = await callFunc("showWindow");
console.log("result", result); = result;
return args;


var dialogResult = "";

function createDockableUI(thisObj) {
var dlg = new Window("dialog", undefined, undefined, { resizeable: false });
dlg.text = "";

var group1 = dlg.add("group", undefined, { name: "group1" });

var btn = group1.add("button", undefined, undefined, { name: "btn" });
btn.text = "Apply";

btn.onClick = function() {
dialogResult = "Apply";

return dlg;

var dlg = createDockableUI(this);

showWindow = function() {;;
return $._ext.successResult(dialogResult);

2. screenshot_replace.
An image of a kitten is requested from an external resource, saved to a temporary file, and the final path is written to the argument. As a result, the attached file will have a kitten thumbnail.


function download_file(file, url) {
return new Promise((resolve) => {
https.get(url, function (response) {

async function screenshot_replace(task_info, args) {
console.log("task_info", task_info);
console.log("args", args);

const response = await fetch("", {
method: "POST",
const json = await response.json();
const catUrl = json.file;
const file = fs.createWriteStream("%temp%/file.jpg");
await download_file(file, catUrl);

args.image_path = file.path;
return args;

<< Previous

Did this answer your question?