The broad steps for creating a Scripting Project are as follows:
|1.||Open the Scripting Editor by clicking the command Tools | Scripting Editor.|
|2.||In the Scripting Editor, open a new scripting project by clicking the New icon in the Scripting Editor toolbar. The Project Settings dialog (screenshot below) pops up. You can also access this dialog by right-clicking a project in the Scripting Project Tree pane (in the top left part of the Scripting Editor window) and clicking the command Project Settings.|
Select either JScript or VBScript in the first combo box and the .NET Framework in the second combo box. To enable higher .NET Frameworks (such as .NET Framework 4.5 on Windows 8), check the Automatically use higher .NET Framework check box. Then click OK. The new Scripting Project is created.
|3.||Click the Save icon in the Scripting Editor toolbar to save the Scripting Project as a .asprj file.|
|4.||A Scripting Project can be considered to be made up of several components that work together. These components will typically be a combination of: Global Declarations, Forms, Events, and Macros. They can be created in any order, but you should clearly understand how they work together. The way each type of component is called and executed is described below. How to create each type of component is described in the respective sections about the component type.|
|5.||After you have finished creating all the required components, save the Scripting Project (by clicking the Save icon in the Scripting Editor toolbar).|
|6.||Close the Scripting Editor.|
|Note:||Right-clicking the Project folder and selecting Project Settings lets you change the scripting language at any time.|
Forms, Event Handlers, and Macros are all created in the Scripting Editor. However, the way they are called and executed is different for each and has a bearing on how you create your scripting projects.
|•||A Form is invoked by a call to it either within a function in the Global Declarations script or directly in a Macro.|
|•||An Event Handler runs when the relevant event occurs in XMLSpy. If an Event Handler for a single event is defined in both the Global Scripting Project and the XMLSpy-project-specific Scripting Project, then the event handler for the project-specific Scripting Project is executed first and that for the Global Scripting Project immediately afterwards.|
|•||A Macro is executed from within the XMLSpy interface by clicking Tools | Macros | [MacroName]. In a Macro, it is possible to access all variables and functions declared in the Global Declarations and to display Forms for user input.|
© 2019 Altova GmbH