Basically I want the output from the program that I execute through the
exec command to be stored in a tcl/tk variable. I can then use that
variable in a message box as the text parameter.
Here is the code I am working with:
proc acknowledge {} {
set msg "This is a test"
tk_messageBox -default ok -icon info -message $msg -parent . \
-title Acknowledge -type ok
}
proc sendit {} {
global user
global type
set msg [.msgEnt get]
set action [string tolower $type]
set exe "/export/home/usupport/ORATOOLS/bin/$action"
catch acknowledge
exec $exe \"$msg\" $user ">/dev/null" "2>&1"
clearit
}
When this procedure gets executed it puts a message on another users
terminal. When the user clicks ok, the executed program sends a message
back to me through stderr to the xterm that I run the executable from. I
need a way to capture this info coming back into stderr so that I can
use it in the tcl program.
I have looked at tkerror/bgerror and catch but without much luck. The
catch seems to kind of work, but as soon as the executable program is
ran 'catch' senses that something is on stderr and kicks in. That is
correct, but at the time it starts, nothing has been written to stderr
yet.
Please email me directly as I am not on the comp.lang.tcl newsgroup.
Mike Campbell
mlca...@us.oracle.com
You have a shell-level command
/export/home/usupport/ORATOOLS/bin/$action
You want to launch it with two arguments, $msg, and $user.
$msg might have embedded white space, but not embedded double-
quotes. You know that .../$action will put its results on
stderr. You want to collect those results into a text variable.
Do this:
catch {/export/home/usupport/ORATOOLS/bin/$action \
"$msg" $user >/dev/null} text_result
"$text_result" now holds the output you seek.
--
Cameron Laird http://starbase.neosoft.com/~claird/home.html
cla...@NeoSoft.com +1 713 623 8000 #227
+1 713 996 8546 FAX
Hi mike
Don't know if you have gotten a reply already
But here you are:
set execResult [exec <cmd>]
should work the way you want it. You can then use "execResult" as a
variable. and do "string .." stuff on it.
-sre...@agcs.com, ku...@hotmail.com
(Srinivasan Krishnamurthy)