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 ) 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.
I would recommend just exporting as CSV or similar: ( http://gwenhiver.net/address-book-exporter.html ) and bring it into Excel or Google Spreadsheets. Then you can easily split off last names using a textual formula that looks for a space or something and puts it in the correct cell. Import that list into address book.
Importing in a spreadsheet app is a very good (the best) idea. I ll do that next time! 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 ) 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,....)