Sign in to follow this  
Followers 0
islandspapand

"Debugger" GUI with consoleread. (Drag and Drop Problem)(Solved)

1 post in this topic

#1 ·  Posted (edited)

Solved :D

But if anybody has any improvements i would love to hear them :D

i am also looking for a possibly to add a auto-scroll when the auto button is pressed. just have not found out how to yet.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=E:\Downloads\1355224006_xconsole-console-terminal-command line-icon.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include
#include
#Include
#Include
#include
#include
#include


Global $iItem ; Command identifier of the button associated with the notification.
Global $hGUI, $hToolbar, $hToolTip, $hReBar, $iMemo, $aStrings[5], $i = 0
Global Enum $id1 = 1000, $id2, $id3, $id4, $id5 ; ID's for each ToolBar button
Global $data, $msgbox
Global $stop = False
Global $GUIPosLeft = (@DesktopWidth-@DesktopWidth/4)-10
Global $GUIPosWidth = @DesktopWidth/4
Global $GUIPosHeight = @DesktopHeight-55
Global $GUIPosTop = 5

FileInstall("C:\Icon.dll",@ScriptDir&"\")

Opt('MustDeclareVars', 1)

If $CmdLine[0] <> 0 Then
Local $foo = Run(@ComSpec & " /c "& $CmdLine[1], "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
_Main()
Local $data
While 1
$data &= StdoutRead($foo)
If @error Then ExitLoop
WEnd
EndIf



Func _Main()
Local $hToolBarImageListNorm, $hToolBarImageListDisabled, $hToolBarImageListHot, $aSize
$hGUI = GUICreate("Console Informer",$GUIPosWidth ,$GUIPosHeight,$GUIPosLeft,$GUIPosTop,BitOR($WS_SYSMENU,$WS_DLGFRAME))
$hReBar = _GUICtrlReBar_Create($hGUI, BitOR($RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))
$hToolbar = _GUICtrlToolbar_Create($hGUI, BitOR($BTNS_AUTOSIZE, $BTNS_BUTTON, $BTNS_SHOWTEXT))
$aSize = _GUICtrlToolbar_GetMaxSize($hToolbar)


$hToolBarImageListNorm = _GUIImageList_Create(16,16, 5)
_GUIImageList_AddIcon($hToolBarImageListNorm, @ScriptDir & "\Icon.dll", 2) ;Clean
_GUIImageList_AddIcon($hToolBarImageListNorm, @ScriptDir & "\Icon.dll", 0) ;Clean
_GUIImageList_AddIcon($hToolBarImageListNorm, @ScriptDir & "\Icon.dll", 4) ;Clean
_GUIImageList_AddIcon($hToolBarImageListNorm, @ScriptDir & "\Icon.dll", 1) ;Clean
_GUIImageList_AddIcon($hToolBarImageListNorm, @ScriptDir & "\Icon.dll", 5) ;Clean
_GUIImageList_AddIcon($hToolBarImageListNorm, @ScriptDir & "\Icon.dll", 3) ;Clean
_GUICtrlToolbar_SetImageList($hToolbar, $hToolBarImageListNorm)

$aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "Refresh")
$aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "Clr")
$aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "Write")
$aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "Auto")
$aStrings[4] = _GUICtrlToolbar_AddString($hToolbar, "Clr Data")

_GUICtrlToolbar_AddButton($hToolbar, $id1, 0, $aStrings[0]) ; Index 0
_GUICtrlToolbar_AddButtonSep($hToolbar,20)
_GUICtrlToolbar_AddButton($hToolbar, $id2, 1, $aStrings[1]) ; Index 0
_GUICtrlToolbar_AddButtonSep($hToolbar,20)
_GUICtrlToolbar_AddButton($hToolbar, $id3, 2, $aStrings[2]) ; Index 0
_GUICtrlToolbar_AddButtonSep($hToolbar,20)
_GUICtrlToolbar_AddButton($hToolbar, $id4, 3, $aStrings[3]) ; Index 0
_GUICtrlToolbar_AddButtonSep($hToolbar,20)
_GUICtrlToolbar_AddButton($hToolbar, $id5, 4, $aStrings[4]) ; Index 0
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$iMemo = GUICtrlCreateEdit("", 0, $aSize[1] + 20, $GUIPosWidth, $GUIPosHeight - ($aSize[1] + 20), $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()
GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY")
EndFunc

Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF)
EndFunc ;==>MemoWrite

Func _WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam)
#forceref $hWndGUI, $MsgID, $wParam
Local $hwndFrom, $code, $index
Local $tNMTOOLBAR, $tInfo, $iID

$tNMTOOLBAR = DllStructCreate($tagNMTOOLBAR, $lParam)
$hwndFrom = DllStructGetData($tNMTOOLBAR, "hWndFrom")
$code = DllStructGetData($tNMTOOLBAR, "Code")
$iItem = DllStructGetData($tNMTOOLBAR, "iItem")
Switch $hwndFrom
Case $hToolbar
Switch $code
Case $TBN_BEGINDRAG
$index = _GUICtrlToolbar_CommandToIndex($hToolbar, $iItem)

Switch _GUICtrlToolbar_IsButtonEnabled($hToolbar, $iItem)
Case True
Switch $index

Case 0 ;Refresh
Beep(1000, 5)
MemoWrite($data)

Case 1
Beep(1500, 5)

Case 2 ; Clr scrn
Beep(2000, 5)
GUICtrlSetData($iMemo, "")


Case 4 ; Write Data
Beep(2500, 5)
FileWrite(@ScriptDir&"\ConsoleInfo.log",$data)
ShellExecute(@ScriptDir&"\ConsoleInfo.log")

Case 8 ;Clr Data
Beep(3000, 5)
$msgbox=MsgBox(36,"Console Info","Du er ved at tømme Data Variablen for alt dens info"&@CRLF&"Er Du sikker på du ville forsætte")
If $msgbox=6 Then
$data = ""
MsgBox(0,"Console Info","Data Variablen Tømt"&@CRLF&$data)
GUICtrlSetData($iMemo, "")
Else
EndIf

Case 6 ; Autograb
Beep(3500, 5)
SoundPlay(@WindowsDir & "\media\tada.wav", 0)

If Not _GUICtrlToolbar_IsButtonChecked($hToolbar, $id4) Then
_GUICtrlToolbar_SetButtonBitMap($hToolbar, $id4, 5)
_GUICtrlToolbar_CheckButton($hToolbar, $id4, True)
_GUICtrlToolbar_EnableButton($hToolbar, $id5, False)
_GUICtrlToolbar_EnableButton($hToolbar, $id3, False)
_GUICtrlToolbar_EnableButton($hToolbar, $id2, False)
_GUICtrlToolbar_EnableButton($hToolbar, $id1, False)
While 1
$data &= StdoutRead($foo)
If @error Then ExitLoop 1
Sleep(50)
GUICtrlSetData($iMemo,$data)

$tNMTOOLBAR = DllStructCreate($tagNMTOOLBAR, $lParam)
$hwndFrom = DllStructGetData($tNMTOOLBAR, "hWndFrom")
$code = DllStructGetData($tNMTOOLBAR, "Code")
$iItem = DllStructGetData($tNMTOOLBAR, "iItem")
Switch $hwndFrom
Case $hToolbar
Switch $code
Case $TBN_BEGINDRAG
$index = _GUICtrlToolbar_CommandToIndex($hToolbar, $iItem)
Switch _GUICtrlToolbar_IsButtonChecked($hToolbar, $iItem)
Case True
Switch $index
Case 6
If _GUICtrlToolbar_IsButtonPressed($hToolbar, $id4) And _GUICtrlToolbar_IsButtonChecked($hToolbar, $id4) Then
_GUICtrlToolbar_CheckButton($hToolbar, $id4, False)
_GUICtrlToolbar_SetButtonBitMap($hToolbar, $id4, 3)
_GUICtrlToolbar_EnableButton($hToolbar, $id5, True)
_GUICtrlToolbar_EnableButton($hToolbar, $id3, True)
_GUICtrlToolbar_EnableButton($hToolbar, $id2, True)
_GUICtrlToolbar_EnableButton($hToolbar, $id1, True)
ExitLoop 1
EndIf
EndSwitch
EndSwitch
EndSwitch
EndSwitch
WEnd
EndIf
EndSwitch
EndSwitch
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc

Debugger.exe

Edited by islandspapand

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0