Hi all,
I would like to write a script that does something like this…
- Prompt for a date which I call “deadline” and a name that I call “filename”.
- Create a script object named “mail_reminder_2_weeks”. On run, this script creates and sends a message through Mail. The subject of the email is "Reminder: " & filename & " filing deadline is " & deadline
- Store the script on disk; the script will be run when an iCal open file alarm is activated on a date that I specify.
This is the script that I make.
script mail_reminder_2_weeks
tell application “Mail”
set message_2_weeks to make new outgoing message
set subject of message_2_weeks to “Reminder: " & filename & " filing deadline is " & deadline
set visible of message_2_weeks to false
set content of message_2_weeks to “nothing here”
set sender of message_2_weeks to “My Name myname@mac.com”
tell message_2_weeks
make new to recipient at end with properties {name:“My Name”, address:"myaddress@gmail.com”}
end tell
send message_2_weeks
end tell
end script
store script mail_reminder_2_weeks in (folder_path & “:” & (name of mail_reminder_2_weeks as string))
My problem is that the stored script does not know the values of the variables that were in effect when I wrote the script object (definition of the variables not shown in script). For instance, if name is “John Smith” and deadline is “January 1, 2007”, then I want the script to say
set subject of message_2_weeks to "Reminder: " & “John Smith” & " filing deadline is " & “January 1, 2007”
How can I replace the names of the variables with their values in the stored script?
Thanks,
Matt