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: Mon, 10 Apr 2006 23:18:48 +0100
On 8 Apr 2006, at 06:08, Sweth Chandramouli wrote:
That example was EXTREMELY helpful; thanks much. The larger task that
I'm trying to automate is that I often need to date/time stamp my
notes
in the AB, and since I'm eventually going to be importing them into
another app that can store a list of notes rather than just a single
large note for each contact, I also have gotten in the habit of
putting
a delimiter around each note so I can easily break the AB notes into
individual mini-notes for that other app. So I took kai's example,
and
changed the "tell scroll area" block to:
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
keystroke return & theDelimiter
set value of attribute "AXFocused" of ¬
(first text field whose help is "Note") to true
key code 123
keystroke theDelimiter & short date string of (current date) & ": "
end tell
. That works fine--but it's very slow, taking about 30 seconds
between
when I invoke the script and when the AB is ready for me to start
typing my note. I tried converting it to a script that would only
be run when the contact to which the note should be added was already
selected (e.g. took out the tests to make sure we've got a valid
contact
and that we're in column view), but that didn't speed things up
noticeably. Is there anything else I should look at in terms of
speeding this up?
Now that I see what you're actually doing here, Sweth, I wonder if
you really need to carry out the manual editing in Address Book at
all. Since it's likely that all the GUI stuff is slowing things down
significantly, I'd be tempted to enter each new note in a plain old
dialog, wrap it up in the required format and delimiters - and then
get AB to add it to any existing notes. With this approach, it's not
necessary to display the target card (or even have Address Book
visible).
This should help to demonstrate the sort of thing I mean:
--------
property theDelimiter : tab (* or whatever it might be *)
to add_note for targetName
tell application "Address Book" to set currentMatch to (people whose
name is targetName)
if (count currentMatch) is not 1 then return beep
set currentPerson to first item of currentMatch
set newNote to text returned of (display dialog "Add note for " &
targetName & ":" default answer "")
if (count newNote) > 0 then tell application "Address Book"
tell currentPerson
set currentNote to note
if currentNote is missing value then set currentNote to ""
set note to theDelimiter & (current date)'s short date string & ¬
": " & newNote & return & theDelimiter & currentNote
end tell
save addressbook
end tell
end add_note
add_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