I'm having some trouble generating a custom e-mail reminder for certain events in Applescript.
February 6, 2004 1:09 PM   Subscribe

Applescript help, please. I'm trying to generate a custom e-mail reminder for certain events [MI]

I'm using iCal to schedule events, and what I want to do is send a customized message to a group address--perversely, iCal has a built-in feature for e-mailing reminders, but doesn't seem to let you remind anyone other than yourself. I'd also like to customize the text of the reminder.

Here's what I've got:
tell application "iCal"
set theloc to location of this
set thetime to startdate of this
set thesum to summary of this
set thenotes to description of this
set theAddress to [some address]
set theSender to [some address]
end tell
set theSubject to "Reminder" & thesum & " at " & theloc & " on " & thetime
set theBody to thenotes
tell application "Mail"
set newMessage to make new outgoing message with properties {subject:theSubject, content:theBody & return & return}
tell newMessage
set visible to false
set sender to theSender
make new to recipient at end of to recipients with properties {address:theAddress}
end tell
end tell
end try

The problem clearly is with "this". I need to pass the iCal event that called the script as a parameter somehow.

Thanks in advance
posted by adamrice to Computers & Internet (4 answers total)
As far as I can tell, iCal doesn't do that, as evidenced by the fact that iCal scripts are written using a standard run handler instead of a custom handler to which an event could be passed. Some programs have an application property for this (e.g. Entourage has a "current messages" property which returns a list of the message(s) being filtered and/or the currently open or selected message(s) if the script is run outside a filter) but iCal does not seem to have this either.

What you will probably want to do is have iCal send the message to your mailbox as usual, then have your mail client detect it and forward it to whoever else should get it using a filter.
posted by kindall at 3:59 PM on February 6, 2004

adamrice, go to your mail tool and create an account for the group. Then you'll be able to select it as a destination in the iCal event window.
posted by substrate at 4:13 PM on February 6, 2004

just for clarification, you just need to create the account. It doesn't need to be fully filled in.
posted by substrate at 4:14 PM on February 6, 2004

The easiest way to add the group address is to go into Address Book and add the group address to your own address card. relaunch iCal and the group address will show up as a possible destination for the notification e-mail.
posted by andrewraff at 9:26 AM on February 7, 2004

« Older What Are These Keys on my Computer Keyboard?   |   How to Put in a Power Outlet in a Basement Closet Newer »
This thread is closed to new comments.