second name first?

L

lorry

Is there a way to show the contacts in my address book by their second name
first (not the other way around)?

Thank you


entourage 2004, panther
 
P

Paul Berkowitz

Is there a way to show the contacts in my address book by their second name
first (not the other way around)?

You could do this:

Enter "LastName, FirstName" (with or without comma) in the Nickname field
of every contact - also put Company there for those who have no first or
last name, email for those wit none of the above. Then sort by Nickname
column after getting it from View/Columns, and drag it to be the leftmost
column.

It will still enter the name correctly when addressing email messages in
Entourage or doing a mail merge in Word.

You can do it all at once in a few seconds by running this script. Just
delete the comma if you don't want it.


tell application "Microsoft Entourage"
set allContacts to every contact
repeat with theContact in my allContacts
tell theContact
set {fName, lName} to {first name, last name}
if fName ‚ "" and lName ‚ "" then
set theNickName to (fName & ", " & lName)
else
set theNickName to fName & lName -- one or the other
end if
if theNickName = "" then
set theNickName to company
if theNickName = "" then
try
set theNickName to default email address
end try
end if
end if
set nickname to theNickName
end tell
end repeat
display dialog "All done!" & return & return & "Now sort by Nickname
column at left." buttons {"OK"} default button 1 with icon 1
end tell




--
Paul Berkowitz
MVP Entourage
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 Entourage you are using - **2004**, X
or 2001. It's often impossible to answer your questions otherwise.
 
L

lorry

Re: second name first?Hi Paul,

Thank you for your rapid reply.

I havent run the script yet - i have only had a mac for about 2 weeks now so had to go and learn how to run one.

just looking at the code you wrote though, should I be changing it to last name, first name in the line after tell thecontact ?? I cant see anywhere that the last name comes before the first name.

Sorry is this is a dumb question but i'm trying hard (really)

THanks again

Lorry
Is there a way to show the contacts in my address book by their second name
first (not the other way around)?

You could do this:

Enter "LastName, FirstName" (with or without comma) in the Nickname field of every contact - also put Company there for those who have no first or last name, email for those wit none of the above. Then sort by Nickname column after getting it from View/Columns, and drag it to be the leftmost column.

It will still enter the name correctly when addressing email messages in Entourage or doing a mail merge in Word.

You can do it all at once in a few seconds by running this script. Just delete the comma if you don't want it.


tell application "Microsoft Entourage"
set allContacts to every contact
repeat with theContact in my allContacts
tell theContact
set {fName, lName} to {first name, last name}
if fName ≠ "" and lName ≠ "" then
set theNickName to (fName & ", " & lName)
else
set theNickName to fName & lName -- one or the other
end if
if theNickName = "" then
set theNickName to company
if theNickName = "" then
try
set theNickName to default email address
end try
end if
end if
set nickname to theNickName
end tell
end repeat
display dialog "All done!" & return & return & "Now sort by Nickname column at left." buttons {"OK"} default button 1 with icon 1
end tell




--
Paul Berkowitz
MVP Entourage
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 Entourage you are using - **2004**, X or 2001. It's often impossible to answer your questions otherwise.
 
P

Paul Berkowitz

I havent run the script yet - i have only had a mac for about 2 weeks now so
had to go and learn how to run one.

just looking at the code you wrote though, should I be changing it to last
name, first name in the line after tell thecontact ?? I cant see anywhere
that the last name comes before the first name.

Sorry is this is a dumb question but i'm trying hard (really)

Good catch. I did that completely backwards. Open Script Editor in
/Applications/AppleScript/ and paste this in. You're only ever going to run
it once, I should think (in future, make a Nickname field manually for new
contacts) so you might as well just run it form Script Editor - no need to
save it.



tell application "Microsoft Entourage"
set allContacts to every contact
repeat with theContact in my allContacts
tell theContact
set {fName, lName} to {first name, last name}
if fName ‚ "" and lName ‚ "" then
set theNickName to (lName & ", " & fName)
else
set theNickName to lName & fName -- one or the other
end if
if theNickName = "" then
set theNickName to company
if theNickName = "" then
try
set theNickName to default email address
end try
end if
end if
set nickname to theNickName
end tell
end repeat
activate
display dialog "All done!" & return & return & "Now sort by
Nickname column at left." buttons {"OK"} default button 1 with icon 1


--
Paul Berkowitz
MVP Entourage
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 Entourage you are using - **2004**, X
or 2001. It's often impossible to answer your questions otherwise.
 
L

lorry

Re: second name first?Thanks Paul,

You saved me hours / days and MANY MANY grey hairs

much appreciated

Lorry


I havent run the script yet - i have only had a mac for about 2 weeks now so had to go and learn how to run one.

just looking at the code you wrote though, should I be changing it to last name, first name in the line after tell thecontact ?? I cant see anywhere that the last name comes before the first name.

Sorry is this is a dumb question but i'm trying hard (really)


Good catch. I did that completely backwards. Open Script Editor in /Applications/AppleScript/ and paste this in. You're only ever going to run it once, I should think (in future, make a Nickname field manually for new contacts) so you might as well just run it form Script Editor - no need to save it.



tell application "Microsoft Entourage"

set allContacts to every contact
repeat with theContact in my allContacts
tell theContact
set {fName, lName} to {first name, last name}
if fName ≠ "" and lName ≠ "" then
set theNickName to (lName & ", " & fName)
else
set theNickName to lName & fName -- one or the other
end if
if theNickName = "" then
set theNickName to company
if theNickName = "" then
try
set theNickName to default email address
end try
end if
end if
set nickname to theNickName
end tell
end repeat
activate

display dialog "All done!" & return & return & "Now sort by Nickname column at left." buttons {"OK"} default button 1 with icon 1

end tell




--
Paul Berkowitz
MVP Entourage
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 Entourage you are using - **2004**, X or 2001. It's often impossible to answer your questions otherwise.
 
Top