The following script I use in Apples Address Book to create a todo/phone
in iCal with a selected person (I have a similar script to create a timed
meeting too). This is very handy, also because it creates a link to the
Address Book for the phone number and name and I use it with alarms. 

Now I often receive an email where I need to follow up in so-and-so many
days and I would like to do something similar right out of PM into iCal,
i.e. have an AS that allows me to select an addressee (in the received
email, in the From line or ReplyTo line) and create a ToDo in iCal to
remind me about emailing then-and-then plus including the email as
attendee so I can simply select it to email when it is time to do so.
(Hope this makes sense).

Can somebody tell me how I would need to adjust the following AS to be
able to use it as described in PM?

Thanks in advance for any tip and info.
---marlyse

using terms from application "Address Book"
        on action property
                return "phone"
        end action property
        
        on action title for p with e
                set theName to (first name of p) & " " & (last name of p)
                return "Schedule call to " & theName
        end action title
        
        on should enable action for p with e
                return true
        end should enable action
        
        on perform action for p with e
                set theName to (first name of p) & " " & (last name of p)
                scheduleCall((id of p), theName)
        end perform action
        
end using terms from

on scheduleCall(id, name)
        tell application "iCal"
                set callist to my get_cal_titles() (*get cal titles*)
                set selectedcals to (choose from list callist) as Unicode text 
(*do
menu with cal titles*)
                set thecal to first calendar whose title is selectedcals 
(*identify
selected cal in iCal*)
                
                set theItem to (make new todo at end of todos of thecal)
                set summary of theItem to "Call " & name
                set url of theItem to "addressbook://" & id
                
                activate theItem
                show theItem
        end tell
end scheduleCall

on get_cal_titles() (*gets a list of strings of calendar titles*)
        set list_of_cals to {}
        tell application "iCal"
                repeat with aCal in calendars
                        set list_of_cals to list_of_cals & (title of aCal as 
string)
                end repeat
        end tell
        return list_of_cals
end get_cal_titles


Reply via email to