On Sat, 06 Dec 2003 13:36:11 -0500, grimmwerks <[EMAIL PROTECTED]> wrote:
> Anyone else have experience with applescript? I know > Bruce has his xtra, but I'm wondering how difficult it > would be to create a little applescript listener to > get applescript functions from director... These days I am doing about 50/50 Applescript and Director, but never really use them together. Bruce's Xtra is *really* great, exactly what's needed, but the price is bound to put off widespread use which is a real shame. Bruce once complained that sales were 'flat' which doesn't surprise me in the least. It would be trivial for Macromedia to add this functionality to Director. Of course they wont, but not because they're afraid of annoying Bruce. (It just wont sell any more units of Flash). Nowadays we have Applescript Studio on OSX, which makes Director unnecessary for a small but significant set of tasks. It certainly reduces the market for Bruce's Xtra! You should definitely check it out. Consider that you can embed QuickTime movies in your apps, and (through Cocoa) you can even call the Quicktime API directly, which means access to compression and image compositing and all that business. Panther also introduces something a bit like an embryonic 'imaging lingo' for scaling, rotating and converting offscreen images. It's not 'copypixels' but it's not half bad for a system-level tool. <http://www.apple.com/applescript/imageevents/> You can certainly set up an Applescript 'listener' (and by this I assume you mean an application), but talking to it is a bit tricky. There's no obvious Apple event to use. You might be lucky with 'open', but I seem to remember that not working. IIRC, you have to provide a file as an argument, which is not really the best thing for just passing data. One reliable but slow method is to write data to disk, and then have the Applescript app read it. Finally you can use the clipboard to pass data between the two apps, which is quite fast, but pretty ugly. Getting data back to Director (or Projector) was always a matter of using 'do script'. Alas, Director lost the terminology for this event in about version 7, but the event remained at least up to 8.5. (I don't have MX, and don't see any reason to have it either, especially because all the new features are incompatible with Panther). Anyway, you have to code the event using raw or 'chevron' syntax Âevent miscdosc This will almost certainly be mangled before you read it, but it should look something like this <<event miscdosc>>. If you've had more than a litle bit of Applescript experience, you will recognise this format even if you don't really grok it. I don't think you can get a return value from this (try and report back!), but you can at least invoke the lingo 'do' command that way. I'd be very interested in whether you can get 'do script' working under MX. Something tells me it wasn't exactly top of the list of priorities when Director was ported. If 'do script' really is gone, you'll have to use the techniques mentioned above - writing to disk, or using the clipboard. The commands for writing arbitrary data to disk (Applescript's equivalent to fileIO/propSave) are to be found in the 'Standard Additions' OSAX. If you're using Panther you might also get lucky with the new GUI scripting feature, but this is pretty ugly too. It reminds me of some of the system-level GUI macro stuff you see on Windows, or 'QuicKeys'. On one hand it's the only way to automate tasks in non-scriptable apps, on the other hand, it provides absolutely no incentive for developers to make their apps 'properly' scriptable with an object model and all that. How it works with Director - which has no system-level GUI objects apart from the buggy installmenu, I have no idea. See what you can find out. <http://www.apple.com/applescript/uiscripting/> IMNSHO Applescript is the best reason to use Mac instead of Windows. Lingo folks sitting at Macs who don't use it are quite literally wasting their time. OK, it's got that old fashioned hypertalk syntax, but it's also got a bunch of other stuff that Lingo can't shake a stick at. (Exception handling anyone?) I'm certainly interested in where you're going with this and where you end up, so feel free to contact me with any questions or comments which would be off-topic here, and good luck with it! Brennan [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
