« MacTipps iPhone appli… | Home | JSON - JavaScript Obj… »

Windows Scripts in REALbasic


For years we have a class to run AppleScripts in REALbasic. Now we also have a class to run Windows Scripts:

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).
05 01 10 - 13:31
three comments

Very interesting…What set of Windows applications can be controlled this way?

Due to licensing issues, I’m interested in controlling the QuickTime Player on Windows from my RB app. Will this new Windows Script capability allow me to interact with the QuickTime Player?
Joe Huber - 05 01 10 - 17:26

Well, I’m not sure what you can script, but on the web you find a lot of scripts:

Maybe you start here:
http://technet.microsoft.com/en-us/scrip..

and for QuickTime you find a note on the bottom here:
http://www.apple.com/quicktime/technolog..
Christian Schmitz - 05 01 10 - 18:05

Christian

You’re amazing! That’s exactly the info I was looking for. Thanks so much.

Best regards,
Joe Huber
Joe Huber - 05 01 10 - 18:37


  
Remember personal info?

Emoticons / Textile


Notify:
Hide email:

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.