All scripts and scripting information created in the Scripting Editor are stored in Altova Scripting Projects (.asprj files).
You can create any number of Altova Scripting Projects. After a scripting project has been created, it can be used in the following ways:
|•||It can be set as the global scripting project for XMLSpy. Scripts in the global scripting project can then be called from within the application, and macros of the Global Scripting Project can be used for all XMLSpy projects.|
|•||It can be assigned to an XMLSpy project (as an application project). When an XMLSpy project is open in XMLSpy, scripts in the associated scripting project can be called.|
Your XMLSpy package contains a sample scripting project called SampleScripts.asprj. This file contains global declarations for a few standard tasks and is located in the folder: C:\Users\<username>\Documents\Altova\XMLSpy2019\Examples.
The global scripting project of an application is set in the Scripting tab of the Options dialog of XMLSpy (screenshot below, Tools | Options).
To set a global scripting project for XMLSpy, check the Activate Scripting check box and then browse for the Altova Scripting Project (.asprj) file you want. You can also specify: (i) whether Auto-Macros in the scripting project should be automatically executed when XMLSpy starts, and (ii) whether application event handler scripts in the project should be automatically executed or not; check or uncheck the respective check boxes accordingly.
|Note:||Nested script execution is possible, i.e. Macros can call other macros, and events are received during macro, or event, execution.|
Assigning a scripting project to an XMLSpy project
A scripting project is assigned to an XMLSpy project as follows:
|1.||In the XMLSpy GUI, open the required application project.|
|2.||Select the menu command Project | Script Settings. The Scripting dialog (screenshot below) opens.|
|3.||Check the Activate Project Scripts check box and select the required scripting project (.asprj file). If you wish to run Auto-Macros when the XMLSpy project is loaded, check the Run Auto-Macros check box.|
|4.||Click OK to finish.|
|Note:||To deactivate (that is, unassign) the scripting project of an XMLSpy project, uncheck the Activate Project Scripts check box.|
© 2018 Altova GmbH