Scripting REALbasic through AppleEvents
October 31st, 2007 by Jonathan JohnsonHere is a Halloween treat for our REALbasic-using readers:
At some point you may need to write a tool to script builds in REALbasic. For us, we have something coming down the pipeline in a few weeks that needs to do just this (let the speculations begin!), and I recalled an undocumented feature of the REALbasic IDE that makes things easier for us:
There exists an AppleEvent command of class ‘RBae’ and type ’scpt’. The direct object parameter is a string, which is the IDE Script source code to execute.
Of course, as an undocumented feature, I must stress that this could be removed at any time. The included IDE scripting command line utility is often enough to get the job done. The method described here requires less overhead, but has the downside of being harder to communicate with. (If you must communicate, you can always write a file out by using DoShellCommand. However, if you’re needing to anything beyond something simple, documented ways of doing this are much better.)
I’ll leave you with some sample code. This is all there is to it, enjoy!
Sub RunIDEScript(script as String) dim ae as AppleEvent ae = NewAppleEvent( "RBae", "scpt", "RBv2" ) ae.StringParam("----") = "call BuildApp(8)" if not ae.Send then MsgBox "Error" end if End Sub
January 29th, 2008 at 1:27 am
Hello.
I was going to make application (RbScriptMenu) referring to the article here.
We wish to express our gratitude.