Passing data to AppleScript -- email generation

Sivakatirswami katir at
Sun Jan 2 18:10:51 EST 2005

Once again, I'm a bit perplexed by applescript, which I never properly 
learned.  Current attempts to pass a large body of text containing 
quotes, colons etc to the body of an email via applescript are failing.

(aside: the GURL apple event still seems to fail so we have to use this 
manual appleScript build as revGoURL doesn't work seem to work with 
multiple parameters, sender, recipient, subject, body)

In a simple test example:

on mouseUp
   put fld "Text" into tNewBody
   replace quote with ("\"&quote) in tNewBody # this works
     replace ":" with ("\:") in tNewBody # this doesn't
put fld "appleScript" into tScript
replace "#date#" with (quote & "HPI, January 3rd, 2005" & quote) in 
replace "#body#" with (quote & tNewBody& quote) in tScript
do tscript as applescript

end mouseUp

Where the apple script is:

on run
	set theSender to "Hindu Press International <hpi.list at>"
	set theName to "Hindu Press International"
	set theAddress to "hpi.list at"
	set theSubject to #date#
		set theBody to  #body#
	tell application "Mail"
		set newMessage to make new outgoing message with properties 
{subject:theSubject, content:theBody & return & return}
		tell newMessage
				set visible to true
			set sender to theSender
			make new to recipient at end of to recipients with properties 
{name:theName, address:theAddress}
		end tell
	end tell
end run


fails when the text being passed as the body contains colons ":" of 
which there are many (URLs "") 
, simply escaping the colon "\:" prior to inserting it into the 
appleScript doesn't work either. Apple script won't compile it.

Any insights? as often, with appleScript, I may just abandon it and go 
for a pure xTalk solution. Where is our latest rev libSMPT these days? 
Are we happy with it?

Sannyasin Sivakatirswami
Himalayan Academy Publications
at Kauai's Hindu Monastery
katir at,

More information about the Use-livecode mailing list