Hello
I was perusing the System Browser and came across an number of AppleScript classes under the VMConstruction-Applescript category. What are these for? Are they really only intended to be used by those maintaining Squeak and who are building the VM?
Reading the source code It seems that one can compile and execute scripts from within Squeak. How does the performance of executing such scripts compare to compiled AppleScripts running in the Finder? With these or any third party projects can the scripts within Squeak be pre-compiled (as opposed to compiling them at run-time) so that they run faster?
In addition, I'm wondering in what capacity is it possible to communicate with AppleScripts which exist outside of the Squeak image?
For instance, as a result of compiling and executing a script within Squeak, can info be sent back from a script (or scriptable application) existing outside of the Squeak image. i.e.- What's the level of interaction possible? Can results be returned from calls to individual handlers of a script/script objects? Or from individual commands or property access attempts sent to an application?
Moreover, is it possible to script Squeak objects with AppleScript? Apparently, Apple has implemented hooks in it's version of Java so that one can script Java applications. In a similar manner, I was wondering if it were possible to script Squeak projects or objects with compiled AppleScripts? In other words, communicate with the squeak environment from outside using AppleScript?
Thanks,
Anthony
__________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com
On Thu, 1 May 2003, Anthony Adachi wrote:
I was perusing the System Browser and came across an number of AppleScript classes under the VMConstruction-Applescript category. What are these for? Are they really only intended to be used by those maintaining Squeak and who are building the VM?
Nope. Heck, I didn't even know that's what it was used for! I use AppleScript for a bunch of stuff from within Squeak for integration with the Mac OS. E.g., since I'm the kind of whacko who likes to run Squeak fullscreen and use it for most of my environment, I wrote some code that gave me a menu of OS X apps running and web browser windows, so that I could easily switch between OmniWeb and Squeak without having to leave the Squeak experience entirely.
Reading the source code It seems that one can compile and execute scripts from within Squeak. How does the performance of executing such scripts compare to compiled AppleScripts running in the Finder? With these or any third party projects can the scripts within Squeak be pre-compiled (as opposed to compiling them at run-time) so that they run faster?
No clue... All the AppleScripting I do from within Squeak is pretty simple, I don't use it for doing math or anything computationally intensive.
In addition, I'm wondering in what capacity is it possible to communicate with AppleScripts which exist outside of the Squeak image?
In what way? With the Applescript class in Squeak, you basically get one core action: Applescript>>#doIt:, which evaluates an AppleScript string. You pass the doIt: method regular AppleScript code- it's not like using an AppleEvents package with Perl, TCL, etc... You can use it for anything you'd have other AS scripts for, including calling other AppleScripts.
The idea is that you evalate Applescript doIt: 'somecode goes here' and what is returned from AppleScript is returned to you in a string. If you ask it what 4+4 is, you get a string with '8'; if you ask it what the names of the Safari windows are, you get an AppleScript-formatted literal array containing the window titles. You can then parse this string or do whatever you need to do to get at the info.
For instance, as a result of compiling and executing a script within Squeak, can info be sent back from a script (or scriptable application) existing outside of the Squeak image. i.e.- What's the level of interaction possible? Can results be returned from calls to individual handlers of a script/script objects? Or from individual commands or property access attempts sent to an application?
Whatever is returned by AppleScript ends up back in Squeak. This return string can come from AppleScript or the app being scripted.
There is no existing ways for certain AppleScript messages to be delegated to certain handlers, but setting something like that wouldn't be all that complex. The way it works now is that whenever the AS code chunk returns, the return string is given to whatever is taking the result of (Applescript doIt: someCode). Simple as that.
Moreover, is it possible to script Squeak objects with AppleScript? Apparently, Apple has implemented hooks in it's version of Java so that one can script Java applications. In a similar manner, I was wondering if it were possible to script Squeak projects or objects with compiled AppleScripts? In other words, communicate with the squeak environment from outside using AppleScript?
I don't think there is anyway currently to have AppleScript call into Squeak as-is. *However,* using the XML-RPC or SOAP stuff that comes with the OS X version of AppleScript and XML-RPC or SOAP classes easily installed through SqueakMap, you could write a framework for scripting apps that is callable through XML-RPC or SOAP. If your application already had the ability to be scripted through another means, adding XML-RPC or SOAP would be pretty easy to do, a fairly simple wrap job provided your app scripting API didn't need to return complex squeak objects.
Regards, Aaron
Aaron Reichow :: UMD ACM Pres :: http://www.d.umn.edu/~reic0024/ "civilization is a limitless multiplication of unnecessary necessities." :: mark twain
squeak-dev@lists.squeakfoundation.org