opening it is easy, you can do that with any tool that invokes another program. There are a bunch of these, like shellexecute family, spawn family, system() which is frowned upon, and more. If you need to talk to it with your program, rather than just spawn it and let the user do whatever, that is more compex and you would probably need a library / sdk for that (its probably also doable for very basic stuff without it using pipes or something, depending on how complex you need the interface to be).
yes it is.
but my test(CPP test) include some other function that have to run before the tcl test.
I would like to run my main script(cpp) and this one will open tcl shell that will run some pre-define tcl test, this is way I'm looking for tcl shell.
can you call tcl spawn with the input to run the code you want?
What I mean is that calling tcl.exe or whatever it is will start a command window, on par with spawning a dos/cmd prompt window, which then sits there like a lump until the user types things into it. But some programs support calling them with things, eg system("g++ myprogram.cpp") would work but system ("cmd a.exe") would not; cmd does not accept a command this way.
you need to test that out.
can you invoke tcl to do what you want it to do, from the command line only, with parameters?
If the answer to that is yes, then my approach will do it for you.
if the answer is no, you need something a little stronger.
If the user is expected to interact with the TCL program and make things happen, my approach is also still valid.
just tried to solution provided,
this is the command I ran -
ShellExecuteA(nullptr, ("open"), "C:\Tcl\bin", "parameters", nullptr, SW_SHOW);
but I received an error code 2.
in addition, there is option to invoke tcl shell and tun into the tcl path to run?
I found a way to run the tcl test with the command system();
any chance that someone know how to see the automation script run ?
the tcl include some input from the user, in this case when I using system() I don't have the option to see the output and can not insert the information.
I am not sure why you have been getting the answers you are getting...
It depends entirely on your OS. Suppose you want to run the Tcl script file “hello.tcl” with the single argument “world”. I assume that the script is NOT a GUI script, and that your user has tclsh properly installed. (You must also consider that the script and executable have matching versions.)
-1 means that the script failed to execute 0 means that the script executed and terminated successfully >0 means that the script executed and terminated reporting some kind of failure
All I/O should appear in the same command window as your application’s (if your app is a non-GUI). If your application is a GUI then you may need to add a little additional logic to the Linux version to launch a terminal emulator. I have not bothered to do this... and I don’t recall how to do it off the top of my head. Let us know if you need that. (It isn’t difficult.)
BTW, andywestken’s links are a really good place to start if you want to bind Tcl and your application more tightly than simply executing a subprocess and waiting for it to terminate, including good information about why embedding Tcl is usually the wrong way to do it.
From what I understand of your question, though, simply frobbing std::system() is sufficient.