Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Timpion

macrumors newbie
Original poster
Mar 17, 2009
12
0
Mortsel
Hi,

I just got a new phone, but I got some problems getting all my contacts from the old one. I was able to get them into addressbook, but the formatting is not optimal.

I made a script that merges the doubles (eg "Leonardo Di caprio" and "Leonardo Di caprio1")

The only problem now is all the names are in the last name field (eg:
FirstName: "", LastName: "Leonardo Di caprio")

Can someone help me with a script that would split the lastname at the first space " " and put the first part in the firstname field
(eg:FirstName: "Leonardo", LastName: "Di caprio")

I cant find how to do it

I got this far... (I am not really pro at applescript yet :p)

Code:
tell application "Address Book"
	set peopleToChange to people whose (name) contains " "
	repeat with thePerson in peopleToChange
		set theName to the name of thePerson
		...
	end repeat
	save
end tell
Thanks a lot!!

Tim
 
Are you not just getting confused by address book preferences.

ie you have the option of showing first name before or after last name with a radio button in general prefs.
 
Importing in a spreadsheet app is a very good (the best) idea. I ll do that next time! :cool:

I already did it with some scripts which worked quit well, but when I was done and used the "merge" function, addressbook threw away all data from people with two conflicting numbers.

Eg:
Leonardo di caprio
home xxx xx xx
---merge with---
Leonardo di caprio
home yyy yy yy
---gives---
Leonardo di caprio
home xxx xx xx

I had that a lot because while importing all my numbers where set to "home"(thanks to the great way data is stored on sim cards :rolleyes:)

And ofcourse I noticed it the day after I deleted the backups I made (stupid not to keep the backups)

anyway, If anyone wants to take a look at the scripts, pm me. I am not posting them since they are loose bits of code (eg: one script to delete spaces, one to merge names,....)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.