/*
Automatic Mail.app E-mail Demo
This FB^3 OS X Demo will automatically format
an e-mail message in OS X's Mail.app. Message
length is limited to 255 characters. It operates
relatively quickly, especially if Mail is already
launched.
(User must manually send message from Mail.)
Ken Shmidheiser
Somerset, KY
June 14, 2004
*/
INCLUDE "Subs AppleScript.Incl"
local fn QuickMailEMail$( name as str255,¬
recipient as str255,¬
subject as str255,¬
message as str255,¬
sender as str255 )
'~'1
dim as OSErr err
dim as str255 result
ROUTE _toAppleScript
print "set theName to """ + name + """
print "set theAddress to """ + recipient + """
print "set theSubject to """ + subject + """
print "set theBody to """ + message + """
print "set theSender to """ + sender + """
print "tell application ""Mail"""
print "set newMessage to make new «class bcke» with properties ¬
{«class subj»:theSubject, «class ctnt»:theBody & return & return}"
print "tell newMessage"
print "set visible to true" //set to false to hide Mail.app window
print "make new «class trcp» at end of every «class trcp» ¬
with properties {name:theName, «class radd»:theAddress}"
print "end tell"
print "activate"
print "end tell"
route _toScreen
err = usr AppleScriptRun( result )
if (err != _noErr) then result = str$( err )
end fn = result
dim as str255 name, recipient, subject, cc, bcc, message, sender
name = "Ken"
recipient = "johndoe@abc..com"
subject = "Final test"
message = "Test message goes here"
sender = "janesmith@..."
fn QuickMailEMail$( name, recipient, subject, message, sender )
end
include "Subs Quick Event Loop.Incl"