How-To create and run scripts

One of the more powerful facilites in XML:Wrench is the facility to construct a script of commands that can be applied, one after the other, to one or more files, in a folder or in a whole set of of folders.

Any command that can be run as a batch command can be included in a script. Commands are executed one after the other. Commands usually apply to files and may output new files. These files can be on the local system or on a remote FTP server.

You can build a script up bit-by-bit. You might start by doing the process manually in XML:Wrench applied to just a single file. Then you could test the same commmand on a give set of files in a folder. You could then create a script with that command. You might then add other commands to the script.

A typical script might first delete all files in some working directories. Then copy files across from other locations on the local file-system. HTML files might be created by transforming XML using a given XSLT style-sheet. Finally the entire output could be uploaded to a web server via FTP.

Scripts are stored in the current project file, so you can define separate scripts for each project.

Running a script

To run a script select Tools|Scripts... from the main menu. You can then choose the script from the dialog:

scripts dialog

You can also use this dialog to add new scripts or edit or delete existing scripts.


Editing a script

To edit a script select it in the Scripts Dialog and then click on the edit button. The Script Dialog then displays a list of the commands in that script.

script dialog

You can add or delete commands and also move command up or down the list. Use the edit button to edit individual commands. This is the same as the dialog for batch commands.