Read the results of "do shell script" as they come in

Hi everyone,

Recently I’m using the great video converting utility mencoder a lot. But it only has a command line interface. I hate to open Terminal and type words just to convert a movie which QuickTime can’t handle. So I got the idea of making a simple AppleScript droplet application that converts the movie. And I decided to make a progress bar. ( problem is that, how do I get the output of “do shell script” BEFORE the script finishes executing?

I’ve heard of things like background server process, which returns immediately after the process has started. But how do I get the output of it?

Here’s what I have now:
Open this Scriplet in your Editor:

property encpath : ((path to me) as text) & "Contents:MacOS:mencoder"

on run
   my convert((choose file with multiple selections allowed and invisibles) as list)
end run

on open movies
   my convert(movies as list)
on convert(movies)
   set ProgressBar to load script alias (((path to me) as text) & "Contents:Resources:BP Progress Bar Controller.scpt")
   tell ProgressBar
       initialize("Movie Converter")
       setStatusTop to "Converting..."
       setStatusBottom to "Calculating time remaining..."
       setMax to 100 *(the count of movies)
   end tell
   repeat with movie in movies
       set the_path to the POSIX path of movie
       set the_cmd to the (POSIX path of alias encpath) & " " & the_path & " -o ~/Desktop/" & rmExt(movie) & ".avi -oac mp3lame -ovc lavc"
(*What should I do here? *)
       do shell script the_cmd
(* Or here?*)
   end repeat
   tell ProgressBar to quit
end convert

on rmExt(f)
   tell (info for f) to set {Nm, Ex} to {name, name extension}
   set BN to text 1 thru ((get offset of "." & Ex in Nm) - 1) of Nm
   return BN
end rmExt

Thanks in advance

Maybe PipeAlert will do what you are looking for.