| |||||||
|
|
|
ABOUT APPLESCRIPT SUPPORT |
|
PowerGlot is mostly scriptable and recordable. ÒMostlyÓ means that most important actions can be started from AppleScript, and most important elements (like databases, text items and glossaries) are defined as AppleScript objects.
Manipulating AppleScripts can sometimes be complex. This is the reason why some sample scripts are provided in the ÒSample AppleScriptsÓ folder. If you want to start scripting PowerGlot, you should have a look at these scripts, and even copy them and use them as a starting point for your own scripts.
The following paragraph describe the basic objects supported by the software. The dictionary is fairly complete and should be sufficient for skilled AppleScript developers.
|
|
RECORDING |
|
The main purpose of recordability in PowerGlot is to provide script developers with a skeleton for more advanced scripting. By recording your actions, you can generate an AppleScript that can be used as a basis for a complex script.
To start recording a working session, launch the Script Editor application (provided with MacOS). Click the Record button, then start working in PowerGlot. When you are finished, go back to Script Editor and click the Stop button. You can now use the recorded script as a basis to build your own script.
|
|
THE DICTIONARY |
|
You can explore the dictionary by dropping PowerGlot on AppleÕs ScriptEditor (or on your preferred script editor). A number of objects and commands are supported by the software. You can access the standard objects (application, window, document), as well as objects specific to the software (database, glossary, term, text item, work file). These objects are shortly described below.
|
|
THE DATABASE OBJECT |
|
An opened database can be accessed from AppleScript by refering to a database object, using its name or index in the total number of open databases. A database contains two kinds of sub-objects: text items, which represent each text item in the database, and work files. Note that you can only access text items in the current text container of the database. To access text items in other containers, you must change the Ôcurrent containerÕ property first.
You can access and modify text items, but not add or delete them (this would not make sense, because all text items come from a work file).
|
|
THE TEXT ITEM OBJECT |
|
Each text item in the current text container of a database can be accessed. From AppleScript, you can access the source and translated text, change the translation, and also access additional information like the file, resource type and ID this item comes from.
|
|
THE GLOSSARY OBJECT |
|
A glossary object represents each glossary open in PowerGlot. It containers term objects, representing each term in the glossary. Using an AppleScript, you can easily create glossaries and populate them with terms. Sample scripts show you how to import glossaries into PowerGlot and export PowerGlot glossaries to text files.
|
|
THE TERM OBJECT |
|
A term object represent a term in a glossary object. Terms can be modify or deleted, and new terms can be created. See the sample AppleScripts for examples of automated glossary creation.
|
|
THE WORK FILE OBJECT |
|
Each work file in a database is represented by a work file object. You can only read properties of work files, which are actually limited to their name and alias. Accessing the alias can help you find where the original files in a database are located.