#include #include #include #include Opt('MustDeclareVars', 1) OnAutoItExitRegister('_Exxit') ; _ArrayDisplay($CmdLine) If $CmdLine[0] > 0 Then _SendLog() Global $hGui = GUICreate('Automation') Global $idButt = GUICtrlCreateButton('Log StdOut', 42, 42, 346) Global $idLog = GUICtrlCreateList("", 30, 155, 346, 176, BitOr($LBS_NOTIFY, $WS_VSCROLL, $WS_BORDER)) Global $aChildPIDs = [] GUISetState() GUICtrlSetData($idLog, 'Start') While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _Exxit() Case $idButt _RunSubScript() EndSwitch _Hndl_Stream() WEnd ; =============================================================================================================================== Func _Exxit() Exit EndFunc ; =============================================================================================================================== Func _RunSubScript() If Not @Compiled Then Return MsgBox(0, '', 'This wont work for a non Compiled script :\') Local Static $nRunNum = 1 Local Const $STDOUT_CHILD = 0x2 _ArrayAdd($aChildPIDs, Run(@ScriptFullPath & " " & $nRunNum, '', Default, $STDOUT_CHILD)) $nRunNum += 1 EndFunc ; =============================================================================================================================== Func _Hndl_Stream() Local $sData For $i = 1 to UBound($aChildPIDs) - 1 If ProcessExists($aChildPIDs[$i]) Then $sData = StdoutRead($aChildPIDs[$i]) If $sData <> '' Then GUICtrlSetData($idLog, $sData) EndIf Next EndFunc ; =============================================================================================================================== Func _SendLog() For $i = 1 to 10 ConsoleWrite('Stream Child #' & $CmdLine[1] & @TAB & ' LogData #' & $i) Sleep(1000) Next _Exxit() EndFunc ; ===============================================================================================================================