OS win98
Hi, i've got an console application launcher (below) which redirects the dos box output into a text window, this is fine if no input is required from the user but how do I get keyboard input into the application if it requires it?
TIA
Mark
TCL code follows:
# console show
button .app -text "select exe file" -command getappfile
pack .app -pady 5
# Create a text widget to log the output
frame .t
set log [text .t.log -width 80 -height 10 -borderwidth 2 -relief raised -setgrid true -yscrollcommand {.t.scroll set}]
scrollbar .t.scroll -command {.t.log yview}
pack .t.scroll -side right -fill y
pack .t.log -side left -fill both -expand true
pack .t -side top -fill both -expand true
set but [button .run -text "run exe file" -command Run]
pack .run -pady 2
button .quit -text "exit" -command exit
pack .quit -pady 2
proc getappfile {} {
global command but
set types {
{".exe files" {.exe}}
}
set command [tk_getOpenFile -filetypes $types]
}
proc Run {} {
global command input log but
if [catch {open "|$command"} input] {
$log insert end $input\n
} else {
fileevent $input readable Log
$log insert end $command\n
$but config -text Stop -command Stop
}
}
# Read and log output from the program
proc Log {} {
global input log
if [eof $input] {
Stop
} else {
gets $input line
$log insert end $line\n
$log see end
}
}
proc Stop {} {
global input log but
set line "done...."
$log insert end $line\n
$log see end
catch {close $input}
$but config -text "Run exe file" -command Run
}
Hi, i've got an console application launcher (below) which redirects the dos box output into a text window, this is fine if no input is required from the user but how do I get keyboard input into the application if it requires it?
TIA
Mark
TCL code follows:
# console show
button .app -text "select exe file" -command getappfile
pack .app -pady 5
# Create a text widget to log the output
frame .t
set log [text .t.log -width 80 -height 10 -borderwidth 2 -relief raised -setgrid true -yscrollcommand {.t.scroll set}]
scrollbar .t.scroll -command {.t.log yview}
pack .t.scroll -side right -fill y
pack .t.log -side left -fill both -expand true
pack .t -side top -fill both -expand true
set but [button .run -text "run exe file" -command Run]
pack .run -pady 2
button .quit -text "exit" -command exit
pack .quit -pady 2
proc getappfile {} {
global command but
set types {
{".exe files" {.exe}}
}
set command [tk_getOpenFile -filetypes $types]
}
proc Run {} {
global command input log but
if [catch {open "|$command"} input] {
$log insert end $input\n
} else {
fileevent $input readable Log
$log insert end $command\n
$but config -text Stop -command Stop
}
}
# Read and log output from the program
proc Log {} {
global input log
if [eof $input] {
Stop
} else {
gets $input line
$log insert end $line\n
$log see end
}
}
proc Stop {} {
global input log but
set line "done...."
$log insert end $line\n
$log see end
catch {close $input}
$but config -text "Run exe file" -command Run
}