In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Ken Williams) wrote:

>    use Mac::Glue ':all';
>    my $ab = Mac::Glue->new('Address Book');
>    my $person = $ab->obj( people => whose(AND =>
>         [[ first_name => begins_with => 'Smorgasbord' ],
>          [ last_name  => equals      => 'Milhouse'    ]] );
> 
> the $person object is absolutely nuts.  It's got about a million 
> key-value pairs that look like this:
> 
>         bless( {
>                'GLUE' => bless( {
>                                 'IDS' => {
>                                          'mbox' => {
>                                                    'name' => 
> 'mailbox_url'
>                                                    },
>                                          'JPEG' => {
>                                                    'name' => 
> 'jpeg_picture'

First, note that GLUE is just a reference to the $ab object.  It's not 
specific to $person.

So how this works is that all Apple event dictionaries inherit from the 
installed "dialect" (and can also include other dictionaries, via OSAX).  So 
in Script Editor, you can do:

   tell application "Finder"
      get (count of items) as square kilometers
   end tell

There's really no way to know which enumerations, classes, etc. that a given 
dictionary might use, so we suck them all in.

Yes, this can cause some problems with bloat, which is why many longtime 
AppleScript developers will caution you about not installing OSAX you don't 
need or aren't using.

See _merge_classes and _merge_enums in Mac::Glue if you're curious on the 
details.  I tried various methods of optimizing it, but nothing seemed to 
help, that I tried, without adding more complexity for no significant gain.

See gluedoc -d AppleScript and gluedoc -a StandardAdditions for the most 
common stuff that's slurped into each glue.

> Is this, like, every four-letter Apple ID that has ever lived?  Or can 
> I really find out how many degrees Kelvin my friends are?

   tell application "Address Book"
      get (count of people) as degrees Kelvin
   end tell

==>

   degrees Kelvin 614.0

:)

-- 
Chris Nandor                      [EMAIL PROTECTED]    http://pudge.net/
Open Source Development Network    [EMAIL PROTECTED]     http://osdn.com/

Reply via email to