Access Address Book data from terminal

Hi everyone,
I was wondering if there is a way to access Address Book data from the terminal. For instance, I would
need a command that would output an address of a given person.
Thanks in advance for your input

this script could be used in Terminal (save the code below as
"getaddress" and mark it as executable):
case $# in
2) firstname=$1; lastname=$2;;
*) echo 'Usage: getaddress <firstname> <lastname>' 1>&2; exit 1 ;;
esac
count=`osascript -e "tell application \"Address Book\" to count (people whose first name is \"${firstname}\" and last name is \"${lastname}\")"`
case $count in
0) echo "$firstname $lastname is not in Address Book." 1>&2; exit 1;;
1) ;;
*) echo "There are multiple entries for $firstname $lastname in Address Book (unhandled error)." 1>&2; exit 1;;
esac
osascript -e "tell application \"Address Book\" to get formatted address of address of first person whose first name is \"${firstname}\" and last name is \"${lastname}\""
Message was edited by: jazzy79

Similar Messages

  • How can I access Address Book data from an older version of the application to transfer it to a newer version of Mac OS running on a second hard drive on the same MDD G4?

    I installed a hard drive from one PowerPC Dual 1.25 GHz MDD into another one with an older version of the OS X.  all my Address Book data are on the older hard drive, from which I now boot the computer.  When I launch Address Book as an app on the hard drive with the newer version of the OS, I get an error message that says I cannot run the version of Address Book from the older hard drive on the newer OS.  How can I access the data on the older hard drive version of the Address Book app so that I can transfer it to the newer version of the app on the boot drive?  The "Import" functionality will not work. I will be grateful for any help I can get.  I would also like to uninstall the older version of OS X from the older hard drive.

    Boot from the older version of OSX, then in AB use the File>Export>Export vCard after selecting all in AB.
    Then boot from the new OSx & use the new AB to import that VCF file.

  • Accessing Address Book Remotely from PC

    I want to access/update my address book (on a Mac at home) from work (on a PC). Can this be done?

    Short answer has to be no.
    Longer - well, I suppose you could mount your Mac hard disk (using SMB?) on the Windows PC, which would let you see the address book data file - but that isn't going to be readable by a Windows program. You could consider running a Mac emulator on your windows machine, and so run Address Book, but you would still have the problem of persuading AB to look for its data file on the remote Mac rather than the local emulated one. You could go for more complicated(!!) solutions - run an app on the mac that would respond to messages from the PC, to retrieve or modify AB data. You could probaly even set up a web application on the mac to simplify it. But is it worth the effort?
    What are you trying to do?
    AK

  • How do I import Address Book data from an old Mac to a new one?

    I just bought a MacBook using OS 10.5.1. How can I transfer the address card data from my old eMac using system 10.3.9? The two machines are currently connected with a Firewire cable, and my laptop is reading the eMac's hard drive.

    It's actually very simple. In your old AB under the file menu click "Export Address Book Archive to your desktop. Then using the new system log in to the old via network and move the file from the old to the new.
    Then open the new AB and click import AB archive"
    You're done

  • Migrating iCal and Address book data from Mac Pro G5  10.5 to new iMac10.6

    I last week moved from my old Mac Pro G5 with OS 10.5 to a new iMac 2.8 GHz Intel core i7.
    I succeeded pretty well to move my different files from one computer to the other not using the Migration assistant, which wouldn't work properly, but using my older Mac Pro as target disk.
    Everything apparently works well with the exception of the transfer of data from iCal and my Address Book.
    As suggested in a previous thread : kimaccdual: A Basic Guide for Migrating to Intel-Macs, I tried to transfer the complete iCal and Address Book folders from : Home/Library/Application Support from the old to the new computer. This gave no result at all. Not any of the older data : appointments from iCal; names, addresses, phone numbers, etc (in actual fact : nothing) from the Address book application appears on the new iMac.
    Can any one make a suggestion as to what specific files with their exact location contain this information so that I could try to transfer these to my new computer with more success than so far.
    Thanks for your assistance
    Just for your information I succeeded to transfer Bookmarks from Safari, mails from Mail, iPhoto and iTunes data.
    What could be wring with iCal and Address Book ???

    Kappy,
    Thanks for your quick reply.
    I tried this for the iCal application, however without any success. In actual fact in Home/Library/Preferences I only found following references to iCal :
    com.apple.iCal.AlarmScheduler.plist
    com.apple.iCal.helper.plist
    com.apple.iCal.plist
    which i copied from the old to the new computer as well as the iCal folder in Application Support as suggested.
    As already said without any success.
    As far as Address Book is concerned only the same type of files, but related to AB, are located on both computers.
    Am I missing something or should I look for other files elsewhere f.i. in the "Contents" folder of the application itself ???
    Thanks for anybody's further assistance

  • I can't retrieve my address book data from G Drive to import to new addr book in Snow Leopard

    I am really annoyed by Apple these days. Just had to purchase iwork and sundry other software after upgrading to Snow Leopard and the Lion on my system. Now, have just received my wife's iMac from being "fixed" the hard drive was brloken. It was supposed to have had Snow Leopard uploaded for me. It was not so I have just done that, however I can't get the address book fron the G Drive to upload to the new system. Each time I access the address book on the G drive I get a message saying that it is an old system (4.1.1) and will not open in this system. How do I get that data off the G Drive and onto the upgraded iMac?

    Thank you for getting back to me.
    I tried what you said. I moved my old address book file into my new hard drive but it still opens "empty".
    When I look up my addresses in Spotlight it finds them and seems to recognize them at address book files but it doesn't want to open them. When I double click on them it opens address book but the not the file.
    When I click on the file and look at "more info" on it, I can see the information is in there.
    I don't want to loose all my contacts.
    On a side note do you have any easy tips for backing up?
    Thank you again,
    Trent

  • In trying to transfer my Address Book data from my old MacBook (OS 10.6.8) to my MacBook Pro (OS 10.7.5), I try to open to transferred Address Book and get the window asking if I want to add all the data; when I click yes, nothing happens.

    The new Address Book still show no data.  Then I tried to move the A B icon from the old computer file to the new computer icon and nothing showed up.  Confused!!

    Hi Piperman,
    If you are having issues transferring your contacts, you may find the following articles helpful:
    Contacts: Export and import your contacts
    http://support.apple.com/kb/PH11586
    Address Book 6.x: Export and import vCards
    http://support.apple.com/kb/ph4655
    Regards,
    - Brenden

  • Restore Address Book data from Time Machine back up

    Help! i sync'd my Address Book with Entourage Contacts and it deleted two years worth of contacts.  I have a time machine back up but don't know how to find the data to restore.  Can anyone help?

    Open your Address Book, when started launch Time Machine from dock. You should now see the Time Machine interface with the Address Book window. Click on the Arrow Up on the right side to fly back in time. Click until you see the contacts back in the Address Book window (or Click on the date on the ride side of the display). Mark the contacts in the window you want to restore and click on "Restore" on the bottom on the right side.
    Time Machine should now bring back your contacts from the backup to the actual running system.

  • Import address book data from Metadata cache files?

    Hi,
    A friend of mine has a PM Cube and the hard drive got some bad sectors. I believe he still had 10.4.8 on it. I was able to pull off most of the data from the bad drive but I have no addressbook.data file. I do have all the cache files in the Metadata folder, is there any way to import these files? The new drive I installed now has 10.4.9 on it.
    Thanks for your help!
    Sawtooth G4   Mac OS X (10.4.9)  
    Sawtooth G4   Mac OS X (10.4.9)  

    ok, try the following:
    quit ab in leopard
    select that address book folder in your old tiger home directory, then bring it to your leopard homefolder in the same location, i.e. homefolder/library/application support/address book
    then in that newly moved ab folder locate the following two items and remove them: Metadata folder and AddressBook-v22.abcddb file
    then launch ab in leopard and see if that solves your issue
    hope this helps

  • Accessing address book contacts from safari 'bookmarks'

    hey
    i'm only seeing 5 contacts when i click the address book tab in the safari bookmarks bar...but i should be seeing 512...
    i have reset safari, verified permissions, cleared cache, re-booted, all with no change...
    any ideas?
    THANKS

    i think what happened was a sync between my BlackBerry and the mac must have knocked out that information (somehow) hence the balls up.
    Hi William
    Clarification: Are you saying these web entries are not in your BlackBerry? If so, are you saying when you synched with the Address Book, the web field was overwritten by the BlackBerry, hence, deleting the entries from the Address Book?

  • E51 address book data access via Bluetooth to Garm...

    I have a new E51 but cannot access address book data via Bluetooth from a Garmin Sat Nav (model 310). Worked perfectly with old Nokia 6310, but returns a 'no can do' message when using the E51. Lack of this feature is a big problem - surely Bluetooth communication is supposed to work to a common standard. This is not good. Does anyone have a solution or know of a patch to cure this? Thanks.

    All metioned problems are Samsung's fault. Blame them.
    I've been assuming it was a Samsung problem, and have posted help requests in cell phone forums that Samsung engineers and/or support allegedly reads. I was hoping there might be some way to automate a workaround from the computer end...
    Now, if Address Book had an option to define the fields that are to be exported or perhaps automatically sub Company Names for last names the problem would be solved when exporting for cell phones. I can't belive no one has ever encountered this before -- it has been a problem with every cell phone I have ever owned.

  • Access Address Book from other applications

    Hi there,
    How can I access Address Book information from other applications (notably the command line, OpenOffice, etc.)?
    In particular, is there a command line utility to access and edit the Address Book?
    Thanks!
    Brian

    One of the best answers would have been the CPAN module: Mac::Glue. Cheers.

  • Where is Address Book data located?

    I know the Address Book application is located in applications but I can't find the old address book data from my previous internal hard disc (which information I am now accessing via an external reader).
    Thanks all!

    It's in your home folder, in Library/Application Support/AddressBook. Quit Address Book completely, and copy all files and folders therein to the same location on your new drive.
    Matt

  • Getting Address Book Data to new PC

    Hi.  I need to transfer address book data from my MacBook Air synced to an "old" iPhone 4s to a work pc and then synch that pc to a "new"  work iPhone 4s....any thoughts?  Thanks.

    Normally I'd just say to back up your address book and then use that to re-populate the new one. But you'll have to do some digging to find out if he two versions of the app are compatible.
    Not sure what you are running but the latest Leopard version is 4.1.1 (699).
    If all is good then just;
    +Address Book>File>Export>Address Book Archive...+
    Double click the resulting file on the Leo machine.

  • Exporting/importing Address  Book data

    Hi;
    Can we someone please tell me how to transfer my Address Book data from a G4 tower to a newer G5 tower? Thanks so much. -bjgroup.

    Hi bjgroup, and a warm welcome to the forums!
    On the G4 in Address Book, click on one address, then Select All, then from the File menu choose Export vCard, move that file to the G5 & in AB's File menu, choose Import>vCard.

Maybe you are looking for

  • Purchasing Document Open Interface Error - Blanket Purchase Agreement

    Hi all. I have a problem creating a blanket purchase agreement through the interface. What i did was this: INSERT INTO po_headers_interface (interface_transaction_id, batch_id, interface_source_code, process_code, action, group_code, org_id, document

  • I'm using OS X 10.6.8 my airport utility isnt working

    I just got a new airport/time capsule, when started set up it said my current airport utility was out of date i checked for softwear updates and didnt find that i needed one i search the apple site and found an updated airport utility and downloaded

  • Applework documents won't open

    Can I still buy Appleworks? I have quite a few documents on my old OSX saved in appleworks. However, I can't open them on my new imac because it doesn't have Appleworks installed - and Pages and Microsoft won't recognise the documents either. Where c

  • Using Airport express for dlink router on a PC

    Okay here is my question. I am trying to extend my netwok between my house and our guest house. I have a pc with a dlink router and modem. Bought a airport express thinking I could extend my network signal to the other house. There is about 50-60 fee

  • Non-grouped contacts?

    Is there any way I can tell which Contacts have not been assigned to a group? (I've tried figuring out how to set up a Smart Group to do this, but haven't figured it out.)