Re: Opening contact in Address Book to edit
Re: Opening contact in Address Book to edit
- Subject: Re: Opening contact in Address Book to edit
- From: kai <email@hidden>
- Date: Wed, 5 Apr 2006 10:28:49 +0100
On 4 Apr 2006, at 16:22, Sweth Chandramouli wrote:
I'd like to write a script that will open up a particular contact
in Address Book, switch to edit mode, and place the cursor at the
beginning of the input area for the notes for that contact; I can't
find anything in the AB dictionary that refers to whether a particular
record is in edit mode or not, though, nor can I figure out how to
move the cursor. Are those things that I can only do via GUI
scripting?
If so, any pointers on how to do that would be appreciated, as I
haven't
ventured into GUI scripting at all yet.
You'll probably have to resort to GUI scripting for most of this,
Sweth. The following might help to get you started. (Since certain UI
elements are referenced by name, some modification may be required
for non-English localization.)
---------------
to edit_AB_note for targetName
tell application "Address Book"
if (count (people whose name is targetName)) is 0 then return beep
activate
end tell
tell application "System Events" to tell process "Address Book"
if not (exists window "Address Book") then click ¬
menu item "Address Book" of menu ¬
"Window" of menu bar item "Window" of menu bar 1
tell window "Address Book"
perform action "AXRaise"
tell row 1 of outline 1 of scroll area 1 of splitter group 1
set columnView to exists
if columnView then set value of attribute "AXSelected" to true
end tell
tell application "Address Book" to set selection to ¬
first person whose name is targetName
tell button "Edit"
if columnView then click
if help starts with "Edit" then click
end tell
tell scroll area -1 of splitter group 1
set value of scroll bar 1 to 1
set value of attribute "AXFocused" of ¬
(first text field whose help is "Note") to true
key code 123
end tell
end tell
end tell
end edit_AB_note
edit_AB_note for "Homer Simpson" (* modify target name as required *)
---------------
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden