An Altova Scripting Project consists of the following four major components:
|•||Global Declarations, a component which contains definitions of variables and functions that are available to, and can be used by, all Forms, Macros, and Event Handler scripts in the scripting project.|
|•||Forms, a component which contains all the Forms defined in the scripting project.|
|•||Events, a component which contains Event Handler scripts for all application-based—as opposed to Form-based—events.|
|•||Macros, a component which contains all the Macros defined in the scripting project.|
These components are displayed in and accessed via the Scripting Project Tree of the Scripting Editor (screenshot below).
Given below is a brief description of each of these components.
The Global Declarations component is a script that contains variables and functions that can be used by Forms, Event Handlers, and Macros. The functions make use of the StyleVision API to access StyleVision functionality. Creating a variable or function in the Global Declarations module enables it to be accessed from all the Forms, Event Handlers and Macros in the scripting project.
To add a variable or function, open the Global Declarations component (by right-clicking it in the Scripting Project Tree and selecting Open) and edit the Global Declarations script in the Main Window. In this script, add the required variable or function.
In the Scripting Editor, you can build a Form graphically using a palette of Form objects such as text input fields and buttons. For example, you can create a Form to accept the input of an element name and to then remove all occurrences of that element from the active XML document.
For such a Form, a function script can be associated with a text box so as to take an input variable, and an Event Handler can be associated with a button in Authentic View to start execution of the delete functionality, which is available in theStyleVision API. A Form is invoked by a call to it either within a function (in the Global Declarations script) or directly in a Macro. For details of how to create and edit Forms, see the Forms section.
Event Handler scripts can be associated with a variety of available events in Authentic View. The script associated with an event is executed immediately upon the triggering of that event.
Most events have parameters which provide detailed information about the event. The return value from the script typically instructs the application about how to continue its processing (for example, the application may not allow editing).
An Event Handler runs when the relevant event occurs in the Form. For details about how to create event handlers, see Event Handlers.
Macros are used to implement complex or repetitive tasks. Macros do not use either parameters or return values.
In a Macro, it is possible to access all variables and functions declared in the Global Declarations and to display Forms for user input.
For a simple example of creating a Macro, see Writing a Macro. Also see Running Macros for a description of the ways in which a Macro can be called. A Macro is run from within the StyleVision interface by binding it to an Authentic event and triggering that event
© 2019 Altova GmbH