CMDret - return output from console progs [DLL version]
thanks a ton! :mrgreen:There you have it. cmdret4d.zip
HTH
Greetings,
daonlyfreez
Is there a way I could send "diskpart" in one DllCall and "help" in the next and see diskpart's help?
Can anyone help? I am wanting to stream STDOUT from Mplayer to a variable line by line and parse it for some other process, Using variations of the cmdret.dll\RunInControl example I can stream it to notepad or gui,edit etc, but cant see a way of programmatically getting the variable so I can then parse it. I can do this using the old non dll CMDRET. I am clearly missing something but I dont know what!
Thanks in advance
Is there any alternative for CMDret (dll version)?? Best with support for unicode.
I rebuild there samples from ANSI to UNICODE but it do not display properly some characters and from time to time is not so stable.
I'm amazed that anyone still uses this (or tries to)...
What other options do we have to do this?
I did see the following and found that it worked, but it chops the output of things like a directory listing or listing a 40k txt file. Also, because the output is captured from the WSH Shell's Standard Output and Standard Error textstreams you must use the Exec method, so can't completely to hide the DOS window. On the other hand, the output capture tends to take more than a few seconds, so what else are you going to watch while this happens? None of this is critisms of your DLL. I'm just sharing this incase another readers finds this later.
Thanks for your work!
I think using WshShell Object maybe a better way. For details, please see:
[AHK&AHK_l]Using COM to interact with command-line progs
However, I haven't been able to get your DLL to work yet for the examples I used on the other solution. I'm using AutoHotKey L 64 bit on a Windows 7 Pro computer. I either have my script wrong or the DLL isn't for the version of AutoHotKey that I'm running.
Anyway, thanks for putting this out here.
Sorry to bump this old-ass thread, but all the links here are dead, including the dropbox link on top of the page
can somebody post a new link please
or is there any alternatives/new ways of using the output of command-line tools in your scripts?
-thanks
have no experience, just an example
;-- write to memory example exiftool.exe -------------- ;-http://www.autohotkey.com/board/topic/89581-exiftoolexe-comspec-output/ ;-http://www.sno.phy.queensu.ca/~phil/exiftool/ F1="%A_scriptdir%\xxb.jpg" ;- check picture objShell := ComObjCreate("WScript.Shell") objExec := objShell.Exec(ComSpec " /c exiftool " F1 ) ;- exiftool.exe is in scriptdir strStdOut := "" while, !objExec.StdOut.AtEndOfStream strStdOut := objExec.StdOut.ReadAll() MsgBox %strStdOut% ;- show exifdata exitapp
WOW Thanks!
I was looking for it for quite some time now...
how did I missed the whole StdOut stuff?
anyway, I managed to rewrite it to output line-by-line
here is a little script that pings to check connection, with live GUI output
DetectHiddenWindows,On Run,%ComSpec% /k,,Hide UseErrorLevel,pid if not ErrorLevel { while !WinExist("ahk_pid" pid) Sleep,10 DllCall("AttachConsole","UInt",pid) } CMD=ping -n 10 8.8.8.8 objShell:=ComObjCreate("WScript.Shell") objExec:=objShell.Exec(CMD) Gui,1:-border Gui,font,s8 Gui,Add,Text,W280 H300 vText gButtonCancel,Testing internet connection`r`nPinging Google DNS: 10 times Gui,Show,w280 H300 while,!objExec.StdOut.AtEndOfStream { GuiControlGet,Text strStdOut:=objExec.StdOut.readline() GuiControl,,Text,%Text%`r`n%strStdOut% } GuiControlGet,Text GuiControl,,Text,%Text%`r`n`r`n%A_Tab%%A_Tab%%A_Space%%A_Space%Click me to Close.. Return ButtonCancel: Gui,Destroy Exitapp