How to Make a New Phone Number Entry in Address Book?

Can't for the life of me figure out how to do this via AppleScript. I want to create a new contact in Apple's Address Book, and populate the fields with some data. Here's what I have so far (keeping things simple):
set theLastName to "Doe"
set theFirstName to "John"
--etc.
set mobilePhone to "(415) 999-9999"
set workPhone to "(415) 555-1212"
set homePhone to "(415) 888-7777"
tell application "Address Book"
set thisPerson to (make new person with properties {first name: theFirstName, last name:theLastName, organization:"Test Company"})
set the value of phone 1 of person id thisPerson to workPhone
--error
end tell
The new contact record is created properly with first name, last name, and organization/company, but I can't get the phone data in via AppleScript. Does anyone know how to do this?
Any help greatly appreceated.

Hi William,
You need to add the phone entries to the end of the list of phones. Something like this:
tell thisPerson to make new phone at the end of phones with properties {value:"(415) 888-7777", label:"home"}
You could also put the telephone numbers into an array in case you don't want to add all the types to all of your entries. Like this:
set theLastName to "Doe"
set theFirstName to "John"
--etc.
set thePhones to {{"(415) 888-7777", "home"}, {"(415) 555-1212", "work"}, {"(415) 999-9999", "mobile"}}
tell application "Address Book"
set thisPerson to (make new person with properties {first name:theFirstName, last name:theLastName, organization:"Test Company"})
repeat with myPhone in thePhones
tell thisPerson to make new phone at the end of phones with properties {value:(item 1 of myPhone), label:(item 2 of myPhone)}
end repeat
save addressbook -- to update Address Book
end tell
Best wishes
John M

Similar Messages

  • How to update my new phone number after my U-verse phone service is disconnected?

    How to update my new phone number for forwarding  after my U-verse phone service is cancelled/ disconnected?

    I did call them. They said once the phone service is disconnected, there's nothing they can do about it. The thing is that when I called them to cancel the U-verse service yesterday, they did not offer me the opportunity to update the new phone #. This is so frustrating!

  • How to make an Excel file from Contacts in Address Book?

    I'd like to save the contents of my Address Book in an Excel file. How do I do it. Address Book doesn't seem to export to a common SS format.
    Thanks!

    Build an Automator workflow that gets the Contacts you want (like Get Selected Contacts), then add a Get Contact Info and select the items you want. Set the Export format to Spreadsheet (tabs).
    Then, add an action to create the new file (New Text Edit Document).

  • Do I have to add a new contact for each new phone number?

    I just got my phone and I'm adding in my contact manually. I don't see multiple spots for multiple phone numbers for one person? Do I have add a new contact for each phone number a person has? (I.e. One for their home number, one for their work number, one for their cell number).
    Thanks!

    No.
    There is no reason to have a default number of phone number entries that may not all be used and the same for email addresses.
    When manually entering contact info, after entering the first number for a contact, a new phone number entry is made available directly below.

  • Add Attendees (name AND phone no.) from Address Book to iCal for iPhone use

    Hello scripting gurus and newbs alike.
    I've looked through the forums, but can't find a COMPLETE solution to what I believe should be a fairly straightforward problem. I'll start by asking the question as concisely as I can, then bring in more information about what I have tried, and learned, so far. I'll also outline my broad (mini) project aims at the end, in case anyone is interested.
    * Q: How can I add attendees, from my Address Book, to an iCal event, so that **ALL** the attendee details are included?
    Note: It is VITAL to me that attendees' phone number(s) are available through iCal, not just {display name, email, participation status}. This is because I want MobileMe to synch the event with my iPhone, so I can call attendees directly from iCal. (or at least have iCal open the attendee's Contacts record so I can call from there!)
    WHY DO I THINK IT SHOULD BE POSSIBLE?
    Manually, I can simply dbl-click on the event, click into the attendees field, start typing the attendee name, and hit enter. When I do this, it works. MobileMe synchs it to the iPhone, I open iCal, select the event, tap the attendee, and I'm calling.
    WHAT I'VE TRIED USING APPLESCRIPT
    When I try the following script, I've only managed to set Sheila's name/email/participation status. I can retrieve her phone number from Address Book using the above approach, but unsure how to make it stick in iCal * such that I am able to use it to call directly from iCal on the iPhone *
    ++++++++++++++++++++++
    tell application "Address Book"
    set anAttendee to name of (first person whose name contains "Sheila")
    end tell
    tell application "iCal"
    set newEvent to make new event at end with properties ¬
    {summary:"Meeting Info.", location:"ZIP", description:"More yak", start date:SD, end date:SD + 120 * minutes}
    make new attendee at end of attendees of newEvent with properties {display name:anAttendee}
    end tell
    ++++++++++++++++++++++
    WHERE I'VE LOOKED FOR SIMILAR EXAMPLES
    Thanks to Rob (et al) for providing script examples used to create the above, see here: http://macscripter.net/viewtopic.php?id=5692
    I've also looked at the following article, which makes me think I somehow need to use the PERSON ID in the event attendee list. Unfortunately, I have only managed to retrieve the ID, but had no joy trying to set it.
    http://www.mactech.com/articles/mactech … index.html
    THE PROJECT
    I'm a surveyor, and using dialog(s) to enter relevant info., I'm looking to streamline my preparation for surveys when I make each new appointment.
    My mini-project presently enables me to print survey forms (based on a Pages template) with details relating to the specific property (address/contact name&no./appointment date&time etc.) It also uses the appointment date&time to create the appropriate event in iCal.
    I'm also confident I can add the contact details, such as agent/owner name(s) and phone number(s) in Address Book.
    IF I COULD ONLY ADD THESE AS ATTENDEE(S), AS IF ADDED MANUALLY, I WOULD ALSO BE ABLE TO PHONE THE PROPERTY OWNERS WITH A COURTEOUS REMINDER WHEN I'M ON THE WAY!!
    Can anyone help me achieve this?
    Here's hoping.
    Phil (wiimixer)

    Phil
    Referencing the attendee in iCal will only directly record the properties you mention - because that's how it's designed to work and there's no way around the restriction unless iCal is changed.
    You could set the phone number elsewhere in the iCal event - e.g. notes, location, ... - and that would probably allow you to call from iCal (I don't have an iPhone so I can't be sure), but I am not sure I see the advantage over using the link to iPhone's Address Book which is set up by adding an attendee to the event. This might be because I am being dense, so if this is the case please elaborate.
    EDIT:
    I have read your original post in more detail since I wrote the above. It seems to me that you are saying that when you add the person to the iCal event via AppleScript that you do not get the link to the iPhone's Address Book when you sync via MobileMe. You imply, however, that it does work when you type the name manually. Are these both correct statements?
    Message was edited by: Bernard Harte

  • Message : when I write a new phone number to send a message to, the Historical data appears. How can I delete  and reinitiate it ?

    Each time i want to send a SMS to a new phone number not registerd in contacts, the historical list appears.
    How can I reset this list and clean it ?

    Open a Write window. If all the toolbars are missing press the alt key to make the menu bar appear.
    From the menu bar select View-Toolbars and turn the missing toolbars back on.

  • I have a new ipad min2.  I have the verizon activated.  but cannot find phone number.  I checked view account.  How do I get my phone number  asscoiated with my Ipad?

    I have a new ipad min2.  I have the verizon activated.  but cannot find phone number.  I checked view account.  How do I get my phone number  associated with my Ipad?

    Your ipad has a cellular access number in settings under cellular data.
    it is not a phone, and that number can't be used to phone calls.

  • TS2755 I've moved to a different province so now I have a new phone number.  How do I change/update imessage with my new phone number and delete my old one?

    I've changed my phone number since I got my iphone 4S.  Now when I imessage, my old phone number shows up as the contact info.  How do I delete my old number and add my new phone number?

    Apps and media are forever tied to the AppleID used to download them.
    You cannot transfer from downloads from one AppleID to another, nor
    can you merge AppleIDs. If you wish to start using your own AppleID,
    you will have to redownload all the items you wish - paying again under your
    AppleIDfor anything requiring payment.
    Logout of iTunes under your old ID and login using the new ID.

  • How can I add a phone number to my iPod touch to start new conversation from another number

    How can I add a phone number to my start new conversation

    Hello brentfrommt. washington
    To add a phone number to your iMessage account, you need to have an iPhone with your phone number on it. Once you sign into iMessage the iPhone it will link to all your devices with that Apple ID. Take a look at the article below for more information. 
    iOS and OS X: Link your phone number and Apple ID for use with FaceTime and iMessage
    http://support.apple.com/kb/HT5538
    Regards,
    -Norm G. 

  • I have set up a iTunes account but I have changed my number and now I can't download apps it keeps saying previous billing problem how do I change my phone number with out setting up a new iTunes

    How do I change my phone number on iTunes. On my phone just I can't download any apps due to a problem with the numbers not matching

    You're really posting in the wrong forum. you should be posting here ( https://discussions.apple.com/community/itunes/itunes_store ) Or calling apple support directly.

  • How do I change the phone number associated with my iCloud account after replacing my phone and switching carriers/getting a new phone number?

    I recently replaced my lost iPhone but in the process, had to switch carriers and activate a new phone number. I backed the new phone up from iCloud which was still attached to the old number (for example, when I attempt to sync Keychains, the security code continues to be sent to the old number). I'm looking to update my iCloud account with the new phone number so I can sync my devices and any I might get in the future. Help! Please!
    Thanks

    Do you not set the phone number within Apple ID
    https://appleid.apple.com
    and not iCloud?
    May be wrong here:(

  • My husband got a new phone number, however, every time he texts me it still says he's texting from his old number.  I've even erased him as a contact and reprogrammed him.  How do I correct this?

    My husband got a new phone number, however, every time he texts me it says it's coming from his old phone number.  I've even deleted him from my contacts and my hotmail contacts, resynced my hotmail contacts, then added my husband as a new contact.  Both of his phones were iPhones but his previous carrier was Verizon and his new carrier is Viaero.  I'm still on Verizon.

    I've fixed my own problem.
    In the end, the issue was with iMessage on the other phone, not mine.
    While I had it connected to iTunes (the other phone, not mine), I could see that iTunes thought it was the temporary number (07429...). I turned iMessage off and back on again and the phone number in iTunes changed to the old (i.e correct) number (07903...).
    Subsequently, texts from my phone to the other phone showed up as blue-bubbled iMessages.
    Hope this helps someone!
    Thanks for reading, if you did.

  • HT5622 My husband and I share the same apple id for our iphones, how do we change the phone number associated with our apple id to his phone number? He is getting my messages because the ipod has my number in it not his?

    My husband and I have iphones that use the ame apple ID, but different numbers and email addresses, how do we change the phone number that is associated with his ipod to his phone number?

    Use his ID for Settings>Messages>Send And Recieve and for Settings>FaceTime.
    If he does not have an ID then
    Create a NEW account using these instructions. Make sure you follow the instructions. Many do not and if you do not you will not get the None option. You must use an email address that you have not used with Apple before.
    Creating an iTunes Store, App Store, iBookstore, and Mac App Store account without a credit card

  • How do i change the phone number that my keychain is associated with?

    How do i change the phone number that my Keychain is associated with?

    Hello Boogie3339,
    Thanks for using Apple Support Communities.
    Please see below on how to change your phone number for iCloud Keychain:
    Change how new devices can be approved
    After setting up iCloud Keychain on your Mac, you can change whether your iCloud Security Code can be used to approve iCloud Keychain on new devices. You can also change the iCloud Security Code or the phone number used to verify your identity after you use the iCloud Security Code.
    In iCloud Preferences, make sure Keychain is on, click Account Details, then change your iCloud Security Code settings.
    OS X Mavericks: Set up iCloud Keychain
    http://support.apple.com/kb/PH14405
    Take care,
    Alex H.

  • My Canadian iPhone will only show my US iPhone number on my Apple ID. How do I add a phone number so I can iMessage with my Canadian number? To

    How do I add a phone number so I can use either my US or Canadian number (depending on where I am) with iMessage and Facetime on both my iPhones?

    Tdalso wrote:
    How do I add a phone number so I can use either my US or Canadian number (depending on where I am) with iMessage and Facetime on both my iPhones?
    You need to log out of iMessage and Facetime, make sure your number is correct in Settings/General/About, then log back in again to send a new activation request.

Maybe you are looking for

  • ICal - AppleScript To Convert ToDos To Events

    I use a iMac G4 800MHz 15" running 10.4.11. I have used Chronos Personal Organizer 4.5.0 for quite some time. I want to transfer my approximately 21,000 CPO calendar items (all are To Dos) to iCal. This number includes approximately 5,000 items that

  • How to index a large FLV?

    I'm sure this is documented many places but I can't find a simple well explained doc that shows how to take a 4 hour FLV archive and index it in such a way so that users can click a link and go directly to a specific time slice in the file. Is this a

  • Help! Male / Boy Flash Avatars Needed

    Dear Community, I'm in desperate need of great quality 3D male/boy avatars needed for my E-Learning Demo for Professional Accountants. Please advise of any site or directory where I can find or buy such avatars. Much appreciated. Wes du Toit

  • Payables API

    Hi All, Is there any API in Payables to reverse 1 distribution line in a Invoice ? Following is the requirement. 1. Expense report is created from OTL or OIE. 2. A Specific expense type say "Misc" is not reimbursable. 3. In this case, any employee wh

  • Microsoft window pops up when opening itunes

    when I open iTunes i get this message do u want to scan and fix (name of playlist)- (F:)? there might be a problem with some files on this device or disk. This can happen if you remove the device or disc before all files have been written to it. Scan