TQL - zwettemaan/TightenerDocs GitHub Wiki

TQL

TQL is the Tightener Query Language, pronounced "Tickle". It is the language embedded in Tightener for local and remote node orchestration.

The working master document is TightenerDocs/TQL_Master.md. This wiki page is the shorter roadmap version.

Purpose

TQL exists so one Tightener node can ask another node to do meaningful work near the data or object model it owns.

Typical example: a Python or command-line node asks an InDesign node to inspect a document, create a PDF, or return structured data. The work runs inside or near InDesign, avoiding slow network ping-pong.

TQL is also the planned escape route when ExtendScript issues appear and Adobe does not fix them. It is meant to replace fragile BridgeTalk-style orchestration with a Tightener network where multiple nodes and applications can cooperate.

Philosophy

  • Simple enough for non-developers and production users.
  • Built into Tightener; no external language runtime dependency.
  • Cooperative multitasking; scripts yield instead of being preempted unpredictably.
  • Errors are values; no try/catch control-flow model.
  • JavaScript-like surface syntax, but not JavaScript compatibility.
  • Missing features are often missing on purpose.

Runtime Model

TQL runs inside a Tightener node. A node can be a command-line process, InDesign plug-in, gateway, Xojo app, Python-facing process, or other host adapter.

Evaluation is task-based and yielding. Long operations can suspend and resume across timeslices, which is essential for hosts like InDesign.

The object model supports ordinary data plus host-provided nodes. Host nodes may expose DOM-like access to applications such as InDesign.

Data Model

Core value categories include:

  • undefined
  • null
  • booleans
  • integers and floats
  • strings
  • arrays
  • maps/objects
  • expressions
  • functions
  • error values
  • NaN
  • GUID values
  • host object model nodes

Syntax Snapshot

var data = {
    title: "Catalog",
    pages: [1, 2, 3]
};

function label(x) {
    return "Item " + x;
}

for (var i = 0; i < data.pages.length; i = i + 1) {
    output(label(data.pages[i]));
    yield();
}

Supported constructs include:

  • strings, numbers, arrays, maps/objects
  • property/index access: object.name, items[0]
  • function calls
  • var
  • function
  • if/else
  • while, do/while, for
  • break, return
  • arithmetic, comparison, boolean, bitwise, assignment, ternary, comma, and sequence operators
  • line/block comments
  • here documents

Built-Ins

Core built-ins include math, strings, arrays/maps, file/directory access, path helpers, environment/sysinfo, logging, streams, eval/parse helpers, orchestration/data helpers, and yield.

Some builds add plugin-installer or licensing-specific built-ins. Treat those as build extensions, not universal language features.

Important Quirks

  • TQL is JavaScript-like, not JavaScript.
  • {} can mean an empty object or an empty scope depending on parse context.
  • Console input may end at a newline once the parser has a complete top-level expression.
  • Host object model access can be lazy or expensive.
  • Errors are values, but malformed code can still be a parse/task failure.

Deliberate Omissions

TQL should not grow prototypes, classes, imports, new, promises, async/await, arbitrary package loading, or user-visible thread synchronization unless there is a deliberate design change.

There is no try/catch; scripts should handle error values through ordinary code paths.

Samples

See TightenerDocs/CurrentRelease/SampleScripts for working examples:

  • hello.tql
  • idMakePDF.tql
  • localMakePDF.tql
  • localWhichInDesignCoordinator.tql
  • remoteAccessInDesignAppName.tql
  • remoteCloseAllInDesignDocs.tql
  • rt_makePDF.tql
  • parallelScript.tql
  • licenseCheck.tql