Address Book Sorting

M

Monomeeth

Hello

I want to be able to sort my address book entries by first name and not last
name. Is this possible? I can't seem to find an option anywhere to set this
up...

Many thanks,

Joe.
 
M

Mickey Stevens

Below is a workaround for displaying Address Book contacts in "Last, First"
format by Paul Berkowitz.

----------------------
You can't [display in Last, First format]. Do note that the Name column
nevertheless _sorts_ by Last Name, not First Name.

You could copy LastName FirstName into the Nickname field or a custom field,
and then sort by that. You can also drag that column to the far left
(after making it visible in View/Columns) if you wish.

Transferring all the names in reverse order can be done easily by
AppleScript.

tell application "Microsoft Entourage"
set allContacts to every contact
repeat with aContact in my allContacts
tell aContact
set {fName, lName} to {first name, last name}
if fName ‚ "" and lName ‚ "" then
set reverseName to lName & " " & fName -- or:
--set reverseName to lName & ", " & fName -- with comma
else if fName ‚ "" or lName ‚ "" then
set reverseName to lName & fName
else if company ‚ "" then
set reverseName to company
else if (every email address) ‚ {} then
set reverseName to default email address
else
set reverseName to ""
end if
set its nickname to reverseName -- or:
-- set its custom field three to reverseName -- or whichever
end tell
end repeat
beep
activate
display dialog "All done!" buttons {"OK"} default button 1 with icon 1
end tell

You can run this from Script Editor if you wish (no need to save it.) If you
want a comma between last name and first, remove the first "--" in front of
that line with comma and insert "--" before the preceding line. Similarly if
you want to use a custom field and not the nickname, remove the "--" in
front of the custom view line and insert it before the nickname line (or
just remove that line). You can change the "three" to anything from "one"
through "eight".
 
A

Andrew J. Cowell

I seem to get a syntax error on the applescript below:

Expected "then", etc. but found unknown token

I did edit it slightly (using a custom field, use a comma to seperate):

....but even copy and pasting I got the same error. Any ideas?

Below is a workaround for displaying Address Book contacts in "Last, First"
format by Paul Berkowitz.

----------------------
You can't [display in Last, First format]. Do note that the Name column
nevertheless _sorts_ by Last Name, not First Name.

You could copy LastName FirstName into the Nickname field or a custom field,
and then sort by that. You can also drag that column to the far left
(after making it visible in View/Columns) if you wish.

Transferring all the names in reverse order can be done easily by
AppleScript.
tell application "Microsoft Entourage"
set allContacts to every contact
repeat with aContact in my allContacts
tell aContact
set {fName, lName} to {first name, last name}
if fName ‚ "" and lName ‚ "" then
set reverseName to lName & " " & fName -- or:
--set reverseName to lName & ", " & fName -- with comma
else if fName ‚ "" or lName ‚ "" then
set reverseName to lName & fName
else if company ‚ "" then
set reverseName to company
else if (every email address) ‚ {} then
set reverseName to default email address
else
set reverseName to ""
end if
set its nickname to reverseName -- or:
-- set its custom field three to reverseName -- or whichever
end tell
end repeat
beep
activate
display dialog "All done!" buttons {"OK"} default button 1 with icon 1
end tell

You can run this from Script Editor if you wish (no need to save it.) If you
want a comma between last name and first, remove the first "--" in front of
that line with comma and insert "--" before the preceding line. Similarly if
you want to use a custom field and not the nickname, remove the "--" in
front of the custom view line and insert it before the nickname line (or
just remove that line). You can change the "three" to anything from "one"
through "eight". ----------------------

Be warned that Custom Fields are not indexed and as a result they do not
sort as speedily as other fields.

Hello

I want to be able to sort my address book entries by first name and not last
name. Is this possible? I can't seem to find an option anywhere to set this
up...

Many thanks,

Joe.
 
P

Paul Berkowitz

I seem to get a syntax error on the applescript below:

Expected "then", etc. but found unknown token

I did edit it slightly (using a custom field, use a comma to seperate):


...but even copy and pasting I got the same error. Any ideas?

There's no error - if you first remove all those email ">" signs!

Copy and paste into a new Entourage message window, select all,
Edit/AutoText Cleanup / Remove Quoting. Then copy and paste into script
Editor and Compile. No error.

--
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.
 
A

Andrew J. Cowell

I may be dumb sometimes ... but I'm not that dumb! Those came from
posting the code into Unison to post to the group. If I copy and paste
your script from Mickey Steven's post on the 24th Nov, I get that error
when I click either Compile or Run.
 
P

Paul Berkowitz

It doesn't error, so you must be doing something wrong. You didn't say which
line/words were highlighted when the error message appears.

As I said,

--
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.
 
S

scott boettcher

I just tried it for kicks and it works fine...

tell application "Microsoft Entourage"
set allContacts to every contact
repeat with aContact in my allContacts
tell aContact
set {fName, lName} to {first name, last name}
if fName ‚ "" and lName ‚ "" then
set reverseName to lName & ", " & fName
else if fName ‚ "" or lName ‚ "" then
set reverseName to lName & fName
else if company ‚ "" then
set reverseName to company
else if (every email address) ‚ {} then
set reverseName to default email address
else
set reverseName to ""
end if
set its custom field one to reverseName
end tell
end repeat
beep
activate
display dialog "All done!" buttons {"OK"} default button 1 with icon 1
end tell

Scott
 
Top