Is it possible to send parameters to a script? I mean, if i hook up a script to execute from say a Meta Key button. can i send parameters that i can then use inside my script to determine what it should do?
Yep, when you start a script from the command line, you can pass values to the predefined global string variables (s0-s9). The format is:
pw5.exe [file.wax | file.was [argument list]]
(from the help file):
This optional argument specifies an ASPECT script file for Procomm Plus to execute. If a .was file is specified, the ASPECT Compiler first compiles the script and upon successful compilation, the associated .wax file is executed. Any arguments following the script name are passed to the script in the predefined variables.
Here's a snippet from elsewhere in the help file (took me a while to dig this up as it's hidden pretty well):
Predefined variables have several uses. If Procomm Plus is executed with a command-line in which the first parameter is a script file name, with either a .was or .wax extension, the information following the filename will be parsed into individual options. Each option will be loaded into a predefined string variable, beginning with S0. Up to 10 options can be passed to the requested script in this manner. The predefined integer variable I0 will contain a count of the parsed options. The script can use the system variable $SCRIPTMODE to determine whether it was run from the command-line, and reference I0 for the number of options provided.
After your script has the values in s0-s9, you can then use commands like atof, atoi, and atol to convert the string to a float, integer, or long value.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.