APGen Documentation Previous Topic: Script.StopWait() Next Topic: ScriptArguments.Count Parent Topic: APGen Object Reference    APGen Object Reference
ScriptArguments Object
See Also:

The ScriptArguments object provides access to a collection of argument values.

Syntax

oArguments[ ( index) | .property | .method ]

Object

oArguments A ScriptArguments object.

Collection Parameters

index A zero-based index to the collection.

Properties

Count Integer Returns the number of objects in the collection.
Item Variant Sets/returns an item in the collection.

Methods

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.

Notes

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
     }
...
#%>