RunRexxScript -- run an ARexx script from file or memory (V2.5)
res$ = RunRexxScript(script$[, nofile])
AmigaOS and compatibles only

You can use this function to run the ARexx script specified in script$. Additionally, you can also run ARexx code directly by setting the optional nofile argument to True. In that case, script$ must not be a path to an ARexx script but must contain the ARexx code to execute. The function will return the result from the ARexx script. The return value will always be a string - even if it contains just a number. If ARexx does not return anything, you will receive an empty string.

You have to start RexxMast prior to using this function. It is, however, not necessary to create a Rexx port in order to use this function. This function works also if your script does not have a Rexx port. The script will always be started with "REXX" being the host port. Thus, if you want to address an other port, you have to use the "ADDRESS" command of ARexx first.

If you use this function to start external ARexx scripts, make sure that the first line of your ARexx script is a comment. Otherwise you will receive a "program not found" error. As a matter of syntax, the first line of all ARexx scripts must be a comment.

path to an external ARexx script or ARexx code directly; in the latter case, nofile must be True
optional: False is script$ contains a path to an ARexx script and True if script$ is ARexx code (defaults to False)
return value from ARexx; this is always a string
The above code runs the script "dh0:MyScript.rx".

r$ = RunRexxScript("SAY 'Hello'\nRETURN 5\n", True)
The above code prints "Hello" to the console and returns 5 to Hollywood. The variable r$ thus will contain "5" after the call.

Show TOC