Slug: help-osascript-shell-mailapp Date: 2002-10-05 Title: (HELP) osascript, shell, Mail.app layout: post

I need some help with Applescript, osascript, and some shell script.

I have an Applescript (shamelessly ripped off from iCal) that opens a new email in Mail app with the to: subject: and body already set. I want to use it from Sid, but I can't figure out what iCal is doing with it.

The script looks like this:

tell application "Mail"
	activate
	set mysubject to "$1"
	set mybody to "$2"
	set mymail to (make new outgoing message
		at the beginning of outgoing messages with
		properties {subject:mysubject,content:mybody})
	set visible of mymail to true
end tell

I assume that iCal is running this through a shell script that takes the args and replaces them in the text of the script (osascript does not handle args yet) then running the script through osascript, but I can't seem to get it to work. I'm no shellscript guru, and I've got no good reference right now to check out. If you can help out with this, I'd be really grateful (and include eternal thanks to you in the credits!)