#include-once #include #include #include #Include #include #include #Region Declaration of variables Global $gg_gc_hGUI,$gg_gc_hGUI_Edit #EndRegion ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GUIConsole_Create ; Description ...: Create console ; Syntax ........: _GUIConsole_Create([$sTitle = Default[, $hBkColor = Default[, $hTextColor = Default[, $x_size = 690[, ; $y_size = 298]]]]]) ; Parameters ....: $sTitle - [optional] The title of the console. Default is Default. ; $hBkColor - [optional] The background color of the console. Default is Default. ; $hTextColor - [optional] The color of the text in the console. Default is Default. ; $x_size - [optional] The x size of the console. Default is 690. ; $y_size - [optional] The y size of the console. Default is 298. ; Return values .: None ; Author ........: gil900 ; =============================================================================================================================== Func _GUIConsole_Create($sTitle = Default,$hBkColor = Default,$hTextColor = Default,$x_size = 690,$y_size = 298) If $gg_gc_hGUI Then Local $sText = 'Error: there is already GUIConsole open. You cant open more then one.' _GUIConsole_Write($sText) ConsoleWrite($sText&@CRLF) Return SetError(1) EndIf Local $sScriptName If Not @Compiled Then $sScriptName = @ScriptName Else $sScriptName = @AutoItExe EndIf Local $sTitle_start = $sScriptName If $sTitle = Default Then $sTitle = 'Autoit Alternative console (by gil900)' If $sTitle Then $sTitle = $sTitle_start&': '&$sTitle Else $sTitle = $sTitle_start EndIf If $hBkColor = Default Then $hBkColor = 0x000000 If $hTextColor = Default Then $hTextColor = 0xFFFFFF $gg_gc_hGUI = GUICreate($sTitle, $x_size, $y_size) $gg_gc_hGUI_Edit = GUICtrlCreateEdit("", 0, 0, $x_size-1, $y_size-1,BitOR($GUI_SS_DEFAULT_EDIT,$ES_READONLY)) GUICtrlSetColor(-1, $hTextColor) GUICtrlSetBkColor($gg_gc_hGUI_Edit, $hBkColor) _WinAPI_SetWindowLong($gg_gc_hGUI, $GWL_STYLE, BitXOr(_WinAPI_GetWindowLong($gg_gc_hGUI, $GWL_STYLE), $WS_SYSMENU)) WinSetOnTop($gg_gc_hGUI,'',1) GUISetState(@SW_SHOW) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GUIConsole_Write ; Description ...: Print text data in the console ; Syntax ........: _GUIConsole_Write($sText[, $iAddLines = 1[, $sAddChar = @CRLF]]) ; Parameters ....: $sText - A string value. ; $iAddLines - An integer value. Default is 1. ; [optional] If set to 0, It will not add "ENTER" (@CRLF of something else you set in the next parameter) ; after the text. ; If set bigger then 0 then it will add $iAddLines times "ENTER"(or something else) after the text. ; $sAddChar - [optional] Default is @CRLF. This variable matter if $iAddLines > 0. It will add $iAddLines times ; $sAddChar ( @CRLF in this case if set to default) ; Return values .: None ; Author ........: gil900 ; =============================================================================================================================== Func _GUIConsole_Write($sText,$iAddLines = 1,$sAddChar = @CRLF) If $iAddLines Then For $a = 1 To $iAddLines $sText &= $sAddChar Next EndIf GUISwitch($gg_gc_hGUI) Local $iEnd = StringLen(GUICtrlRead($gg_gc_hGUI_Edit)) _GUICtrlEdit_SetSel($gg_gc_hGUI_Edit, $iEnd, $iEnd) _GUICtrlEdit_Scroll($gg_gc_hGUI_Edit, $SB_SCROLLCARET) GUICtrlSetData($gg_gc_hGUI_Edit,$sText,1) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GUIConsole_Delete ; Description ...: Delete the Console GUI ; Syntax ........: _GUIConsole_Delete() ; Return values .: None ; Author ........: Your Name ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _GUIConsole_Delete() If Not $gg_gc_hGUI Then Return SetError(1,0,ConsoleWrite('Error in _GUIConsole_Delete: There is no GUIConsole open.'&@CRLF)) GUIDelete($gg_gc_hGUI) $gg_gc_hGUI = 0 EndFunc