send email with do script

I am encoding with ffmpeg and using applescript folder action.

I would like to get an email when ffmpeg has finished the the encode.

I start ffmpeg off with


tell application "Terminal"
			activate
			do script "/usr/local/bin/ffmpeg

etc etc

I have been able to generate an email with this


do shell script "mail -s \"" & baseName & "_" & cur_time & ".mp4\" " & "\"user@gmail.com\" <<EOF"

But only when its outside of the “do script” and as a “do shell script”


do script "mail -s \"" & baseName & "_" & cur_time & ".mp4\" " & "\"user@gmail.com\" <<EOF"

fails

The problem is if I “do shell script” then applescript starts the ffmpeg encode and then straight away moves on to the do shell script and emails before the encode finishes.

any ideas where I am going wrong here?
Thanks in advance
L

replace it with


do shell script "/usr/local/bin/ffmpeg .....

My problem is if I use only the “do shell script” that I dont see a terminal window showing its progress.
If I “do script” it opens a terminal window and tells me how its going with the encode.
Its something that I really need.
is there a way to achieve both? ie an email and see the progress of the encoding?

maybe something like this


tell application "Terminal"
	activate
	set myshell to do script "/usr/local/bin/ffmpeg
	repeat until busy of myshell is false
	end repeat
end tell
-- send mail code here

thanks for that.
I will give it a try

I did however find a way
In my “do script” I put a ; after the ffmpeg code and then


echo \"body\" | mail -s subject user@gmail.com

and it works now

thanks again
L