OpenTM2 is an open-source computer-aided translation system that assists translators when translating texts from one language to another.
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.
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.
The OpenTM2ScripterGUI requires a dedicated file format which isÂ XML.
A comparison of the â€žStandard Script formatâ€œ vs. the â€žXML formatâ€œ:
|DEFINE constant_1, Example_Folder
EQFCREATEFOLDER Param1, Param2...
|<?xml version=â€œ1.0â€œ encoding=â€œUTF-8â€œ?>
<script> <function name=â€œDefineâ€œ id=â€œ43â€œ command=â€œDEFINEâ€œ> <params> <param name=â€œnameâ€œ id=â€œ0â€œ> constant1</param> <param name=â€œvalueâ€œ id=â€œ1â€œ> Example_Folder</param> </params> </function> <function name=â€œEqfcreatefolderâ€œ id=â€œ1â€œ command =â€œEQFCREATEFOLDERâ€œ> <params> <param name=â€œfolderâ€œ id=â€œ0â€œ> Param1</param> <param name=â€œdescriptionâ€œ id=â€œ1â€œ> Param2</param> ... </params> </function> </script>
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.
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.
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.
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â€œ.
- 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.
- 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.
- 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.
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.
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.
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:
- The use of a standard import commandÂ or
- the integration of the content of the imported script into the currently opened script tree as a copy.
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):
- StatusÂ shows the total count of all ERRORS
- SmallÂ ReportÂ shows all ERRORS and their line numbers
- 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â€œ.
- 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.)