Automated Facebook Email

If you have a large list of people that are on Facebook and need a way of messing them all the same canned message, and you have them in your Address Book as well. This little script can help.

set listURL to {}
set listName to {}
tell application "Address Book"
	repeat with aPerson in people in group "Facebook" -- If you have the group named differently change this.
		--set currentURL to value of url of aPerson -- if you need the Facebook profile URL as well uncomment the beginning of this line.
		set currentName to the name of aPerson
		--set end of listURL to currentURL -- if you need the Facebook profile URL as well uncomment the beginning of this line.
		set end of listName to currentName
	end repeat
end tell
repeat with fb in listName
	set thePerson to fb as text
	set theSubject to "Automated Contact Info Request" -- This is your subject.
	set theMessage to "Hey " & fb & "! I am updating my address book and I don't seem to have your contact info. If you could please get back to me with your Address, Phone -or- Cell, Email, and any relevant IM information it would be greatly appreciated! ~Aaron" -- This is your canned message
	tell application "System Events"
		tell application process "Safari"
			open location ""
			delay 5
			keystroke thePerson
			keystroke tab
			keystroke theSubject
			keystroke tab
			keystroke theMessage
			keystroke tab
			keystroke return
			delay 2
		end tell
	end tell
	tell application "Safari" to close every window

-- Uncomment the following if you want conformation on each message.
	(*	set answer to the button returned of (display dialog "Continue?" buttons {"Yes", "No"} default button 1)
	if the answer is "yes" then
	end if *)

end repeat

How to use:

  1. Create a group in Address Book of all your contacts that have Facebook. If you add a note to your contacts that they have Facebook -or- actually add the URL to their contact information a smart group will speed this task up considerably.
  2. Providing that all of the names in your address book are spelled the same way on Facebook just run.

I use this script in conjunction with Address Book Sync Which pulls all of your Facebook contacts names and profile images into address book. And, I don’t mean to plug URLs but seeing as Google returns well over 100,000 results for Address Book Sync