# ConsoleApp [v2.1.1]

Author: drifter Last Modified: 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)

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

#### Remarks

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.

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

#### License

The functions is an open source item under the free license. For details, please see drifter_consoleApp-license.txt

#### Example

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

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