Workspaces
Custom scripts in Translator++ are divided into 5 different workspaces: global workspace, object level, row level, cell level, and found cells (in search window)
There is no built in iterator in the global workspace.
1. Global workspace
There is no built in iterator on Global level workspace

2. Object based iterator
In this workspace the script will be executed for each selected object (or all if none selected)

3. Row based iterator
In this workspace the script will be executed for each row within selected object (or all if none selected).

4. Cell based iterator
In this workspace the script will be executed for each cell (row and column) within selected object (or all if none selected).

5. Found cells

Global properties and function
Variables
Use global scoped variable (such as: window) to make the variables available across iteration.
For example, take a look at the following example:

Functions
In addition to the Translator++ standard library, you can also use the following functions that were created specifically for the iteration framework.
die(lastMessage:string)
Immediately halt the iteration process
Object level iterator
“this” keyword
On object
level, you can access the properties of the current object via this
keyword.
this.file
String: the ID of the current object
this.index
Integer: the current index of iteration
Example
this.maxIndex
Integer: Maximum index of current execution
this.isLast
Boolean: True if the current iteration is the last from the process.
Row level iterator
Execute javascript code for each row of the selected (checked) object in the project.
If no objects are selected then all object will be processed.
“this” keyword
All information of the current data are stored in the this
keyword.
Row level iterator can use all the this
properties from the Object level iterator. In addition, the cell based iterator has the following properties:
this.file
String: Id of the current object
Example
this.rowId
Integer: The index of the row
this.keyText
String: The key text
Example
this.cells
Array: the cells in the current row
Example
this.tags
Array: the tags of the current row
Example
this.parameters
Object: the parameters of the current row
this.context
Array: the context of the current row
this.comments
Array: the comments of the current row. Index of the comments represents its cell id.
Example
Example 1
Remove the new line from all messages. Keep the newline if the first or the last line are not Japanese.
Example 2
Replaces the first line of translated text with the first line of original text
Cell level iterator
“this” keyword
Cell level iterator can use all the this
properties from the Object level iterator and Row level iterator. In addition, the cell level iterator has the following properties:
this.colId
Integer: The index of the cell
this.text
String: The text of the cell
This is a read only property
this.cellCoords
Obj: Coordinate of the cell
Methods
this.setText(string)
Set text into the current cell
Example
Translate found cells with Sugoi Trans (excludes the first or the last row in the message)