I’m not a scripter, but I think I have a problem that could easily be solved with AppleScript. I would like a script that will cycle through all of the address book entries, searching for all entries that work for a specific company, let’s say “ABC Inc.”. It would then add an e-mail address for each of those people constructed like this:
create a smart group with your condition(s) and name it with your desired address name (without .com)
Change the value of the property line to the same name and run the script.
property theCompany : "abcinc"
tell application "Address Book"
repeat with onePerson in people of group theCompany
tell contents of onePerson
try
make new email at end of emails with properties {label:"work", value:first name & "_" & last name & "@" & theCompany & ".com"}
end try
end tell
end repeat
end tell
I have a dilemma similar to this, and I was working with someone on getting this work but I’m not quite sure what to do. Being a n00b at AppleScripts, I’ve been trying to create a script to simplify my company’s Address Book. Basically, we are merging from a web-based email system to a localized system and I have imported all the contacts into AB. However, the only info on the cards is the email address. I’m try to prepare a script that will modify over 500 entries to take the prefix from the email addresses (i.e. bob.smith@company.com) and merge it into the first and last name. I also need to append the work address to each card. I’ve been given an example script to work with but I can’t seem to get the desired result. Needless to say, i’m a bit lost. Here’s what I have now.
tell application "Address Book"
repeat with a from 1 to count people
set theCurrentPerson to person a
tell theCurrentPerson
-- Get the person's email address
if (email 1 exists) then
set theEmailAddress to value of email 1
-- Break apart the email address, and extract the first and last name
set theName to text 1 thru ((offset of "@" in theEmailAddress) - 1) of theEmailAddress
set theFirstName to text 1 thru ((offset of "." in theEmailAddress) - 1) of theName
set theLastName to text ((offset of "." in theEmailAddress) + 1) thru -1 of theName
-- Enter the first name
set first name to theFirstName
-- Enter the last name
set last name to theLastName
-- Enter the address
make new address at end of addresses with properties {label:"Work", street:"123 Anystreet", city:"Anytown", state:"PA", zip:"99999"}
end if
end tell
end repeat
end tell
I’m not sure where I’m supposed to define the email address portion of the script. Any help would be great. Thanks!!