CMDret - return output from console progs [DLL version]
Wooo Hooo!
I got the DLL, got my tail.exe and mix em up in the same bowl and its LIKE BUTTER BABY!!!!
BCX looks cool too corrupt - thanks for introducing me to another programming platform as well.
V.
If you're running the program in the command line environment of Windows NT/2000/XP/2003, you can use the "2>" syntax to redirect error output and separate it from standard output, as inmy program should also run in the command line environment, which does not separate stderr and stdout - they get mixed
Program parameters >StdOut.txt 2>StdErr.txtJacques.
If you want both stdout and stderr to go to a single file, you can use:
Program parameters > Stdout-err.log 2>&1
Thanks & you're welcome .I know most others have already said, but just wanted to give the big
Wooo Hooo!
I got the DLL, got my tail.exe and mix em up in the same bowl and its LIKE BUTTER BABY!!!!
BCX looks cool too corrupt - thanks for introducing me to another programming platform as well.
V.
basically, I have to agree that corrupt’s cmdret is extremely helpful. However, I’ve some problems with this tool and wonder if someone can point me in the right direction.
I’m trying to compile a C/C++ project using a PERL script (see CompileCmd below) and redirect its output to a GUI edit window within a tab control. Both versions (one using CMDret.exe and one using the cmdret.dll) basically work, that is, the output shows up in the edit control but with
version 1 (CMDret.exe)
- close to the end of the compile process the output just stops, no compiler output files are created - seems to me that the process just dies at some stage (the PERL script runs ok in a DOS box)
version 2 (cmdret.dll)
- everything works ok with regard to the compile process but the output window is not refreshed at some point - just the grey output window without the edit or tab control can be seen. Once the compile process completed, I can click on the output window to re-display the controls as well as the compiler output.
- one additional question: Is it somehow possible to get the PID of the CMD process as in the CMDret.exe version?
Version 1 using CMDret.exe:
GuiControl, 2:Choose, OutputTab, 2 SetTimer, SubOutputCompile, 250 RunWait, %RunCMD1% "p=" "%comspec% /c cd /d %vProjectFolder% && date/t && time /t && %CompileCmd% && date/t && time /t", , hide, CompilePID SetTimer, RefOutputCompile, Off Gosub, SubOutputCompile
Version 2 using cmdret.dll:
CMD = %comspec% /c cd /d %vProjectFolder% && %CompileCmd% && echo. OutputWindow := WinExist("Output Window") GuiControl, 2:Choose, OutputTab, 2 StrOut := DllCall("cmdret.dll\RunInControl", "str", CMD, "Uint", OutputWindow, "str", "Edit", "int", "2")
Thanks
Thanks for the feedback .
If using CMDret.exe you could try using cmdstub.exe
RunWait, cmdstub.exe %RunCMD1% "p=" "%comspec% /c cd /d %vProjectFolder% && date/t && time /t && %CompileCmd% && date/t && time /t", , hide, CompilePIDAlthough I am planning to update CMDret.exe soon to fix a few issues, CMDret.dll is currently considered to be an updated version of CMDret.exe.
The refresh issue with the RunInControl function in CMDret.dll seems to happen because the thread in the script is put on hold until the function in the .dll returns. This seems to prevent the Window from refreshing until the function returns. You could maybe try calling the function in the .dll from a timed sub or by creating a small script that calls the function, then execute the script using the Run command (untested). Thanks for pointing this out. I'll try and post a few sample scripts using RunInControl a bit later.
Out of curiosity, how would you like to use this info?- one additional question: Is it somehow possible to get the PID of the CMD process as in the CMDret.exe version?
first of all, thanks for the response. I haven't had the opportunity to test your suggestions but will try to do so sometime next week.
Out of curiosity, how would you like to use this info?
The compilation process takes quite some time and sometimes I realize that my changes weren't that smart after all :wink: , so I'd like to be able to stop compiling ...
Thanks for clarifying. That sounds like it would come in handy. I'll try and get the .exe version updated this week and look into adding the functionality to the .dll version. Thanks for the suggestion .The compilation process takes quite some time and sometimes I realize that my changes weren't that smart after all :wink: , so I'd like to be able to stop compiling ...
So can CMDret be used to send keystrokes and strings to FORMAT while it is running? Can it grab all text output as it is actively displayed by the FORMAT command?
I have read through all the posts in this thread and tried using each of the functions of CMDret and before I try anymore, I'd like to know if it is possbile to do what I need to do.
Thanks much,
Jason
Nope. CMDret doesn't send keystrokes... but AutoHotkey does...So can CMDret be used to send keystrokes and strings to FORMAT while it is running?
I haven't done any testing with the FORMAT command yet. I might be able to set up something to format in a few days to test... It wouldn't surprise me if it didn't work correctly though...Can it grab all text output as it is actively displayed by the FORMAT command?
... i'm new to dll handling and i have a question: how to interact with a program?
The problem: i have a Linux server who provides a SSL console interface. To connect this interface i use PuTTY or its command line tool PLINK.
How can i "remote control" plink.exe from AHK to log in into the server, read the answer from server (then AHK should parse the answer strings, display messages or fill some of the data into a GUI) and then send other commands depending on the answer or user action? The ssh session has to keep open for longer time.
Alternatively, you could periodically copy the window text (or parts of it) to the clipboard, and then parse the clipboard to determine what responses have occurred.