Re: accessing a property of an object in AppleScript
Re: accessing a property of an object in AppleScript
- Subject: Re: accessing a property of an object in AppleScript
- From: "Mark J. Reed" <email@hidden>
- Date: Fri, 7 Nov 2008 10:11:11 -0500
On Fri, Nov 7, 2008 at 3:00 AM, Mark Sanvitale <email@hidden> wrote:
> I have a variable/object that is a menu item. I can see it has all of these
> properties. But I cannot ask it anything about its properties (even though
> I can see they are all there) unless I do so within the tell block of the
> application whose dictionary defines the type of object I am attempting to
> query (whereas I naturally looked upon the object/variable as an
> encapsulated, fully-functional thing that I could operate on through the
> script). Maybe that is the explanation?
Indeed. When you get an object from an application, most of the
operations available on that object must be performed by the
application. You have some limited access to see into the object
using AppleScript primitives, but that's it. The "get" operator will
do as much as it can to fully dereference an application object - so
that instead of something that means "the third item of this list over
here", you get the actual value of that third list item - but if the
value is of an application-specific class, you still can't do much
with it outside of a tell block to the application.
I like to think of Applescript programs as web clients, with the
application in the role of the web server, and the values you get back
from the app as cookies. Sometimes you can look at the cookie value
and discern meaningful information directly; for instance, I have a
"last5stocks" cookie from cnn.com, and its value is a simple text list
of the last 5 ticker symbols I looked up via money.cnn.com. But many
times the value is meaningless outside the context of server-side
data; for that same domain I have two flavors of "user id" cookie
whose values are long strings of letters and digits that presumably
serve as nothing but indexes into some database I can't access
directly.
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden