Windows Scripts in REALbasic
dim w as new WindowsScriptMBS
// First try VBScript
w.Language = "VBScript"
dim lines(-1) as string
lines.append "Function Test(a,b)"
lines.append "Test = a+b"
lines.append "End Function"
w.AddCode Join(lines, EndOfLine.Windows)
dim p(-1) as string = array("Hello ", "World from VBScript")
dim x as string = w.Run("Test", p)
MsgBox x
// Second try JScript
w.Language = "JScript"
redim lines(-1)
lines.append "function Test(a,b)"
lines.Append "{"
lines.append "return a+b;"
lines.append "}"
w.AddCode Join(lines, EndOfLine.Windows)
p = array("Hello ", "World from JavaScript")
x = w.Run("Test", p)
MsgBox x
Exception e as WindowsScriptErrorExceptionMBS
MsgBox "Exception: "+e.message
So you can run them with JScript (JavaScript) or VBScript (Visual Basic Script).