FlappleScript

FlappleScript is a C-Level extension for the Mac version of the Flash Authoring tool. It allows you to run AppleScripts. It’s available for download here.

For those curious how the extension came about, read on:

The Mac version of the FLfile object doesn’t support executing applications from the authoring tool, like the Windows version does. I was told so a while back by John Grden, who was at that time working on his Flasc tool and ran into the issue on trying to launch MTASC on the Mac from the Flash authoring environment, without luck.

I thought it shouldn’t be too hard to write an extension for executing AppleScript, using the C-Level Extensibility mechanism. So I tried, but it failed miserably. For some reason, Flash refused to resolve the methods my library was exporting.

On having a closer look at the Sample extension from the Adobe help files, I noticed that it was in fact a old type ’shared library’ in PEF (Prefered Executable Format). As far as I know, that format isn’t used on OS-X any longer; XCode for example isn’t even capable of producing PEF files.

After diving up a very old copy of CodeWarrior for Mac (v.6 – 2001 – the product has been discontinued) and installing it on an equally old G4, I was able to create the desired PEF’ed shared library. After quite a bit of tweaking, this did the trick, and I got it all working.

Quite an experience :)

PS:

If someone from Adobe happens to read this: I’m still curious if the Mac C-Level Extensibility mechanism is supposed to work with contemporary libraries, or with PEF’ed shared libraries only? Perhaps Flash is using GetSharedLibary or GetDiskFragment routines for dynamic binding? If so, getting a .dylib loaded is simply impossible, I think.


About this entry