Rev & Applescript

Jim Ault JimAultWins at yahoo.com
Tue May 3 20:03:01 EDT 2005


>I've gotten the first script to work (has one
>file attachment) but the second does not. I don't know if my repeat loop is
>not correct or the way I'm delimiting the file attachments, or both.
>
>WORKS:
>tell application "Mail"
>     set theSubject to "Test Order"
>
>DOESN'T WORK:
>tell application "Mail"
>
>         tell content
>             repeat with fileName in fileList
>                 make new attachment with properties {file name:fileName} at
>after the last paragraph
>             end repeat
>         end tell
>     end tell
>
>--
>Any ideas?

I believe you do this on one code line rather than repeat.  each
make new attachment with properties {fileList} at

---Further -- here is a working example from a recent post to the list
uses a field "text" as the message, and does 2 replace steps
uses a field "appleScript", does a date replace, and a message replace

I prefer to name any of my objects, scripts and variables with names 
that are NOT reserved words, like repeating the last char of the word 
"item" -> "itemm" so there is not doubt that it is my variable.

Note: be sure that the fld "scriptInit" is a shared, background 
behavior fld or the applescript will only be available on one card. 
Of course you could do "...fld "scriptInit" of card 1 of this stack"

submitted to this list previously ===========
On Jan 2, 2005, at 1:10 PM, Sivakatirswami wrote:
on mouseUp
   put fld "msgText" into tNewBody
   replace quote with ("\"&quote) in tNewBody
     replace ":" with ("\:") in tNewBody

put fld "scriptInit" 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:
Note the

========
tell application mail
	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 tell
------------------
Now back to me.
This should work without much trial and error, but that is the fun of 
discovery :-)

Jim


More information about the use-livecode mailing list