Passing a parameter list to a macro

In everyday language, a parameter list is a set of values that direct a program in its work and that an end user specifies when he or she launches the program. For example, if copy is the name of a program that copies a file from the current directory to another directory, then the following command line invocation:
copy MyFile.txt c:\temp
invokes the copy program by name (copy) and specifies a parameter list (MyFile.txt c:\temp) that includes the name of the file to be copied (MyFile.txt) and the destination directory (c:\temp).

Z and I Emulator for Web has a macro feature that works similarly to passing a parameter list to a program when the program is invoked. Before launching a macro, or at the same time as launching a macro, an end user can specify a list of name-value pairs, each pair consisting of a variable defined inside the macro and an initial value that the macro runtime should assign to the variable.

For example, if the macro FileDownload downloads a file from a remote host to the local workstation, and this macro contains the variables strRemoteFile and strLocalFile, then the end user can specify the following parameter list:
strRemoteFile="NewData.123", strLocalFile="MyData.123"
When the end user plays the macro, the macro runtime initializes each of the variables named in the parameter list to the value specified in the parameter list. The macro then downloads the file NewData.123 from the remote host and renames the downloaded file to MyData.123.

Of course, for the above scenario to work, the macro writer must have coded the macro so that it looks in the variables strRemoteFile and strLocalFile for the required information.

In general, the macro writer is responsible for:
  • Creating any variables that are to be used in a parameter list.
  • Having the macro look in these variables for the required information when the macro is launched.
Also, as a part of good programming practice, the macro writer should consider the following actions:
  • Describing the parameter list in the macro description (that is, in the Description input field on the Macro tab of the Macro Editor).
  • Displaying a message to the end user if a variable is improperly initialized.
For more information see Considerations for the macro writer.
The end user is responsible for:
  • Specifying the parameter list correctly.
However, the system administrator can handle the task of specifying the parameter list by pre-defining a parameter list, either:
  • In the session configuration (if the macro starts automatically when the session starts); or
  • In a customized button (created in the main toolbar) that when clicked plays the macro with parameter list.
For more information see Specifying the parameter list.