Passing data to AppleScript -- email generation

Sivakatirswami katir at hindu.org
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 
tScript
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 hindu.org>"
	set theName to "Hindu Press International"
	set theAddress to "hpi.list at hindu.org"
	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
		activate
	end tell
	
end run

=====

fails when the text being passed as the body contains colons ":" of 
which there are many (URLs "http://foodomain.com/someNewsRelease.html") 
, 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 hindu.org

www.HimalayanAcademy.com,
www.HinduismToday.com
www.Gurudeva.org
www.Hindu.org



More information about the Use-livecode mailing list