CMDret_stream() [v0.03 beta]

作者: corrupt, Laszlo, shimanov, toralf, Wdb 最近更新时间: 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)

关于函数的参数和返回值, 请参阅其源码.

备注

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

关于此函数(集)的更新细节和注意事项, 请参见 AutoHotkey 论坛: http://www.autohotkey.com/forum/viewtopic.php?t=8606

许可

不存在

示例

; #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
}