|
APGen Object Reference |
|
See Also: |
The ScriptArguments object provides access to a collection of argument values.
| oArguments | A ScriptArguments object. |
| index | A zero-based index to the collection. |
| Count | Integer | Returns the number of objects in the collection. |
| Item | Variant | Sets/returns an item in the collection. |
| Add() | Adds an item to the collection. |
| FindString() | Searches for a string argument containing a substring. |
| Remove() | Removes an item from the collection. |
| RemoveAll() | Empties the collection. |
ScriptArguments objects are returned from Script.Arguments and APGScript.Arguments.
When an APG script is run from the command line (see Executing APG Scripts from the Command Line), the ScriptArguments collection is populated with arguments from the command line. Similarly, when an APG script is run using APGen.RunArgs() or APGScript.RunArgs(), the ScriptArguments collection is populated with all specified arguments.
An iterating control structure can be used to loop through the values of the ScriptArguments collection. In VBScript, use the For ... Each loop. In JScript, use the Enumerator object. The following example loops through the Script.Arguments collection in VBScript.
<%#
Option Explicit
...
Dim arg
For Each arg In Script.Arguments
' Do something with the argument
Next
...
#%>
Equivalent code in JScript uses the Enumerator object to loop through the
Script.Arguments collection:
<%# @LANGUAGE="JScript" #%>
<%#
...
var arg, e;
e = new Enumerator(Script.Arguments);
for (;!e.atEnd();e.moveNext())
{
arg = e.item();
// Do something with the argument
}
...
#%>