------------------------------
Message: 2
Date: Sat, 18 Mar 2006 10:20:34 -0800
From: Paul Berkowitz <email@hidden>
Subject: Re: NSContainerSpecifierError?
To: AppleScript-Users <email@hidden>
Message-ID: <C0418F72.C80AB%email@hidden>
Content-Type: text/plain; charset="US-ASCII"
On 3/16/06 7:08 PM, "Robert Nicholson" <email@hidden> wrote:
So I'm trying to import addresses from a file that's in a format
similar to Entourage's exported format. and after importing 25
addresses I get the above error in Address Book.
What is that?
I am basically importing all the email addresses on my whitelist so
that I can colorize the messages from people I recognise in Mail.app
It's similar to the notorious NSReceiverEvaluationScriptError 4. Basically,
it just means that Address Book's scripting is flaky.
More specifically, it seems to mean that when your script tries to set a
property of an object ('person') that the script just created, it can't find
the object that it just finished creating. It can't find the Container for
the property, although it's there. It's not updating the database in time.
Even if you could afford to throw in that absurd 'save addressbook' command
before every command you give to Address Book, it probably wouldn't help
here, since this error seems to occur even for a
make new person with properties {...}
command. You'd have to
set p to make new person
save addressbook
set first name of p to "blah"
set last name of p to "blah"
...etc
...etc.
...etc.
save addressbook -- again and again and again
This is too ridiculous to contemplate as a workaround. Instead, you need to
add some code to set all the properties of existing persons to what you're
importing, and when you it this problem, run the script again so it will
update them. Or something similar. Also very messy.
This problem - all the NSReceiverEvaluationScriptError and
NSContainerSpecifierError errors - got much much worse in Tiger. It was very
rare in Panther.
Unfortunately, it's not 100% replicable, so it makes it hard to submit a Bug
Report. But please do so. The more of us bug this. maybe they'll fix the
fragility of Address Book scripting.
I sell a shareware app that syncs Entourage contacts to Address Book
contacts. On the first run, about 25% of users report these errors! Maybe
more - I now have a built-in error note that itemizes which contacts hit
these two errors, and tells them to modify the Entourage contacts concerned
and re-run the script. That always works. But it's absurd that it should
happen so often.
--
Paul Berkowitz
------------------------------