Title: Re: Entourage Script for a Single Contact
With the following script:
   try
       set theContact to item i of (get selection) -- this evaluates to the true content
       if class of theContact is not contact then
           error number -128
        end if
   
   on error
       
   beep
           display dialog "Address Book Contact must be kept open"
        
   return
   end try

I always get the error message. Any help it what dumb mistake I’ve made this time?
    Peter


On 3/1/03 4:57 PM, "Peter Wait" <[EMAIL PROTECTED]> wrote:

  1. Is there a way to trigger a script to execute just when a Contact is Saved?

Not automatically. But it's easy enough, because in order to open it you had to select it in the Address book or a Custom View. So you can get it from the selection, as long as you haven't, say, changed the main window to Mail in the meantime.

And
        If so, What do I set “theContact” to, in the following extract from my current script?
       
            set contct to every contact
            repeating thru all the contacts:
                set “theContact” to item i of contct

Thanks in advance for any help.

try
    set theContact to item 1 of (get selection)
    if class of theContact is not contact then error number -128
on error
    beep
    display dialog "You must keep the Address Book (or Custom View) where you selected the contact still open in the main window just behind."
    return
end try
--rest of script

It also works if you run it just after closing the contact window. Or you can do it this way, but only if you run it while the contact window is open:

set windowName to name of window 1
try
    set theContact to contact windowName
on error
    beep
    display dialog "You first have to save the contact, and must keep its window open until you run the script."
    return
end try
--rest of script
close window 1


Reply via email to