Re: AppleScript and shell scripting
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