CMDret_stream() [v0.03 beta]

Author: corrupt, Laszlo, shimanov, toralf, Wdb Last Modified: 20070219


CMDret can be used to retrieve and store output from console programs in a variable without displaying the console window.

This function has been designed to be able to retrieve and display data as it would become available in a CMD window instead of having to wait until the command's process has completed.

Here you will find AutoHotkey code based on cmdret.dll, provided as functions Exclamation instead of having to include the cmdret.dll file.

CMDret can be used to retrieve and store output from console programs in a variable without displaying the console window.

CMDret_Stream(CMDin, CMDname="", WorkingDir=0)

For more details of the functions's parameters and return value, please see it's source code.

Remarks

To work with this function, you MUST define the function CMDret_Output(CMDout, CMDname="") somewhere in your script. It calls for every line it gets from the console and writes it to the CMDout parameter it has.

It is not strictly stdlib conform, because it uses a global variable and a awaits a user defined function.

It lacks an external documentation. Look for that at head of source.

DLL Version of CMDret:
* http://www.autohotkey.com/forum/viewtopic.php?t=3687

For update's details and remarks related to the functions, please see the AutoHotkey Forum: http://www.autohotkey.com/forum/viewtopic.php?t=8606

License

nonexistent

Example

; #Include CMDret_stream.ahk
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%

Gui, Add, Edit, x6 y10 w460 h360 +HScroll
Gui, Show, x398 y110 h377 w477, CMDret - AHK version - Streaming Test App

Gui +LastFound
StrOut := CMDret_Stream("cmd /c dir c:\")
MsgBox %StrOut%

Return

GuiClose:
ExitApp

CMDret_Output(CMDout, CMDname="")
{
	Global OutputWindow
	ControlSetText, Edit1, %CMDout%
	Sleep, 200
}