I need to run a VBScript batch file and I need to pass in two parameters at runtime. I use WScript.Arguments to retrieve the parameters. When I use the Run Script action, I get the following error when I run that action:
Error Executing script : OnExecute Microsoft VBScript runtime error Object doesn't support this property or method: 'WScript.Arguments'
When I use the Execute Program action and use cscript to run the script, it works normally. Is this a limitation of the Run Script action?
Thanks for your post. The WScript singleton object is a creation of the CScript runtime environment, so unfortunately it's not available inside FinalBuilder. This is more or less the only difference between the two environments.
Actually, FYI we provide one or two shortcut methods to help copy-and-pasting scripts (ie WScript.Echo maps to Action.SendLogMessage and WScript.Sleep also works, but the other methods don't work.
I'm not sure how you'd get the parameters in on the command line anyhow, because FinalBuilder will see them as FB command line parameters and will fail if they are not valid.
If you need to pass in parameters to your script, you can use the /VVariableName=VariableValue syntax to set a FinalBuilder project variable value on the command line (separate variables can be separated by semicolons.)
Then you can just read them in your script as global variables, or by using the FBVariables.[VariableName] syntax.
That was helpful, but I'm not sure what you meant about the problem with passing parameters to the script. I had no problems passing in parameters with the Execute Program action. That's what I like about FB, there's usually more than one way to accomplish any given task.