(I meant to send it pasted in, but the attachment arrived unscathed.)
You have included a common or garden script error:
if "default postal address" is equal to editContactProperty then
set editContactPropertyValue to (choose from list
{"home", "work"} with prompt "Select default address:" without multiple
selections allowed)
You forgot to add 'as string', or to get item 1 of the result. So the
result, if you choose "home", is
--> {"home"}
not "home". Therefore, a few lines lower:
else if editContactProperty is equal to "default postal
address" then
if editContactPropertyValue is equal to "home" then
set default postal address of (item i in
contactList) to home
else
set default postal address of (item i in
contactList) to work
end if -- editContactPropertyValue = home
Since editContactPropertyValue is not equal to "home" (it's {"home"}), the
'else' tells it to
set default postal address of item i in contactList to work
so that's precisely what it does. If you fix the error in the first line
quoted to
set editContactPropertyValue to (choose from list {"home",
"work"} with prompt "Select default address:" without multiple selections
allowed) as string
then the rest of it works as you'd like.
By the way, if you ever run the script without selecting a contact you won't
get the display dialog you expect, since there's another error there:
if length of contactList is less than 1 then -- only run if user actually
selected some contacts
display dialog "Please select one or more contacts before
running script." without cancel
There's no such parameter as 'without cancel' (there's no boolean 'cancel'
parameter in 'display dialog'). You can see that from the formatting:
'cancel' is colored as a variable, not a keyword. You'd get an Error: "The
variable cancel is not defined." I think you mean this:
display dialog "Please select one or more contacts before running
script." buttons {"OK"} default button 1 with icon 0
--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <
http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <
http://macscripter.net/scriptbuilders/>
Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.
PLEASE always state which version of Microsoft Office you are using -
**2004**, X or 2001. It's often impossible to answer your questions
otherwise.