Jump to content

How to use debug statements


Recommended Posts

I've seen these in some of the example code and on the forum. But I have never seen how to use them, at least that I could find. Is there any examples to show how to use these?

$Debug_IP = False; Check ClassName being passed to IPAddress functions, set to True and use a handle to another control to see it work
$Debug_SB = False; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Thanks
Link to comment
Share on other sites

Hi,

I guess it is just that simple. Put code in your source like this:

If $debug_SB = True Then ....

After that you can change the var at top of the script and all the debug info will be given out.

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

  • 11 months later...

I've seen these in some of the example code and on the forum. But I have never seen how to use them, at least that I could find. Is there any examples to show how to use these?

$Debug_IP = False; Check ClassName being passed to IPAddress functions, set to True and use a handle to another control to see it work
         $Debug_SB = False; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Thanks

$Debug_SB Is used in #include <GuiStatusBar.au3>

Global $Debug_SB = False

Most Func in GuiStatusBar.au3 have:

Func _GUICtrlStatusBar_ShowHide($hWnd, $iState)

If $Debug_SB Then _GUICtrlStatusBar_ValidateClassName($hWnd)

..................

Func _GUICtrlStatusBar_ValidateClassName($hWnd)

_GUICtrlStatusBar_DebugPrint("This is for debugging only, set the debug variable to false before submitting")

_WinAPI_ValidateClassName($hWnd, $__STATUSBARCONSTANT_ClassName)

EndFunc ;==>_GUICtrlStatusBar_ValidateClassName

In #include <WinAPI.au3> we have

Func _WinAPI_ValidateClassName($hWnd, $sClassNames)

Local $aClassNames, $sSeperator = Opt("GUIDataSeparatorChar"), $sText

If Not _WinAPI_IsClassName($hWnd, $sClassNames) Then

$aClassNames = StringSplit($sClassNames, $sSeperator)

For $x = 1 To $aClassNames[0]

$sText &= $aClassNames[$x] & ", "

Next

$sText = StringTrimRight($sText, 2)

_WinAPI_ShowError("Invalid Class Type(s):" & @LF & @TAB & _

"Expecting Type(s): " & $sText & @LF & @TAB & _

"Received Type : " & _WinAPI_GetClassName($hWnd))

EndIf

EndFunc ;==>_WinAPI_ValidateClassName

Func _WinAPI_ShowError($sText, $fExit = True)

_WinAPI_MsgBox(266256, "Error", $sText)

If $fExit Then Exit

EndFunc ;==>_WinAPI_ShowError
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...