Applescript to get phone number from name

Hi, I am trying to make an applescript that will simply return a phone number from contacts when given a name. It is part of a larger script, but everything else is already working. It seems like it would be pretty simple, but nothing that I have tried will work.
Here is my best guess:
tell application "Contacts"
get phone of "John Doe"
end tell
I just need to set a variable to equal the phone number that is returned. Thanks in advance.

Hello
You may try something like this.
set n to "John Doe"
tell application id "com.apple.AddressBook"
    set p to value of phone 1 of (person 1 whose name = n)
    set q to {label, value} of phones of (people whose name = n)
    set r to value of phone 1 of (person 1 whose name = n) whose label = "home"
end tell
return {p, q, r}
Note that database may contain multiple records for the same person name and a person's record may contain multiple phone numbers.
Tested with AddressBook 5.0.3 under OS X 10.6.8.
Regards,
H

Similar Messages

  • TA38622 how do you delete a contact name and phone number from this?  i have deleted it from my regular contacts, but it remains in a text memory when i begin to type the beginning of a name

    How do I delete a contact name and phone number from my texting memory?  I have deleted this contact from my regular contact information; however when I text and begin to text a contact beginning with the 1st letter of the name I had deleted, it brings up the old, deleted contact information in my texting history only.

    You would have to restore as new.

  • How to get customer number and name from the SD document

    Hi All,
    Can you please let me know how to get Customer Number and Name from the SD Document?
    Thanks a lot....
    Anil

    Hi,
    It will be displayed in the SD (BIlling document) itself,  you clikc on the VF03. The customer name and number will also appear in the SO document also Tcode VA03
    regards,
    radhika
    Edited by: kolipara radhika on Jul 10, 2009 5:32 AM

  • HT201363 How do i delete my iphone 4s from my account on apple ID? I change phones and i am not getting regular txt messages because somehow the messages are still sending through imessage which i no longer have.... I deleted my phone number from the acco

    I change phones and i am not getting regular txt messages because somehow the messages are still sending through imessage which i no longer have.... I deleted my phone number from the account though as per instructiions from the phone carrier and is still not working...Any help?

    Hello jn_andrade,
    It sounds like you are no longer getting text messages becuase your Apple ID is still using your phone number for iMessage. I would use these steps to unlink your phone number from your account:
    Unlink a phone number
    To remove a phone number from an Apple ID, sign out of FaceTime and Messages on your iPhone:
    Settings > Messages > Send & Receive. Tap your Apple ID, then tap Sign Out.
    Settings > FaceTime. Tap your Apple ID, then tap Sign Out.
    This should remove your phone number from other devices using the same Apple ID with FaceTime and Messages. If the phone number is still available on other devices after you sign out of FaceTime and iMessage on the iPhone, you may need to sign out of iMessage and FaceTime on all your devices, then sign in to FaceTime and Messages again on devices you want to use.
    Note: If you no longer have access to the iPhone that is using the number you want to remove, reset your Apple ID password.
    From: iOS and OS X: Link your phone number and Apple ID for use with FaceTime and iMessage
              http://support.apple.com/kb/ht5538
    Thank you for using Apple Support Communities.
    Regards,
    Sterling

  • Nokia 7230 - How to insert a phone number from Con...

    I know this is an issue with some other models, but HOW do I insert a phone number from my contacts into a text message?
    -If I go to Phonebook and "copy" number, then I try to paste it into my message, I get an answer that there is nothing to paste.
    -I cannot open the phonebook while I am in the texting window, there is no option, in old models one had "insert telephone number", with 7230 I can only  insert a smile or special character.
    -I DO NOT WANT to send a MMS with visiting card, just plain sms with a number taken from my contacts.
    Thanks to whoever can help!
    Mod

    Hi modjadii,
    The compact UI style used in 7230 does not allow copying phone number to text message the same way as in some previous models but please try this as a solution.
    Write a text message and when you need to insert phone number from your contacts select Options - More - Exit editor (or just press End key to return to idle screen). The text you have already written stays at the text editor and is visible once the editor is opened again.
    Open your contacts by choosing Names and select Options - More - Business card - Via text message and search the contact whose number you want to copy. After selecting the contact you'll get the phone number to screen and you can select Options - Editing options - Copy all.
    Now the number is copied for pasting and you can open the text message editor again and select Options - More - Modify text - Paste.
    Hope this helps.
    jakivi

  • Can I get tel number from adress book(contacts)

    hi all
    is there any api for get the phone number or name from phone memory
    thanks
    muratti32

    hi
    You can find the sample code and the discussion in the Forum it self.Search for that
    lakshman

  • I currently have an old work phone that is synced to my iPad. I would like to delete the old work phone number from my iCloud without having to contact my previous employer. Is there a way to do this and replace it with my personal iPhone?

    I currently have an old work phone that is synced to my iPad. I would like to delete the old work phone number from my iCloud without having to contact my previous employer. Is there a way to do this from my ipad and replace it with my personal iPhone?

    Hi Ktchast,
    Welcome to the Support Communities!
    The article below may be able to help you with this issue.
    Click on the link to see more details and screenshots. 
    Frequently asked questions about Apple ID
    http://support.apple.com/kb/HT5622
    An Apple ID is a user name you use for everything you do with Apple. Creating an account for an Apple service, such as the iTunes Store or the App Store, creates an Apple ID. Apple ID allows you to access other Apple services. You don't have to create a new account for each service—just use your Apple ID.
    How do I change my Apple ID Name or personal information?
    You can change your Apple ID Name at My Apple ID. Click on Manage your Apple ID and sign in with your Apple ID name and password. Click Edit and enter the new information, then click Save Changes. Changes take effect immediately. You can also use My Apple ID to change your personal information, such as your mailing address or email address. See Changing the name you use for your Apple ID if you'd like more information.
    Cheers,
    - Judy

  • How can I dial a phone number from an email message directly

    How can I dial a phone number from an email message directly,
    But even before the selection i will change or correct the number?
    If I copy the number in the notebook, all spaces are filled with % signs.
    When I dictate SIRI the number I get the answer: I do not know the number
    If I copy the number in the phone selection (above) the number can not be edited afterwards.

    You can dial a number appearing in an email by tapping on it.
    But if you need to correct the number first you cannot edit a received email.
    To edit the number tap on the forward symbol and when the draft comes up you should be able to correct the phone number, copy it and paste into your Phone App. Then delete the forward email without sending it.

  • How do I dial a phone number from Forms6i ?? OLE2,DDE??

    How do I dial a phone number from Forms6i ?? OLE2,DDE??
    Is it do-able??
    I have a contact form that has the contacts phone number, etc... I would like to add a button to dial the number which would open the phone line (probably through my modem) and dial the number ... where I would pickup the receiver and wait for connection...
    I need an example or a "How to" link or something where if I take the time I can get it working....
    IF not, is there software to do it?
    Thanks, Bill

    Yes, great! I will check into my modem... but I remember years ago have a c program that I used to send error messages through the modem to my alpha-numeric pager. With that I started with that c program being called from REXX IBM language and it spoke modem language...
    Is there another forum that would handle this type of request? what do you call telephone support? telephony? communication links? ....
    Thanks for the input!

  • HowDoI copy a phone number from a contact and paste it into a text

    Z10 HowDoI copy a phone number from a contact and paste it into a text message?
    Help Please. It should be so simple but in the maze of approaches to contacts from the phone or home screen which ever way you get there; how do I select a phone number, copy it and paste it into a text message to another contact so that I can send it on?
    The logic of the interface is totally baffling to me most of the time. Can't there just be one contacts interface so that when you enter it from anywhere it presents the same options to edit etc. Cannot the three blobs be called up to allow a proper edit menu - copy/cut/paste/delete.
    Can the favourites be held permanently in screen at the top with the rest of the contacts scrolling below them?
    Can it be set up so that contact pictures do not show to save screen space?
    Any help on any of these - much appreciated.
    Solved!
    Go to Solution.

    Hey jbee,
    Welcome to the BlackBerry® Support Community Forums.
    How Do I copy a phone number from a contact and paste it into a text message?
    The only option would be to to select the edit option on the contact and hold your finger on the number and select the copy option on the left side panel.
    Can the favorites be held permanently in screen at the top with the rest of the contacts scrolling below them?
    This feature is currently not available. 
    Can it be set up so that contact pictures do not show to save screen space?
    This feature is currently not available.
    Let me know if you have any other questions.
    Thanks.
    -HB
    Come follow your BlackBerry Technical Team on twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.Click Solution? for posts that have solved your issue(s)!

  • Retrieve a phone number from iCloud that I deleted

    Is there a way to retrieve a phone number from iCloud that I deleted a while back from my address book? I had the number in my favorites and all contacts but now I don't know how to get the number back.
    I'm using Mavericks

    Unless you kept a backup, no.

  • Is there an ical/iphone app that allows you to call a phone number from ica

    I schedule hourly appointments with clients and type the name and phone number for each client directly on the schedule. Does anybody know of an app that would allow me to simply tap on that phone number from ical to call the client? Otherwise, i have to look at ical on my phone, remember the number, click to phone and enter it in manually. Thanks!

    There no app for that, no. But, if you enter the number into the Notes field of the appointment (but not the name or location fields), you can tap the number to dial it from the Calendar app.

  • Verizon system can't handle porting phone number from Straight Talk customers?

    According to this discussion: Verizon system can't handle porting phone number from Straight Talk customers?  If still true, then VW misses a huge business opportunity. Adjusting the sizing the account number to be wider is not a hard system adjustment task and have almost zero system ripple-effect impact (I am in IT works).
    http://www.prepaidreviews.com/straighttalk.html
    "Straight Talk makes it impossible to port an existing cell phone number from their operation to a competitor such as Verizon. To port my cell phone number I was told by Verizon to provide my ST account number. It was not listed on any account documents. After 45 minutes on hold, ST customer service told me it was the cell phone serial number. But that number was too long to insert into Verizon's system. After another hour long wait, ST directly told a Verizon rep that was the only account number. As a result, I had to abandon the cell phone number that I have had for nearly 10 years and get a new one. I will not be doing any business with ST in the future."

    Ah ha!  Okay, so I just need to be more patient in other words.    I'm just glad nothing is wrong.
    I did use the "erase all data and settings" option on the iPhone 6 menu because I wanted to go through the setup myself.  I hope that didn't mess anything up.
    Thank you!!

  • Unlink phone number from Apple ID due to facetime

    Apple ID used for many years shared by family. Bought many songs and apps to be used on wife and kids iphone ipod touches.  NOW with facetime I want to be able to remove my phone number from that Apple ID and create a new one JUST FOR FACETIME.  Keep the original id just for purchases; sharing apps with family. Problem is our ipads use the original id and seem to be assigned my phone number and email.  I do NOT want my wife and kids getting my facetime calls and texts!!  I have created the new id but cannot seem to remove my phone number from the old id.  DO I need to completely reset my iphone to do this?  Do I also need to reset the kids ipads?

    Hi, Dranon. 
    Thank you for visiting Apple Support Communities.
    Here are the steps for removing your phone number from your Apple ID.  I also would recommend signing out completely of iMessage and FaceTime on any device that uses your Apple ID.
    Unlink a phone number
    To remove a phone number from an Apple ID, sign out of FaceTime and Messages on your iPhone:
    Settings > Messages > Send & Receive. Tap your Apple ID, then tap Sign Out.
    Settings > FaceTime. Tap your Apple ID, then tap Sign Out.
    This should remove your phone number from other devices using the same Apple ID with FaceTime and Messages. If the phone number is still available on other devices after you sign out of FaceTime and iMessage on the iPhone, you may need to sign out of iMessage and FaceTime on all your devices, then sign in to FaceTime and Messages again on devices you want to use.
    Note: If you no longer have access to the iPhone that is using the number you want to remove, reset your Apple ID password.
    iOS and OS X: Link your phone number and Apple ID for use with FaceTime and iMessage
    http://support.apple.com/kb/HT5538
    Cheers,
    Jason H.

  • How to remove my phone number from iMessage?

    Hi. I recently gave up my iPhone to switch to a non-Apple device.  While I had the iPhone, my phone number was used for iMessage.
    Now when my friends using iPhone try to send me a message, it automatically select iMessage as Apple recognises my mobile number as an iMessage number even though I don't have an iPhone anymore.  Is there any way to remove my phone number from Apple's iMessage database?

    I have exactly the same problem. I ported my number to an Android phone, and kept my iphone to use as an Ipod touch. I have taken the sim card out, wiped the phone. put the sim card back in to restore and turned off imessage completely. Nothing works. Its like my phone number is stored on some Apple imessage server somewhere and any of my friends iphones automatically see my number as an iphone still and default to imessage. Then the messages they send are never received by anything. My only course of action is to ask them to turn their imessaging service off. It is deeply frustrating.
    I also tried to check if it was registered but it apparently never was (I had bought a refurbished iphone from AT&T). If I login to my apple profile their are no products registered.
    Apple needs to get this fixed pronto, because some of us are still customers even though we may have switched our phones. And I am not a very happy customer right now.

Maybe you are looking for

  • Spry Submenus Rolling Up in Multiple Broswers

    Hi! I'm trying to implement the spry menu on a website but it wont work for me. When you hover over the submenus they flicker and a submenu disappers. Here's a link to a page with this happening: http://celebrationsphotography.us/contact_test.html Th

  • Problem in developping Multi Planning area

    Hi, experts, I have a question regarding as the multi planning area -> I have created a mullti planning area which include two basis area: A for plan data (transactional cube)---> Charateristic: Material, 0CALYEAR/ KF: Price B for actual data (non-tr

  • Frequently changing label printing requirements

    hello there, business scenario  ; labels required for shipments, keep changing frequently and going forward  this needs to be done in SAP. does anyone know how to address this issue ???

  • Basic Requirements to develop Queries

    Hi, We are going to develop Queries. Please let me know Which type of information we need to get from the user to develop queries. Regards, Chetana...

  • Creating a third line w/ one Lower 3rd

    Can one create a third or fourth line, when only using one Lower 3rd in Final Cut Pro? Thanks.