tclsh set socket_handle [socket 127.0.0.1 9229] foreach file {../test/1/data/Symbols.txt ../test/2/data/Symbols.txt ../test/3/data/Symbols.txt ../test/4/data/Symbols.txt jules.1.txt jules.2.txt jules.3.txt jules.4.txt becca.1.txt becca.2.txt becca.3.txt becca.4.txt} { set symbols {} set handle [open $file] while {![eof $handle]} { set line [gets $handle] if {[regexp {^[A-Z]+$} $line]} { lappend symbols $line } } close $handle set command "command=add_list&symbols=[join $symbols ,]\r" puts -nonewline "Press enter to load $file ([lindex $symbols 0])" flush stdout gets stdin puts $socket_handle $command flush $socket_handle }