Can somebody explain how to adjust the following AppleScript so that I
can select an addressee (in a 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).

I think it could be done, but what do I know? If I am wrong, and it would
involve way more than a simple adjustment, please let me know too? Thanks
in advance for any tip and info.

---marlyse

// Following the AppleScript I am using out of Apple's Address Book:

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