Address Book

Can i make a script that will make all my contacts’ addresses their first initial and their last name at a single domain name, e.g. John Brown>Script>email address is jbrown@mac.com?

Hi,

Here’s my example applescript:

set d to “mac.com
tell application “Address Book”
activate
set pl to (every person)
set new_addresses to {}
repeat with this_person in pl
tell this_person
set f to (first name) as string
try
set l to (last name) as string – needs coercion for some reason
on error – no last name? bad text?
set l to “doe”
end try
end tell
set fc to (character 1 of f)
set n to (fc & l)
set new_n to {}
repeat with c in n
– you might wabt to check for bad characters
set anum to ASCII number c
if anum > 64 and anum < 89 then
set tn to anum + 32
else
set tn to anum
end if
set end of new_n to (ASCII character tn)
end repeat
set a to ((new_n as string) & “@” & d)
set end of new_addresses to a
end repeat
end tell
new_addresses
–{97, 120, 65, 88}

Needs more error checking and testing.

gl,