Setup up a debug session using a specific reporting type
#include <Debug.au3>
_DebugSetup ( [$sTitle = Default [, $bBugReportInfos = False [, $vReportType = 1 [, $vLogFile = "" [, $bTimeStamp = False]]]]] )
$sTitle | [optional] Title to be displayed on the report window. Default value is "AutoIt Debug Report". |
$bBugReportInfos | [optional] Display BugReport infos. Default value is False. |
$vReportType | [optional] 1 - Report Log Window (Default). 2 - ConsoleWrite. 3 - MsgBox. 4 - FileWrite into $vLogFile defines the filename. 5 - Report Notepad Window (see remark for Windows 11). 6 - Report Log Window with timeout (see remark for Windows 11). string - name of specific report function to be used. |
$vLogFile | [optional] Name of the file if $vReportType = 4 Timeout in sec, if $vReportType = 6 (Default = 10) |
$bTimeStamp | [optional] True if every message must be prefixed with a timeStamp "YYYY/MM/DD HH:MM:SS" |
Success: | the report type. |
Failure: | sets the @error flag to non-zero. |
@error: | 1 - if already called 2 - invalid report type 3 - invalid CallBack function |
If a specific reporting function is registered then on AutoIt exit it is called without parameters.
You can only start one debug session at a time in the running script.
You can debug several concurrent scripts using the same debugging session, just use the same $sTitle when calling _DebugSetup(). All _DebugOut() will go to the same debugging session.
Commenting out the _DebugSetup() call will effectively disable all the calls to _Debug...(), but you may want to remove the calls to all _Debug...() functions before making a release version of your script.
If the "Report Log Window" type is used then the script will end only when closing the report window.
If the "Report Notepad Window" type is used the Notepad window cannot be closed when running under Windows 11 without asking to register it.
So the content of the window is put in the Clipboard and a MsgBox will display it before the closing of the script.
If the script is run in Admin mode the old Notepad will be used as for Windows 10 (see example 2).
_DebugOut, _DebugReport, _DebugReportEx, _DebugReportVar
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.2.8.1
Author: David Nuttall
Script Function:
Base script to show functionality of Debug functions.
#ce ----------------------------------------------------------------------------
#include <Debug.au3>
_DebugSetup("Check Excel", True) ; start displaying debug environment
For $i = 1 To 4
WinActivate("Microsoft Excel")
; interact with Excel
Send("{Down}")
_DebugOut("Moved Mouse Down") ; forces debug notepad window to take control
Next
; will allow to run with old Notepad behaviour in Window 11 #RequireAdmin #include <Debug.au3> _DebugSetup("Check Excel", True, 5) ; Report Notepad Window For $i = 1 To 4 WinActivate("Microsoft Excel") ; interact with Excel Send("{Down}") _DebugOut("Moved Mouse Down") ; forces debug notepad window to take control Next