Tuesday, 02/18/03
Over at Daring Fireball I just noticed a charming Safari detail -- the HTML title attribute (hover over that link) is rendered in the status bar at the bottom of the screen, prepended to the target URL. Most other browsers either replace the target URL with the title, or make you wait a second or three for a tooltip to pop around. This is way better, assuming you've overridden the Safari default that leaves the status bar hidden. 12:22PM «
This morning I got it licked. No puppies were injured.
Apple events consist of long sentences made up of four-character codes which are sometimes, just for variety, substituted for ostensibly more expressive C constants. On one hand, the constants are a help, because they provide human context, but on the other they are an immortal pain, because they add another level of indirection. Disassembled code (like Apple events caught in the wild by debuggers) bears little overt resemblance to much documentation.
Often the four-character codes try to pack in some human-accessible meaning, but with only the four characters to pick from, eventually you run into abominations like the ubiquitous "direct object specifier", which appears in most AEs you're likely to see, and looks like four dashes. My whole problem was that I was neglecting to quote them, or use the "keyDirectObject" constant, which would have amounted to the same thing.
I found myself referring to Apple's infuriatingly terse Carbon AE reference, the more verbose but long-pre-Carbon Inside Macintosh IAC reference (featuring code samples in Pascal), the AEGizmo technote, the Cocoa programmer's AppleScript terminology glossary, various AE.framework header files, Jens Alfke's AEGizmo sample code, the invaluable Script Debugger demo, and Matt Neuburg's first-edition REALbasic: The Definitive Guide, which contains the best-written treatise on Apple events of my acquaintance, notwithstanding code samples in a language I like even less than Pascal. To get where I am now, I needed the last day and at least one critical piece of information from each of the above, plus several nuggets of Google spelunkery like this macosx-dev thread, containing a fully formed AEPrintDesc to AEBuildAppleEvent translation.
Developer usability aside, Apple Events and AppleScript are two of the more profoundly useful technologies Apple's ever disgorged, and it drives me nuts to see Mac apps that neglect them. With a taste of what they went through, I have a deeper appreciation of developers who do the work to get it right. 11:46AM «
Bits pushed by Movable Type