crdtuxpIDSN

crdtuxpIDSN

Creative Developer Tools (CRDT) is a growing suite of tools aimed at script developers
and plug-in developers for the Adobe Creative Cloud eco-system.

This module provides functions that are specific to Adobe InDesign.
Source:

Methods

(static) collectionToArray(coll)

Convert an InDesign collection into a pure JavaScript array
Source:
Parameters:
Name Type Description
coll Collection an InDesign collection
Returns:
array with the collection elements

(static) doUXPScript(scriptText, optionsopt) → {Promise.<any>}

Run a UXPScript source string through the InDesign bridge.

This is meant for panel-side code that needs the final InDesign-facing work to run as a host-owned UXPScript launch instead of directly inside the panel runtime.

The bridge launches a clean UXPScript runner file and hands it a payload file path.
For string input, the source is first written to a temporary .idjs file.

By default, the bridge rejects source that matches a rough async-syntax heuristic after comments and quoted strings are stripped, because observed InDesign behavior suggests that the top-level launcher can switch into a slower, redraw-heavy mode when it contains real async syntax such as async function dummy() {}. This is intentionally not a full JavaScript parser.
Source:
Parameters:
Name Type Attributes Description
scriptText string UXPScript source to run
options object <optional>
{
allowAsyncToken: false to bypass the rough async-mode source inspection
clearPending: accepted for backward compatibility; currently ignored
engineName: accepted for backward compatibility; currently ignored
taskName: accepted for backward compatibility; currently ignored
}
Returns:
Type:
Promise.<any>
result returned by InDesign doScript()

(static) doUXPScriptFile(filePath, optionsopt) → {Promise.<any>}

Run a UXPScript file through the InDesign bridge.

The supplied file path is passed through directly; the bridge does not copy it to a temporary file.

If you want fail-loud inspection for the top-level launcher text, pass that source in options.sourceText and set options.requireSourceInspection = true.
Source:
Parameters:
Name Type Attributes Description
filePath string absolute path, or a path relative to options.basePath
options object <optional>
{
basePath: base folder for relative file paths
sourceText: optional source text for sync-mode inspection
requireSourceInspection: reject if sourceText is not supplied
allowAsyncToken: false to reject inspected source containing the token async
clearPending: accepted for backward compatibility; currently ignored
engineName: accepted for backward compatibility; currently ignored
taskName: accepted for backward compatibility; currently ignored
}
Returns:
Type:
Promise.<any>
result returned by InDesign doScript()

(static) wouldUXPScriptRunInAsyncMode(scriptText) → {boolean}

Rough async-mode heuristic for a top-level InDesign UXPScript launcher.

Comments and quoted strings are stripped before matching common async syntax. This is intentionally not a full JavaScript parser.
Source:
Parameters:
Name Type Description
scriptText string top-level launcher source text to inspect
Returns:
Type:
boolean
true when the launcher matches the rough async-mode heuristic