[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [plt-scheme] AppleEvent question



At 12:00 PM -0500 6/3/02, Matt Jadud wrote:
>Hello,
>
>	First, many thanks for the OSX native build. Very cool.
>
>	I downloaded "Script Debugger" from Late Night Software to browse
>application dictionaries by AppleEvent. This only helps so much; for example,
>for the Finder:
>
>eject: Eject the specified disk(s), or every ejectable disk if no
>parameter is specified (from Finder items)
>«event fndrejct» [«class obj »]  -- the disk(s) to eject
>
>	I don't know how to divine more information about an application than
>this. So, I assume the receiver is "FNDR", the event class is ... "OBJ ", and
>the event ID is "EJCT". I think I've exhausted the combinations of these on
>OSX, and I get the same obscure errors. I scanned through the Mz source, and
>found that I should delve into AppleLand to find out more.
>
>	When I get back to Indiana, I'll hit the web for more info on
>AppleEvents; in the meantime, am I barking up the right tree?

Yes, you're very close to the answer.  First off, searching the web for information on the apple events supported by the Finder is a complete nightmare.  I believe that this information is not deliberately hidden, but rather a part of the body of documentation that appears every few months on Apple's series of Developer CD's, which is received by every Apple developer in the world... except us.  And you.

Second, you're a little mistaken about the specifics of the event you're looking at:
the Finder's descriptor is "MACS" (don't ask me why), the event class (or suite
name) is "fndr", and the event ID is "ejct".  These things are case sensitive, by
the way.

Next, you've found a slightly better tool than the one I have; I usually browse the
dictionary info with the "Open Dictionary" menu in ProjectBuilder, and then I
go to the bits to see the actual descriptor bits, like this:

[localhost:~] clements% cd /System/Library/CoreServices/Finder.app/Contents/Resources/
[localhost:Finder.app/Contents/Resources] clements% /Developer/Tools/DeRez -UseDF Finder.rsrc | less
data 'aete' (0) {
        $"0090 0000 0000 0009 0E53 7461 6E64 6172"            /* .<90>.....<C6>.Standar *
/
        $"6420 5375 6974 6532 436F 6D6D 6F6E 2074"            /* d Suite2Common t */
        $"6572 6D73 2074 6861 7420 6D6F 7374 2061"            /* erms that most a */
        $"7070 6C69 6361 7469 6F6E 7320 7368 6F75"            /* pplications shou */
        $"6C64 2073 7570 706F 7274 436F 5265 0001"            /* ld supportCoRe.. */
        $"0001 000C 046F 7065 6E1C 4F70 656E 2074"            /* .....open.Open t */
        $"6865 2073 7065 6369 6669 6564 206F 626A"            /* he specified obj */
        $"6563 7428 7329 6165 7674 6F64 6F63 6E75"            /* ect(s)aevtodocnu */
        $"6C6C 0000 8000 6F62 6A20 176C 6973 7420"            /* ll..<80>.obj .list  */
        $"6F66 206F 626A 6563 7473 2074 6F20 6F70"            /* of objects to op */
        $"656E 1000 0002 0575 7369 6E67 7573 696E"            /* en.....usingusin */
        $"6F62 6A20 2C74 6865 2061 7070 6C69 6361"            /* obj ,the applica */
        $"7469 6F6E 2066 696C 6520 746F 206F 7065"            /* tion file to ope */
        $"6E20 7468 6520 6F62 6A65 6374 2077 6974"            /* n the object wit */
        $"6800 8000 0F77 6974 6820 7072 6F70 6572"            /* h.<80>..with proper */
        $"7469 6573 7072 6474 7265 636F 8074 6865"            /* tiesprdtreco<80>the */
        $"2069 6E69 7469 616C 2076 616C 7565 7320"            /*  initial values  */
        $"666F 7220 7468 6520 7072 6F70 6572 7469"            /* for the properti */
        $"6573 2C20 746F 2062 6520 696E 636C 7564"            /* es, to be includ */
        $"6564 2077 6974 6820 7468 6520 6F70 656E"            /* ed with the open */
        $"2063 6F6D 6D61 6E64 2073 656E 7420 746F"            /*  command sent to */
        $"2074 6865 2061 7070 6C69 6361 7469 6F6E"            /*  the application */
        $"2074 6861 7420 6F70 656E 7320 7468 6520"            /*  that opens the  */
        $"6469 7265 6374 206F 626A 6563 7400 8000"            /* direct object.<80>. */
        $"0570 7269 6E74 1D50 7269 6E74 2074 6865"            /* .print.Print the */
        $"2073 7065 6369 6669 6564 206F 626A 6563"            /*  specified objec */
        $"7428 7329 6165 7674 7064 6F63 6E75 6C6C"            /* t(s)aevtpdocnull */
                                                                     ^^^^^^^^
        $"0000 8000 6F62 6A20 186C 6973 7420 6F66"            /* ..<80>.obj .list of */
        $"206F 626A 6563 7473 2074 6F20 7072 696E"            /*  objects to prin */
        $"7400 0000 0001 0F77 6974 6820 7072 6F70"            /* t......with prop */
        $"6572 7469 6573 7072 6474 7265 636F 6F6F"            /* ertiesprdtrecooo */
        $"7074 696F 6E61 6C20 7072 6F70 6572 7469"            /* ptional properti */
        $"6573 2074 6F20 6265 2069 6E63 6C75 6465"            /* es to be include */
        $"6420 7769 7468 2074 6865 2070 7269 6E74"            /* d with the print */
        $"2063 6F6D 6D61 6E64 2073 656E 7420 746F"            /*  command sent to */
        $"2074 6865 2061 7070 6C69 6361 7469 6F6E"            /*  the application */
        $"2074 6861 7420 7072 696E 7473 2074 6865"            /*  that prints the */
        $"2064 6972 6563 7420 6F62 6A65 6374 8000"            /*  direct object<80>. */

...

I'm assuming you know that every OS X application is actually a directory with a name
ending in ".app".

The AETE (Apple Event TErminology) resource is the source of the information
that you saw, and also tells you what four-character codes to use, if you inspect
the resource directly.

So, for instance, the Print apple event is in suite "aevt", and the event's descriptor
is "pdoc".  Even more information about the types of descriptors that the thing
accepts as arguments can be divined by a more thorough inspection of this
goop.

Hope this helps,

john clements