At 09:29 -0800 2002.04.03, Andrew O. Mellinger wrote:
>    But how does the POD relate to a call?  I guess I'm just lacking
>the mapping to be able to turn the POD into calls.  The Mac::Glue pod
>says:
>
>   "The class and data are passed as key-value pairs, like in AE
>records or parameter lists."
>
>    I would expect to be able to do:
>
>my $fndr = Mac::Glue->new("Finder");
>my $obj = $fndr->obj(application => startup_disk);
>print $fndr->get($obj);
>
>    The application is the class, and the startup disk is the data.

The problem is that "startup disk" is not data, it is a property.  "Data"
would be something like obj(window => 1), where "1" is the data and
"window" is the class (first window).  But "startup disk" is a property.
So you might do:

        obj(property => startup_disk => application => 'Finder')

(Though this doesn't actually work, for reasons explained below.)  But
since 'application' is a special class, and there is the aforementioned
prop() method, you can just do:

        prop('startup_disk')


>Looking example at the top of the page, how do I know that "startup
>disk" is a generic property?   Don't I have to get this from the
>application class?

I don't know what you mean by "generic property"; do you mean one that
doesn't need a class expressed?

Just like in AppleScript itself, a property of the "application" class
doesn't need to have "application" mentioned.  If you do 'get startup disk
of application "Finder"' in AppleScript, then you do get the right result,
but if you look at the actual AE sent, it doesn't mention the application
class at all (which is why it doesn't work in Mac::Glue, because Mac::Glue
tries to include the application class, and it fails).  The "application"
class, when specified explicitly, is used like the tell block, to define
the *target* of the event, not the class:

        tell application "Finder"
                get version of application "MacPerl"
        end tell

This will get the version of MacPerl, not the Finder.  But this:

        tell application "MacPerl"
                get startup disk of application "Finder"
        end tell

will not work at all, since MacPerl doesn't understand "startup disk".  Yow!

It's basically a really messed up thing in AppleScript, and you are best if
you know to just leave the class off for properties of the application
class.


>   For some reason I just have hard time getting my head around what
>is a property, class, etc in AppleEvents.

Yes, it is not easy.  :)  Mac::Glue really, somewhat unfortunately, is best
done with a reasonable knowledge of both AppleScript and Apple events, in
order to do it well.  However, once you get Apple events, you'll pick it
all up better, and you'll be able to understand AppleScript itself -- which
IMO is pretty hard to really understand -- quite a bit better.

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

Reply via email to