The script editor is used to edit, interactively debug and run scripts that automate WEAP and connect it with other Windows programs using standard "COM Automation Server" programming techniques. The script editor uses Microsoft's Windows Script technology, which directly supports scripts written in VBScript and JScript (JavaScript). VBScript and JScript come with Windows and are always available, whereas other scripting languages, such Perl, Python, Ruby and PHP, must be installed by you on your computer before you can use them in WEAP.
The script editor is divided into three panes.
At the top left is the edit pane where you edit your scripts. Use the Open button to open a script to be edited. You can open scripts stored in the current area folder ("Area scripts") or in the common "_SCRIPTS" folder ("Shared scripts"). (The area script named Functions.vbs is a special script that can be called using Call without specifying the name.) Use the Save or Save As buttons to save the script. Use the Clear button to delete the current script. The editor also supports standard editing options such as cut, copy, paste, undo, find (Ctrl-F) and find again (F3). Use the Run Script button or press Ctrl-Enter to run the script. The script editor supports integrated debugging. Syntax or run-time errors in the script will cause the script to stop running. The type of error, and the line and column at which it occurred will be reported, and the edit cursor will be placed at the place in the script where the error occurred, helping you to fix the problem. "Autocompletion" for WEAP API classes is available (check the Autocomplete checkbox to turn it on). For example, type WEAP. After you type the dot after "WEAP," a window will pop up, listing all the properties and methods of the WEAPApplication class. Type the first few letters of the item, such as "B" for BaseYear, and the cursor will move down to that item. Hit Enter to add it to your script. Autocomplete works with any WEAP API class. For example, type WEAP.ActiveArea. to see a list of properties and methods for the WEAPArea class.
At the bottom of the window is a PRINT output pane. Any PRINT messages in your script will appear here. You can clear this pane using the Clear button on the right of the pane or by issuing a CLS or CLEAR command in your script.
On the right of the window is a pane with two tabs. These tabs give access to WEAP API objects and to WEAP Branch and variable names, which you may want to include in your scripts. Select an object in the tree and then click the Add button, or double click it, to add it to the edit pane on the left. Bear in mind that in addition to referring to WEAP objects you can also create references to many other COM objects. Many Windows based programs support COM, allowing you to connect WEAP to other programs such as Excel, Word, PowerPoint, etc.
The editor has standard editing functions: Undo (Ctrl-Z), Redo (Ctrl-Y), Find (Ctrl-F), and Find Next (F3).
The script "timeout" is the maximum time a script can run before WEAP asks if you want to stop it. The timeout is useful in cases either of an infinite loop in the script or where the script is taking much longer than expected. The default timeout is 30 seconds and can be changed in the toolbar. This timeout applies to all scripts in the current area. (Each area can have a different timeout value.)
Some other web-based resources you may find useful:
Windows
Script Information
VBScript tutorial
VBScript reference guide
JScript reference guide
Free versions of Python, Perl,
PHP and Ruby
Menu option: Advanced, Scripting,
Edit Scripts
See also: Scripting, Automating
WEAP (API)