cwind on avi2vcd

I (VI) wanted to batch convert many avi's of my daughter into vcd's. Grandparents don't settle for less :). The process takes a long time. At home, I'm stuck with windows. I've found that the freeware encoder at [L1 ] works well. But there are a few things I'd like. A batch convert mode or at least a complex enough command line to do encoding and exit. Also on my home PC, avi2vcd crashes if I encode twice in a row. I have to exit the program after each convert.

Here's a script using cwind to automate this. cwind is a wonderful package, and I've used it in all kinds of situations. This is using version 1.4.

 package require cwind
 # Procedure to convert one avi file to a pal format in a subdir
 # called pal.   Fix path to avi2vcd below.
 proc do_conv {fn} {
     if ![file exists $fn] {
         puts "Error Can't find file $fn"
     set  target [file join pal [file root $fn].mpg]
     # Do not reconvert if we already have a newer mpg
     if {[file exists $target] &&
         ([file mtime $target] > [file mtime $fn])} {
         puts "Target \"$target\" is newer than source \"$fn\", not converting"
         return 1
     set start [clock seconds]
     puts "Will convert $fn into $target at [clock format $start]"
     file mkdir pal
     file delete $target
     # Fix this path to point to your own executable
     exec start c:/tools/avi2vcd/avi2vcd.exe &
     ::cwind::waitwind "avi2vcd*" 20
     # Raise it.
     ::cwind::show "avi2vcd*"
     # Move to Source File
     ::cwind::send |TAB| |TAB|
     ::cwind::send [file nativename [file normalize $fn]]
     # Move to Target File
     ::cwind::send |TAB|
     ::cwind::send [file nativename [file normalize $target]]
     # Move to Format.  First go all the way up and down to
     # whatever you want.  One down gets you to PAL
     ::cwind::send |TAB| |TAB| |TAB|
     ::cwind::send |UP| |UP| |UP| |DOWN|
     # Start the convert
     ::cwind::send |TAB| |TAB| |TAB| |TAB| |TAB| |RET|
     set t [::cwind::gettext]
     # avi2vcd puts out a dialog box to say it's ended
     # remove the puts if you don't want to see the messages
     # we check every 5 seconds to see if a dialog box (no title)
     # has been displayed
     while {$t != ""} {
         after 5000
         set t [::cwind::gettext]
         puts $t
     set end [clock seconds]
     puts "Done in [expr $end - $start] seconds"
     # Remove the dialog box
     ::cwind::send |RET|
     after 5000
     # Raise window, in case it's gone away
     ::cwind::show "avi2vcd*"
     after 1000
     # Move to the exit button and exit
     ::cwind::send |TAB| |RET|
     # Probably could be shorter, but program has to exit
     # otherwise the delete below doesn't work.
     after 5000 
     # Delete the log file that avi2vcd creates
     file delete [file root $target].log
     #Probably not needed again but prevent multiple invocations
     #in parallel. (or maybe could be shorter)
     after 5000
 # Procedure to run the encoder on all the avis in the current
 # directory
 proc do_all_avis {} {
     foreach avi [glob *.avi] {
         do_conv $avi