Last Name First Name for Address Book in Entourage

E

Eva

I know that this has been discussed...but I am having some trouble. I
would like my contacts to show up as "Last Name, First Name".
I have tried copying the script that Paul wrote, to automatically
convert this into the nickname field, but I keep getting errors from
script editor that says it cannot compile the info. What am I doing
wrong?

Also, can you continue to run this script so that if you say click on
someone's email address from a message and say add to address
book...and you do this several times a day. Can you just run the
script at the end of the day to update the new ones?
I appreciate the help! I am using Entourage X by the way.
 
A

Allen Watson

I know that this has been discussed...but I am having some trouble. I
would like my contacts to show up as "Last Name, First Name".
I have tried copying the script that Paul wrote, to automatically
convert this into the nickname field, but I keep getting errors from
script editor that says it cannot compile the info. What am I doing
wrong?
You probably have some script lines that got "wrapped", with line breaks
inserted. You need to delete those extra line breaks. When you compile,
look at the line causing the error. It probably should be joined with
the line following, or perhaps the line preceding.
Also, can you continue to run this script so that if you say click on
someone's email address from a message and say add to address
book...and you do this several times a day. Can you just run the
script at the end of the day to update the new ones?
I appreciate the help! I am using Entourage X by the way.

I don't have the script to look at so couldn't say.
 
E

Eva

Allen Watson said:
You probably have some script lines that got "wrapped", with line breaks
inserted. You need to delete those extra line breaks. When you compile,
look at the line causing the error. It probably should be joined with
the line following, or perhaps the line preceding.


I don't have the script to look at so couldn't say.


Okay, well I tried taking out some of the line breaks, but then it
gets caught up on the "icon1" part saying: Expected "timeout" or
"transaction" but found identifier. The script is below.

tell application "Microsoft Entourage"
display dialog "Do you want to include a comma, as" & return &
return &
" LastName, FirstName" & return & return & "or no comma, as" &
return &
return & " LastName FirstName" buttons {"Cancel", "No Comma",
"Comma"}
with icon 1
if button returned of result "Comma" then
set ifComma to ", "
else
set ifComma to " "
end if

set allContacts to every contact
repeat with theContact in allContacts
tell theContact
set {fName, lName} to {first name as Unicode text, last
name as
Unicode text}
if fName ??? "" and lName ??? "" then
set nickname to (lName & ifComma & fName)
else if lName ??? "" then
set nickname to lName
else if fName ??? "" then
set nickname to fName
else if company ??? "" then
set nickname to company
else if (every email address of it) ??? {} then
set nickname to contents of default email address
end if
end tell
end repeat

beep
display dialog "All done!" & return & return & "Now add Nickname
column
in View menu/Columns in the Address Book, and click its header to sort
by
nickname." buttons {"OK"} default button 1 with icon 1


end tell
 
P

Paul Berkowitz

Okay, well I tried taking out some of the line breaks, but then it
gets caught up on the "icon1" part saying: Expected "timeout" or
"transaction" but found identifier. The script is below.

What was below was horribly garbled by various news and mail servers. There
were about a dozen or more hard line breaks, most probably introduced by
your reply, and the "not equals to" character (option =) replaced by ???.
I'm sending it in HTML this time:


tell application "Microsoft Entourage"
display dialog "Do you want to include a comma, as" & return & return &
" LastName, FirstName" & return & return & "or no comma, as" & return &
return & " LastName FirstName" buttons {"Cancel", "No Comma", "Comma"}
with icon 1
if button returned of result = "Comma" then
set ifComma to ", "
else
set ifComma to " "
end if

set allContacts to every contact
repeat with theContact in allContacts
tell theContact
set {fName, lName} to {first name as Unicode text, last name as
Unicode text}
if fName ‚ "" and lName ‚ "" then
set nickname to (lName & ifComma & fName)
else if lName ‚ "" then
set nickname to lName
else if fName ‚ "" then
set nickname to fName
else if company ‚ "" then
set nickname to company
else if (every email address of it) ‚ {} then
set nickname to contents of default email address
end if
end tell
end repeat

beep
display dialog "All done!" & return & return & "Now add Nickname
column in View menu/Columns in the Address Book, and click its header to
sort
by nickname." buttons {"OK"} default button 1 with icon 1

end tell



--
Paul Berkowitz
MVP Entourage
Entourage FAQ Page: <http://www.entourage.mvps.org/toc.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 Entourage you are using - 2001 or X.
It's often impossible to answer your questions otherwise.
 
E

Eva

Paul Berkowitz said:
What was below was horribly garbled by various news and mail servers. There
were about a dozen or more hard line breaks, most probably introduced by
your reply, and the "not equals to" character (option ) replaced by ???.
I'm sending it in HTML this time:


tell application "Microsoft Entourage"
display dialog "Do you want to include a comma, as" & return & return &
" LastName, FirstName" & return & return & "or no comma, as" & return &
return & " LastName FirstName" buttons {"Cancel", "No Comma", "Comma"}
with icon 1
if button returned of result "Comma" then
set ifComma to ", "
else
set ifComma to " "
end if

set allContacts to every contact
repeat with theContact in allContacts
tell theContact
set {fName, lName} to {first name as Unicode text, last name as
Unicode text}
if fName ? "" and lName ? "" then
set nickname to (lName & ifComma & fName)
else if lName ? "" then
set nickname to lName
else if fName ? "" then
set nickname to fName
else if company ? "" then
set nickname to company
else if (every email address of it) ? {} then
set nickname to contents of default email address
end if
end tell
end repeat

beep
display dialog "All done!" & return & return & "Now add Nickname
column in View menu/Columns in the Address Book, and click its header to
sort
by nickname." buttons {"OK"} default button 1 with icon 1

end tell



--
Paul Berkowitz
MVP Entourage
Entourage FAQ Page: <http://www.entourage.mvps.org/toc.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 Entourage you are using - 2001 or X.
It's often impossible to answer your questions otherwise.


--
Thank for the help. I tried copying and pasting again. And I got
further, but not there yet. I get as far as:
with icon 1
if button returned of result "Comma" then
And it tells me "Expected end but found "then""
I have tried removing hard returns and still get the error. Is there
any way this can be emailed to me as a script file?
I really do appreciate the help. This script would be great!
Thanks!
 
P

Paul Berkowitz

Thank for the help. I tried copying and pasting again. And I got
further, but not there yet. I get as far as:
with icon 1
And it tells me "Expected end but found "then""
I have tried removing hard returns and still get the error. Is there
any way this can be emailed to me as a script file?
I really do appreciate the help. This script would be great!

Maybe get yourself a better ISP. There's nothing wrong with the news server,
so it must be your ISP which is garbling non-ASCII characters. This version
will work:


tell application "Microsoft Entourage"
display dialog "Do you want to include a comma, as" & return & return &
" LastName, FirstName" & return & return & "or no comma, as" & return &
return & " LastName FirstName" buttons {"Cancel", "No Comma", "Comma"}
with icon 1
if button returned of result is "Comma" then
set ifComma to ", "
else
set ifComma to " "
end if

set allContacts to every contact
repeat with theContact in allContacts
tell theContact
set {fName, lName} to {first name as Unicode text, last name as
Unicode text}
if fName is not "" and lName is not"" then
set nickname to (lName & ifComma & fName)
else if lName is not "" then
set nickname to lName
else if fName is not "" then
set nickname to fName
else if company is not "" then
set nickname to company
else if (every email address of it) is not {} then
try
set nickname to default email address
end try
end if
end tell
end repeat

beep
display dialog "All done!" & return & return & "Now add Nickname
column in View menu/Columns in the Address Book, and click its header to
sort
by nickname." buttons {"OK"} default button 1 with icon 1

end tell




--
Paul Berkowitz
MVP Entourage
Entourage FAQ Page: <http://www.entourage.mvps.org/toc.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 Entourage you are using - 2001 or X.
It's often impossible to answer your questions otherwise.
 
Top