ConsoleApp [v2.1.1]

作者: drifter 最近更新时间: 20100308


Provides a set of functions to redirect and capture the standard input and output of other programs.

ConsoleApp_CloseHandle(ConsoleAppHandle)
ConsoleApp_GetStdOut(ConsoleAppHandle, byref Stdout, byref BytesAppended = 0, byref ExitCode="")
ConsoleApp_Run(CmdLine, WorkingDir="", Reserved="", byref PID="")
ConsoleApp_RunWait(CmdLine, WorkingDir="", byref ExitCode="")
ConsoleApps_Initialize()
CONSOLEAPPS_PRIVATE_abort()
CONSOLEAPPS_PRIVATE_calloc(pi, 16, 0)
CONSOLEAPPS_PRIVATE_free(byref Var)
CONSOLEAPPS_PRIVATE_malloc(hStdoutRead, 4)
CONSOLEAPPS_PRIVATE_PtrToStr(lpStr)
CONSOLEAPPS_PRIVATE_ReadFile(hFile, byref buf, byref BytesRead=0, BufferSize=4096)
CONSOLEAPPS_PRIVATE_throw(ERROR_GENERIC_ERROR, "Unable to run console application.")
CONSOLEAPPS_PRIVATE_WIN32_MAKELANGID(p, s)

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

备注

This is not strictly stdlib conform, because there is one command #NoEnv command in the auto-execution area (although its not positional and does not hurt). It makes use of some global variables and so it cannot be stdlib conform.

The documentation is copied part from source file. I have stripped the leading triple semikolon away.

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

许可

此函数(集)是基于 free 许可的开源项目. 想了解许可详情, 请参见 drifter_consoleApp-license.txt

示例

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

MsgBox, % ConsoleApp_RunWait("cmd.exe /c dir c:\windows")