---- '''EDIT/RECENT CHANGES''' * Edit this page: http://wiki.tcl.tk/edit/12768@ * Back to Recent Changes: http://wiki.tcl.tk/4 ---- '''NAVIGATION''' * '''Home''' to the .................: [Answered Questions Index Page] * '''Back''' to ........................: [Answered Questions On: HTTP/FTP Etc] * '''Forward''' to ...................: [Answered Questions On: Iwidgets bindings, Iwidget childsites] * Ask '''New Questions''' at ....: [Ask, and it shall be given.] ---- '''TABLE OF CONTENTS (Interprocess Communication):''' * Does Tcl Support "SendKey" And "SendMessage" (For Controlling Other Windows Applications)? * Using Exec To Capture A Child Processes Stdout And Stderr * How Does One Tcl Interpreter Access Variables/Values In Another (Tcl Interpreter)? * How Do I Pass A Variable/Value To A Child Interpreter? * Calling COMMAND.COM/cmd.exe With Exec (Or WinUtils::Shell/Launch) Under DOS/Windows ---- '''Does Tcl Support "SendKey" And "SendMessage" (For Controlling Other Windows Applications)?''' 22/09/2003 Does Tcl includes the ability to control other applications, e.g. notepad? Other programming languages provide commands like Sendkey (VB) or Sendmessage (VC). So I can executing notepad, putting text into textbox and saving that in a file. That's all possible because of controlling menuoptions by sending Windows-Messages ... It is possible in Tcl too? [RS]: See [tcom] for COM support, but not sure whether Notepad understands that.. JPT: You could also try [cwind] (http://mini.net/tcl/5019). I've used it once and it did the (simple) job I had to do. ---- '''Using Exec To Capture A Child Processes Stdout And Stderr''' Sep 26 - 2003 I want to make a frontend to gcc in tcl. if {[catch {exec gcc -c $Compiler_Flags $Filename } Result]} { puts $Result exit 1 } I want to map gcc's output messages to stdout and stderr, while the command runs. I could direct it to a file, but we'll proberbly be running this frontend, several persons at the same time. [RS]: Experiment with eval exec [list gcc ... > @stdout 2> @ stderr $Compiler_Flags [list $Filename] ---- '''How Does One Tcl Interpreter Access Variables/Values In Another (Tcl Interpreter)?''' 08/26/2003 INTERCOMMUNICATION You start two wish-interpreters, wish1 and wish2. In wish1 you create a variable: % set x(val1) 0 0 My question: How can I make x accessable for wish2? Thanks for all solutions or ideas! PB [FW]: What OS are you using? Do you mean multiple executions of one interpreter, or a slave interpreter within one application? Are you developing cross-platform? If you mean multiple applications, you're in luck by using Tcl, which is very strong for inter-application communication. Tk has a built-in [send] command, and the [comm] package provides similar functionality via sockets that works cross-platform. It's even easier with slave interpreters - just look at the [interp] page to find out how to send commands to a slave interp. PB: I'm using XP for this project and primarily I try to find an easy concept for an applications conversation and interp is my favorite now. Thank you... [FW]: So does that mean you're using slave interpreters or separate applications? PB: (curios?) I use slave interps althought separate applications would be better. therefore better because if master interp has a problem, slaves will have a problem too. sure, there are possibilities to catch and handle such cases, but that costs a lot of time and time is money. on the other side I have a problem to exchange common data using seperate applications because they run in different enviroments. [FW]: Thanks for clarifying. Just use [[interp eval]] to run commands within the slaves. If and when you start using separate applications, I'd use the [comm] package (based on the venerable [send]) for inter-app communication. ---- '''How Do I Pass A Variable/Value To A Child Interpreter?''' 02/04/2004 Hi, does someone knows if I can access a variable in child-interp-context? proc change_dir { __dir } { interp create child interp eval child {cd $__dir} ... } I know, in interp child $__dir does not exists. Is there a way to put a value from invoking interp into child-interp? Perhaps with interp alias? PB [RS]: In your case it's even easier, just substitute the variable before calling interp eval: interp eval child [list cd $__dir] ;# :-) ---- '''Calling COMMAND.COM/cmd.exe With Exec (Or WinUtils::Shell/Launch) Under DOS/Windows''' 04/Aug/2003 when I am using below systax executing in tcl/tk, then I am getting error. Syntax is set dirinfo [exec command.com/c dir] Error I am getting, when I am executing this is 'invalid command name "command.com/c"' How can I execute this? Could you please suggest me. [lv] does [DOS bat magic] help? [RS] Put a space between the filename command.com and the switch /c. DOS shells can do without the space, but Tcl requires whitespace between words. ----