Commands - zwettemaan/TightenerDocs GitHub Wiki

Tightener Commands

Installing Tightener updates the PATH environment variable on your computer, and that gives you access to a set of Tightener-specific commands.

You need to run a command line session in Terminal or the Windows Command Prompt (CMD) to use these commands.

The cd_... commands all have an underscore in the command name.

cd_id

This command will consult your config.ini and then change directory into the designated InDesign application directory.

The relevant config.ini options are:

[placeholders]
INDESIGN_VERSION = 2022
INDESIGN_SDK_VERSION = 17.0
INDESIGN_COORDINATOR_SUFFIX = "${INDESIGN_DESKTOP_SUFFIX}"
INDESIGN_SERVER_CONFIGURATION = configuration
INDESIGN_SERVER_PORT = noport

cd_samples

This command will change directory into the Tightener SampleScripts directory.

cd_scripts

This command will change directory into the Tightener CommandLine/Scripts directory. Many of the commands documented here are in that directory.

I made an effort to make all these scripts 'human-readable'. You're encouraged to open them in a text editor and inspect them to gain a better understanding of Tightener.

cd_settings

This command will change directory into the local data directory used by Tightener. This is different for each platform.

  • Mac: ~/Library/Application Support/net.tightener
  • Windows: %APPDATA%\net.tightener
  • Linux: ~/.net.tightener/net.tightener

This directory contains the following subdirectories:

Logs

This is a directory for keeping log files

NamedPipes

On Mac and Linux, this directory contains the named pipes that allow coordinators to communicate with each other. Each named pipe is named after the coordinator that reads the pipe (e.g. the main coordinator will be reading a pipe by the name of net.tightener.coordinator.main.

On Windows, this directory contains a placeholder files that match the named pipes used for communication. Each placeholder file is named after the coordinator that reads the pipe (e.g. the main coordinator will be reading a pipe that corresponds to a placeholder file by the name of net.tightener.coordinator.main).

SessionData

This directory contains temporary files which reflect the process ID of a running coordinator. It is used by the main coordinator to match a coordinator name with a running process.

For any Tightener coordinator that is launched with a -d command line switch, there will also be .json files with the sysInfo() for that active coordinator.

This allows external processes to monitor a running coordinator. External processes can delete the .json file, and if the coordinator is active, the file should reappear shortly thereafter.

SysConfig

This directory stores the config.ini file for the computer.

cd_tightener

This command will change directory into the installation directory of Tightener.

Tightener does not need to be installed in any particular location.

However if you move the Tightener directory, you need to uninstall and reinstall to adjust the PATH and other environment variables.

clearEnvironment

(Internal) This command is used by the uninstaller

copyConfig

This command will make a customized copy of the template config.ini into the SysConfig directory.

The file in SysConfig is not identical to template file: the copy is prefixed with a few additional lines:

[placeholders]
TIGHTENER_RELEASE_ROOT = "/Path/to/where/you/installed/Tightener"

This allows Tightener to find its own install directory.

Use the editConfig command to invoke a text editor on the active config.ini

editConfig

Calls a text editor to edit the active config.ini in the SysConfig directory.

Make sure that you've adjusted the script to invoke your text editor - Tightener does not know what your favorite text editor is so you need to tell it.

https://github.com/zwettemaan/TightenerDocs/wiki/Configuring#configure-your-text-editor

editFile

Call the text editor to edit a file. Example:

cd_scripts
editFile copyConfigMac

evalTQL

Evaluate a string in TQL (Tightener Query Language).

Examples:

Calculate 1+2:

evalTQL 1+2

Query config.ini and retrieve the configured INDESIGN_VERSION:

evalTQL "sysInfo().ini.placeholders.INDESIGN_VERSION"

gwConsole

Launch the console-based, network-enabled main coordinator. This coordinator will enable the Tightener network features.

Because Tightener only allows a single coordinator net.tightener.coordinator.main, you need to make sure no other main coordinator is running.

If there is already a main coordinator running in the background, this command will attempt to launch, and then immediately quit.

This command will block the current command line window - you might want to use

gwConsole &

or

START gwConsole

to launch as a background task

You could use

killApps
gwConsole

to make sure no other main coordinator is active prior to launch.

It is allowed to use gwConsole even if the main coordinator is set to something different in the config.ini.

Tightener uses a 'first come, first served' approach: if a main coordinator is already running, it will not attempt to launch another main coordinator, and hence, it might ignore what is set in the config.ini.

To make this main coordinator the default, edit config.ini and set

[placeholders]
MAIN_APP = "${XOJO_CMDLINE_TIGHTENER_RELEASE}"

gwui

Launch the UI-based, network-enabled main coordinator. This coordinator will enable the Tightener network features.

It has a crude graphical UI which will show some of the messages being passed through the main coordinator.

Because Tightener only allows a single coordinator net.tightener.coordinator.main, you need to make sure no other main coordinator is running.

If there is already a main coordinator running in the background, this command will attempt to launch and then immediately quit.

This command will block the current command line window - you might want to use

gwui &

or

START gwui

to launch as a background task

You could use

killApps
gwui

to make sure no other main coordinator is active prior to launch.

It is allowed to use gwui even if the main coordinator is set to something different in the config.ini.

Tightener uses a 'first come, first served' approach: if a main coordinator is already running, it will not attempt to launch another main coordinator, and hence, it might ignore what is set in the config.ini.

To make this main coordinator the default, edit config.ini and set

[placeholders]
MAIN_APP = "${XOJO_UI_TIGHTENER_RELEASE}"

idLaunch

Launch InDesign. This command will consult config.ini and launch the designated copy of InDesign or InDesign Server.

The relevant config.ini options are:

[placeholders]
INDESIGN_VERSION = 2022
INDESIGN_SDK_VERSION = 17.0
INDESIGN_COORDINATOR_SUFFIX = "${INDESIGN_DESKTOP_SUFFIX}"
INDESIGN_SERVER_CONFIGURATION = configuration
INDESIGN_SERVER_PORT = noport

For more relevant info, try

cd_scripts
editFile idSetEnv

This Mac/Linux script shows how evalTQL is used to extract the relevant data from the config.ini.

idPluginInstall

Install the Tightener plug-in into InDesign. This command will consult config.ini and copy the correct plug-in version into the designated InDesign Plug-Ins folder.

idPluginRemove

Remove the Tightener plug-in from InDesign. This command will consult config.ini and remove the plug-in the designated InDesign Plug-Ins folder.

idSetEnv

(Internal). Consult config.ini and set environment variables to reflect the InDesign configuration.

killApps

Check the list of running processes for Tightener coordinators, and terminate them.

This only affects 'core' coordinators like main, console, scriptrunner, reflector. It will not kill InDesign or InDesign Server, despite them having the Tightener plug-in installed.

rre

Run Remote ExtendScript

The scriptrunner coordinator is launched, and this coordinator then forwards the script to main for routing and processing.

Usage:

rre <coordinator> <extendScriptFile> [ <waitBeforeQuitMilliseconds> ]

By default, rre will wait for 10 seconds before terminating - this to allow a remote node some time to send back some data.

If the targeted coordinator is on the local machine, then 10 seconds is a huge overkill - 500 or 1000 ms is plenty - e.g.

rre indesign idMakePDF.jsx 1000

rrt

Run Remote TQL script

The scriptrunner coordinator is launched, and this coordinator then forwards the script to main for routing and processing.

Usage:

rrt <coordinator> <tqlScriptFile> [ <waitBeforeQuitMilliseconds> ]

By default, rrt will wait for 10 seconds before terminating - this to allow a remote node some time to send back some data.

If the targeted coordinator is on the local machine, then 10 seconds is a huge overkill - 500 or 1000 ms is plenty - e.g.

rrt indesign idMakePDF.tql 1000

rt

Run TQL script

The scriptrunner coordinator is launched, and the TQL script is processed by this coordinator.

Usage:

rt <tqlScriptFile> [ <waitBeforeQuitMilliseconds> ]

By default, rt will wait for 500ms seconds before terminating - this to allow any remote node invoked from inside the script some time to send back some data.

In some cases, this is not enough and we can lengthen that time as needed, e.g.

rt someScript.tql 10000

setPath

(Internal). Calculate various paths and store them into environment variables. Used by the installer scripts.

setupEnvironment

(Internal). Calculate various paths and adjust the environment or profile as needed. Used by the installer scripts.

startConsole

Launch an interactive Tightener session using the console coordinator. You can type Tightener commands and they are immediately executed.

Currently does not allow using the arrow keys to move the cursor around. All you can do is .

Example:

startConsole
sysInfo().APP_DIR
sysInfo().ini.placeholders.MAIN_APP
sysInfo().buildDate
a = 12;
function x(b) { stdOut((b+2) + "\n"); }
x(a)
quit()

startServer

Will invoke killApps, then launch the local, non-network-enabled 'main' coordinator.

Because Tightener only allows a single coordinator net.tightener.coordinator.main, you need to make sure no other main coordinator is running.

If there is already a main coordinator running in the background, this command will attempt to launch and then immediately quit.

This command will block the command line window; you might want use

startServer &

or

START startServer

to launch as a background task.

It is allowed to use this coordinator even if the main coordinator is set to something different in the config.ini.

Tightener uses a 'first come, first served' approach: if a main coordinator is already running, it will not attempt to launch another main coordinator, and hence, it might ignore what is set in the config.ini.

To make this main coordinator the default, edit config.ini and set

[placeholders]
MAIN_APP = "${LOCAL_TIGHTENER_RELEASE}"

updateEnvironmentInProfile

(Internal). Used by the installer.

whatIsRunning

Queries the OS for currently running processes and filters the Tightener coordinators from that list.

⚠️ **GitHub.com Fallback** ⚠️