Installing and using #OmegaT scripts (Reblog/Translation)

I meant to write a short article about OmegaT script basics for a long time, but never found time to do so. This mishap got fixed without me, and out of gratitude I’m posting my translation of Gli script di OmegaT by LanguageLane.


OmegaT scripts

This is the first article in a series that is going to present some features and usage techniques of an advanced computer assisted program OmegaT. Let’s start with scripts, which are a very useful piece of software and can be thought of as a way for OmegaT script writers to add new functionality to the program and make it capable of performing operations that are not (yet) implemented by the developers. This article describes how to load scripts in OmegaT and shows where to find useful scripts created by OmegaT users.

What are scripts and how do they work?

Installing Scripting feature in OmegaT

Using a script

Where to find OmegaT scripts?

Assigning a shortcut to a script

What are OmegaT scripts and how do they work?

A script is a text file that contains programming instructions to perform certain actions withing OmegaT. One can expand OmegaT capabilities by the use of scripts. Script writers can create scripts capable of performing various types of actions: replacing text in target segments, saving files that contain only certain segments, controlling translated text in different ways, exporting the entire project translation memory, or only a part of it, etc.
OmegaT scripts are located in one particular folder (which may or may not be inside the OmegaT installation folder). When you run a script, OmegaT searches for its code in the folder with the scripts, and executes it.

Installing Scripting feature in OmegaT

Depending on the OmegaT version installed on your computer, it might be necessary to add the Scripting functionality via plug-in. Currently, OmegaT is available at  www.omegat.org website in two versions: Standard (2.6.3-08) and Latest (3.0.8). I recommend using the latest version because of its feature-richness, and this version is well tested and thoroughly checked. Its only drawback compared to the standard version is that the documentation is not up to date and user guide doesn’t include all the details. In the latest version the scripting functionality is preinstalled, so there is no need to install anything extra. But in the standard version the scripting functionality needs to be installed as a plug-in. Let’s see how to do it.

Installing the scripting functionality (only for those who have installed the standard version of OmegaT)

  1. Go to http://sourceforge.net/projects/omegat-plugins/files/OmegaT-Scripting/
  2. Select the most recent version (currently it’s OmegaT update3 2.5.0 and later)
  3. Select the zip file OmegaT-Scripting_x.x.x.x.zip (where x‘s indicate the version number). Caution: Do not download OmegaT-Scripting-src_x.x.x.x.zip, since this file contains Scripting plugin source code and is intended for use by scripting functionality developers.
  4. The downloading of .zip will commence. Select a folder on your computer where to save this .zip file
  5. Unzip the downloaded .zip file into plugin folder located inside the OmegaT installation folder (for example C:\Program Files\OmegaT\plugins).
  6. Launch OmegaT. Now under Tools menu you’ll find a new item that says Scripting…

At this point it becomes possible to use scripts.

Using a script

Scripting window

To use a script:

  1. Click ToolsScripting…
  2. Select the script you want to run in the list on the left. The top horizontal part of the windows shows you the text of the script, while the bottom horizontal part will contain messages printed during and after script execution.
  3. If needed, set some parameters in the script’s code (for example, in the script “Search and Replace” you must specify strings to search for and to replace with.)
  4. Click on the Run button to run the script.
Importing new scripts to the Scripting:
  1. Download the script you want to a folder on your computer (or if you know how to write them yourself, write one ad hoc).
  2. Click ToolsScripting…
  3. The Scripting window will open.
  4. In the upper part of the window there is a field Scripts folder that shows the path to the directory where OmegaT searches for the scripts to display.
  5. Open this scripts folder path by the means of your operating system (to do this, you can select the path in the Scripting window, copy it, and then paste it into the address bar of your File Manager).
  6. Copy the new script into that folder.
  7. One of the quickest options to update the script list in the Scripting window is to click Choose… button and re-select the path to the folder that contains the scripts. The new script will appear in the script list displayed in the left part of the window.

Where to find OmegaT scripts?

A good number of OmegaT script is automatically installed during the installation of OmegaT itself. So for most common operations you may not need to download and install anything extra.
A terrific source of new scripts is Kos Ivantsov’s blog Translator’s Recipes. This blog contains many useful scripts written by Kos.

Assigning a shortcut to a script

Assigning a shortcut to a script

OmegaT allows you to assign keyboard shortcuts to scripts to be able to invoke them quickly from the main window without needing to go to Tools → Scripting…

To do this, perform the following steps:

  1. Click menu Tools → Scripting…
  2. The Scripting window will open.
  3. In the list on the left select the script you want to assign a keyboard shortcut to.
  4. In the lower part of the window, right click on one of the buttons with numbers.
  5. Select the option Add script. The selected number will be bracketed by two angle brackets (<3>, for example).

Keyboard shortcut for running a script

From this point the selected script can be invoked by pressing CTRL+SHIFT+Fn, where n is the selected number. In the example on the screenshot it is CTRL+SHIFT+F3.

About these ads

3 thoughts on “Installing and using #OmegaT scripts (Reblog/Translation)

  1. Pingback: (CAT) - Installing and using #OmegaT scripts (R...
  2. Pingback: (CAT) – Installing and using #OmegaT scripts (Reblog/Translation) | Translator’s Recipes | Glossarissimo!
  3. Pingback: Installing and using #OmegaT scripts | Translat...

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s