The RunScript command is used to execute script subroutines that were loaded into the VBScript engine with the LoadScript command.
The RunScript dialog box will only display a list of loaded subroutines containing no arguments. Thus, if you attempted to load the following script file using the LoadScript command:
Sub Test1()
MsgBox "Test1"
End Sub
Sub Test2(strMessage)
MsgBox strMessage
End Sub
Function Test3()
MsgBox strMessage
Test3 = strMessage
End Function
Only the "Test1" subroutine will appear in the RunScript dialog box for it is the only procedure declaration that is a subroutine that contains no arguments. Note, the procedures "Test2" and "Test3" are loaded and usable by other VBScript subroutines or functions. The just are not visible through the RunScript dialog box.
As is the case with most Rhino command, the RunScript command can be scripted, thus bypassing the interactive dialog box. To script the RunScript command, simply precede the command name with a hyphen when entering the command on Rhino's command line. For example:
-RunScript
After entering the command, you will be prompted to enter the name of the loaded script subroutine to run.
The RunScript command can also be assigned to command aliases or to a toolbar button. When assigned to a toolbar button, the RunScript command can execute subroutines that have already been loaded by the LoadScript command, or it can execute raw VBScript code. To embed raw VBScript code on a button, make sure to surround the code with an opening and closing parenthesis.