Re: Trouble Getting Into AppleScript
Re: Trouble Getting Into AppleScript
- Subject: Re: Trouble Getting Into AppleScript
- From: Christopher Nebel <email@hidden>
- Date: Mon, 1 Nov 2004 19:35:43 -0800
On Oct 30, 2004, at 4:41 AM, Daniel Todd Currie wrote:
I'm having just a little trouble figuring out some basics in
AppleScript (pardon my undoubtedly droll questions).
I have a script like this, that works perfectly:
set abApp to application "Address Book"
set versionNumber to version of abApp
The event log reads:
tell application "Address Book"
get version
"3.1.2"
end tell
However, I go into the "Address Book.asdictionary" and look up some
application properties in the Address Book Script Suite, and
haphazardly choose "selection". My previous success means to me that
I should be able to do the following:
set abApp to application "Address Book"
set selectionList to selection of abApp
This generates an NSCannotCreateScriptCommandError, whatever that
means. What am I missing here?
A "tell" block targeting Address Book. The same word doesn't always
mean the same thing in AppleScript; the "tell" context matters. This
is, shall we say, less than ideal, but that's how it works. (The
complete answer has to do with how your script source gets translated
into Apple events, specifically, the internal codes used.)
On a side note, if there is a "selection" property, why isn't there a
"set selection" command? Perhaps I can set the value of the selection
property?
Got it in one. Properties may be "get" or "set", e.g., "set the
selection to ...". (Unless they're marked read-only, of course.
Version, for instance.)
--Chris Nebel
AppleScript Engineering
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden