OpenTM2 Scripter GUI



What is OpenTM2?

OpenTM2 is an open-source computer-aided translation system that assists translators when translating texts from one language to another.

What is the OpenTM2Scripter?

The OpenTM2Scripter tool was mainly developed to test the OpenTM2 API-call layer. However, since the tool can call any of the OpenTM2 API driven by a simple script file, it can be used toautomate most of the OpenTM2 tasks too (e.g. import translation memories, create folder etc.). This allows even less technically oriented translators to quickly create automated tasks.

What is the OpenTM2ScripterGUI?

The OpenTM2ScripterGUI is a graphical tool to manage, develop and run scripts created for the OpenTM2Scripter.exe. It can also generate process-reports. The OpenTM2ScripterGui was developed to make the scripting for the OpenTM2Scripter faster, more user-friendly and it allows to create scripts in a safe way.

Use of XML

The OpenTM2ScripterGUI requires a dedicated file format which is XML.

A comparison of the „Standard Script format“ vs. the „XML format“:

Standard script file
XML file
DEFINE constant_1, Example_Folder

<?xml version=“1.0“ encoding=“UTF-8“?>

    <function name=“Define“ id=“43“   
            <param name=“name“ id=“0“>     
            <param name=“value“ id=“1“>
    <function name=“Eqfcreatefolder“ id=“1“ 
    command =“EQFCREATEFOLDER“>
            <param name=“folder“ id=“0“>     
            <param name=“description“ id=“1“>

The benefit of the XML-based script syntax is a more user friendly style of scripts based on XML-standards. The XML-files can be edited using any (XML-) editor supporting XML-files.

XML Script Workflow

A transformation from XML-scripts into „standard-scripts“ and from “standard-scripts“ into XML-scripts has been developed too. The OpenTM2Scripter GUI uses XML-scripts for the internal script handling.

The following workflow shows how the different file types interact.

„Standard“ script files can be imported into the OpenTM2ScripterGUI and are automatically transformed into XML-files. The original standard script file will not be changed, and the newly created XML-file is saved into the workspace of the OpenTM2ScripterGUI.

XML-files can be created and edited using the OpenTM2ScripterGUI, and they will be saved into the OpenTM2ScripterGUI workspace.

Running an XML-file in the OpenTM2ScripterGUI, means that the XML-file will be automatically transformed into a „standard script-file“ and the „standard script-file“ will be processed by the OpenTM2Scripter.exe.

The Settings Window

Configuring the settings of the OpenTM2ScripterGUI is done in the „Settings“ window. Open the Settings-window via File -> Settings.

Location of Logfile: The OpenTM2Scripter.exe is accessed via a DOS-Command line call, where parameters can be assigned. In the OpenTM2ScripterGUI the location of the logfile is stored in the settings, and it gets assigned to each call. In order to select a file, press the button „Select File“, then select the file and finally click the button „Open“.

Directory for Scripts: This directory is the „workspace“ of the OpenTM2ScripterGUI. All XML-files and all transformed scripts are strored into this directory. In order to select a directory, click the button „Select Folder“, then select the file and finally click on „Open“.

Location of Singlecommand: per defaut this is „eqf_xml/einzelbefehle.xml“, and it should only be changed in case the OpenTM2Scripter has been changed, because the OpenTM2ScripterGUI derives all information about the script-commands from this xml-file. In order to change the location, click the button „Select File“, then select the file and then click on „Open“

Directory for Source Scripts: „Standard“ scripts are stored in this directory as soon as they are imported to the OpenTM2ScripterGUI workspace. In order to change the folder, click the button „Select Folder“, then select the folder and finally click on „Open“.

Location of OpenTM2Scripter.exe: The OpenTM2ScripterGUI processes all files by calling the OpenTM2Scripter.exe. Therefore the path to the OpenTM2Scripter.exe must allways be set correctly, and can be changed in this place. In order to change the file press the button „Select File“, then select the file and finally click on „Open“.

Changes in the settings are saved by clicking on the button „Save and Close“. In order to leave the settings panel without changing the settings, click on button „Discard changes and Close“.

Creating a Test Suite


The panel „CreateTestSuite“ is devided into 3 parts:

  1. The left hand side of the panel contains all elements such as „API-commands“, „logical commands“ and „control structures“. These elements are models and do not have any parameters. The elements can be „dragged & dropped“ into the actual script, and then filled with parameters.
  2. The middle part of the panel contains the script that is actually created or modified. Commands (models) can be „dragged & dropped“ into the actually created or updated script-file:
    • Drag the command from the left hand side and drop it on the script-name.
    • In order to get a command into a control structure (e.g. if, else, for), drop it on the control structure.
    • The buttons „Move Item up“ and „Move Item down“ are used to move the commands up and down.
    • Clicking the button „Edit Item“ or double-clicking on the command, a new window openes, where parameters can be added to the command.
    • Clicking on button „Delete Item“ deletes the selected command.
    • Clicking on button „Save“ saves the actual script.
  3. The right hand side of the panel contains all created scripts. A script can be opened in the middle part of the panel by a double-click on the script name.
    • Clicking on column „File“ or column „Last Modified“ sorts the scripts.
    • The button „New“ creates a new script-file.
    • The button „Import“ imports a standard-script file and automatically transforms it into XML (see XML Workflow).
    • The button „Delete“ deletes the selected script.

Creating Script-Files

In order to create a new XML-script-file, click the button „New“ on the right hand side of the panel. A „Save?“ dialog is opened, and to save the actual opened script-file click on „Yes“. In the following dialog the name of the script can be entered and confirmed by clicking on the button „OK“. The script is displayed in the middle part of the panel. It can be filled with commands, and then saved in order to get it strored into the workspace.

Importing Script-Files

In order to import standard script-files into the workspace, press the button „Import “. Select the script-file and click the button „Open“. Enter a name for the new XML-file and click the button „OK“. The standard script is transformed into XML, and displayed in the workspace. It can be editet (opened in the middle part of the panel) by a double-click.

Build new scripts using imports

New scripts can be build using existing scripts in the workbench. The existing scripts can be added to an opened script via „drag and drop“ from the table on the right hand side into the tree in middle part of the panel.

There are two different import-options:

  1. The use of a standard import command or
  2. the integration of the content of the imported script into the currently opened script tree as a copy.

Running a Test Suite

XML-scripts and “Standard“-scripts can be processed in the panel „Run Test Suite“.

The left hand side of the panel contains the XML-Scripts contained in the workspace. To process a script, select a script from the list and press the button „Run“. In order to process a standard script-file, click the button „Select File“, then select the standard script file, click the button „OK“ and finally click the button „Run“. In order to stop a running proccess (e.g. in case of an „endless loop“) click the button „Stop“.

On the right side of the panel, the OpenTM2ScripterGUI can display the output of the OpenTM2Scripter.exe (usually shown in the DOS-Command line box).

Reports about the last processed script-file can be generated by clicking on the button „Generate Report“. There are tree report-options (shown on the right hand side of the button):

  1. Status shows the total count of all ERRORS
  2. Small Report shows all ERRORS and their line numbers
  3. Big Report shows the output of the OpenTM2Scripter.exe, the ERRORS and their line numbers.

In order to save the script into a file, press the button „Save Report“.

Possible Improvements

  • the forms for the parameters could be more user-friendly (optionsbox for the options, optionsbox for variables, checking for constants etc.)
  • the reports could be improved (Call-Parameters for the OpenTM2Scripter.exe, more than one executable script etc.)