• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: AppleScript and shell scripting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AppleScript and shell scripting


  • Subject: Re: AppleScript and shell scripting
  • From: Philip Aker <email@hidden>
  • Date: Mon, 30 Jul 2007 05:40:40 -0700

On 2007-07-29, at 09:55:25, Michelle Steiner wrote:

How would you add an email address to a contact (AKA: person) in the Address Book using perl or tcsh?

Here is how to do it with Applescript:

tell application "Address Book"
tell item 1 of (get the selection) to make new email with properties {label:"home", value:"email@hidden"}
save addressbook
end tell

I don't know about perl, but in Tcl it's an add-on for MacOS X available at: <http://perso.orange.fr/bdesgraupes/tcl.html>


and the call is something like:

addressbook set $theid Email {{Work email@hidden} {Concerts email@hidden}}



You may also use the reverse equivalent of 'do shell script' in Tcl to use AppleScripts directly:

AppleScript execute {
tell application "Address Book"
tell item 1 of (get the selection) to make new email with properties {label:"home", value:"email@hidden"}
save addressbook
end tell}



The address book is not something that belongs exclusively to the Address Book application. There's a shared address book reference available with a C language call:


	ABAddressBookRef ABGetSharedAddressBook(void);

so technically speaking you're actually burning an application 'tell' block in AppleScript to manipulate your address book.

You can use Hamish Sanderson's utilities for Ruby and Python to script the Address Book application. For other shell situations, such as bash or tcsh you'd use 'osascript'.


Philip Aker email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
References: 
 >Re: AppleScript and shell scripting (From: Ed Stockly <email@hidden>)
 >Re: AppleScript and shell scripting (From: Bill Briggs <email@hidden>)
 >Re: AppleScript and shell scripting (From: Doug McNutt <email@hidden>)
 >Re: AppleScript and shell scripting (From: Michelle Steiner <email@hidden>)

  • Prev by Date: Re: AppleScript and shell scripting
  • Next by Date: Re: AppleScript and shell scripting
  • Previous by thread: Re: AppleScript and shell scripting
  • Next by thread: Re: AppleScript and shell scripting
  • Index(es):
    • Date
    • Thread