Jump to content
Sign in to follow this  
Rugbee

_DebugOut - Close or Kill Report Log Window

Recommended Posts

Rugbee

Hey Folks,

I have an autoit script that runs (monitors) a local system for a specific process. When the process is detected it completes an action but does not close. The script runs all the time and works great.

To assist field techs with troubleshooting I wanted to use _DebugSetup() to open the Report Log Window and display _debugOut lines within my code to indicate what is going on with the script while it is running. I have created a taskmenuitem that can be checked off to initiate the Debug output. This also works great. I would like to be able to deselect the menu item and have the debug stop or at a minimum have the Report Log Window close. I know that it will stop debuging if I kill the script, but I wish for the script to remain running.

Here is an example of what I want to accomplish:

#include <constants.au3>
#include <debug.au3>
Opt("WinTitleMatchMode",2)
Opt("TrayOnEventMode",1)
Opt("TrayMenuMode", 1)


TraySetClick(16)
$DebugMenuItem = TrayCreateItem("Debug")
TrayItemSetOnEvent(-1,"_CheckTrayItem")
TraySetState()


While 1
    _DebugOut("No Process detected... Looping")
    Sleep(5000)
    While ProcessExists("notepad.exe")
        _DebugOut("Process detected Perform action...")
        MsgBox(0,'','Perform Action')
        Sleep(2000)
    WEnd
WEnd

Func _CheckTrayItem()
    $Checkbox = TrayItemGetState($DebugMenuItem)
    IF $Checkbox = '65' Then
        _Debug()
    Else
        MsgBox(0,'','This is where I want to Kill the Debug')
    EndIf
EndFunc
Func _Debug()
    _DebugSetup("DEBUGLOG - " & @ScriptName)
    _DebugBugReportEnv()
    _DebugOut('User: ' & @UserName  & ' Computer: ' & @ComputerName & ' Date: ' & @MON & "/" & @MDAY & "/" & @YEAR & " - " & @HOUR & ":" & @MIN & ":" & @SEC)
    _DebugOut('******************SCRIPT START************************')
EndFunc

Share this post


Link to post
Share on other sites
Rugbee

FIXED: Before I posted I should have just opened up the include. I used the internal function __Debug_ReportClose() for debug.au3 to close the window and stop the debug.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.