Re: AB Selection
Re: AB Selection
- Subject: Re: AB Selection
- From: Paul Berkowitz <email@hidden>
- Date: Sun, 02 Nov 2003 07:22:18 -0800
On 11/2/03 3:23 AM, "Graphitex" <email@hidden> wrote:
>
On Sunday, Nov 2, 2003, at 06:37 Europe/Athens, Paul Berkowitz wrote:
>
>
> tell application "Address Book"
>
> item 1 of (get selection)
>
> end tell
>
>
On Sunday, Nov 2, 2003, at 03:13 Europe/Athens, Michelle Steiner wrote:
>
>
> tell application "address book"
>
> get the selection
>
> end
>
> ..............
>
> By using "get," you can do this
>
>
>
> set foobar to name of item 1 of (get the selection)
>
>
Thanks folks, but it simply doesn't work. OSX 10.2.8. I get:
>
>
--> Address Book got an error: NSCannotCreateScriptCommandError
>
>
Any ideas?
Upgrade to Panther. If I remember correctly, there's no 'selection' property
of 'application' in the Dictionary of the Jaguar Address Book, is there? So
naturally you can't get it. They really have made a huge number of
improvements in the Panther Address Book.
One of those "improvements" is that they have fixed their improper, illegal
raw codes for events (commands). In Jaguar, they seem to have thought they
could use 4-character raw codes for events, as they do for classes.
AppleScript inserts "????" for the first 4 missing characters . (Or - who
knows? - maybe they consciously used "????".) So
save addressbook
was the compiled form of
<<event ????az15>>
Now in Panther, save addressbook is the compiled form of
<<event az00az15>>
And the same for all other events in the Address Book dictionary: the first
four characters, identifying the application, are 'az00' rather than '????'.
(Throughout I'm using "<<" and ">>" as placeholders for guillemets, typed as
option-\ and shift-option-\ on US keyboards, which would be perverted by
this stupid, decrepit abomination of a mailing list configuration into
idiotic characters if I typed them here.)
What that means is that no script written for Address Book in OS 10.2 will
work in 10.3, unless the only events you used were from the Standard Suite
(e.g. 'make new' and 'set' and 'get' and 'delete') and none from the Address
Book Suite ('save addressbook', 'add', 'remove', etc.) You can save scripts
as text while still in Jaguar, then re-compile them in Panther. Or else open
them as scripts in a script editor, where you will now see raw codes instead
of English terms for the events, do a Find/Replace to replace all '<<????'
with '<<az00' (using the correct guillemet character), and then compile.
Since no Jaguar script can work in Panther anyway, due to the changed raw
codes, forget about compatibility between versions. There is none.
So you can only use 'selection' in Panther scripts. Upgrade to Panther when
ready.
--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.