In article <
fa557c68-057d-456f...@googlegroups.com>,
Sven <
sven.b...@gmail.com> wrote:
> But just out of curiosity and for the sake of understanding AppleScript
> better: why is it that it requires curly braces {} for this expression to
> work?
It shouldn't be needed AFAIK. It looks like a bug.
And what 'type' of variable is apers, that it requires to use 'contents
> of ...'?
If you run :
tell application "Address Book"
set p to people 1 thru 2
repeat with apers in p
end repeat
class of apers
end tell
you should get "person". Actually, it's not "person", it's a reference
to an item in a list, as illustrated by :
tell application "Address Book"
set p to people 1 thru 2
repeat with apers in p
end repeat
apers
end tell
Here you should get "item 2 of {person ID ... , person ID ... }"
When you retrieve the class in the first example, AS resolves the
reference, but it does not do that when passing "apers" back to the
application, which seems to confuse Address Book when this happens with
a "contain" statement. It works with the "add" statement, however.
The use of "contents of" forces AS to resolve the reference, so that
what gets sent to Address Book is a class "person" and not a reference
to an item in a list.