Scripts for epcEdit are written in the Tcl programming language. In order to write a script, you will need some basic knowledge of Tcl and the TkSGML library. Depending on the task that your script must accomplish, you may need to use some widgets from the Tk widget set to provide a graphical user interface for your script.
The Tcl programming language is easy to learn; several excellent introductions to Tcl are available on the net and as printed books.
A script for epcEdit consists of Tcl commands and procedures that are stored in a script file. Script files for epcEdit reside in the extensions subdirectory underneath the epcEdit library directory.
When epcEdit is started (either by clicking on the epcEdit icon, by invoking the appropriate entry in the program menu, or by entering the epcedit command), it checks the extensions directory for the existence of files with the extension .tcl. Each Tcl file that is found is loaded into epcEdit during the initialization of the program. All Tcl-commands that are contained in the script files are evaluated and all procedures in the script files are defined in this early stage of the program startup process.
The files in the extensions directory are expected to contain Tcl Scripts that add new functionality to epcEdit by providing new features or installation-specific enhancements that are not part of the standard distribution. Because the extension scripts are executed when epcEdit is loaded, almost every aspect of epcEdit can be customized by extension scripts.
There is, however, a class of extension scripts that is particularly useful for augmenting the functionality of epcEdit: Interactive scripts that are run on demand by the user when the menu item Run Script in the Extra menu is invoked.
The remainder of this tutorial describes how such scripts are written and installed . It explains the process of writing, installing, and running an extension script by using a simple example script that creates and displays a list of all elements in the document and the number of times each element occurs in the document.
![]() |