Jump to content

Recommended Posts

Posted

The console shows:

Window title: Error Recovery Guide
Window text: Tab1
More Info...

No Information on the scanner hardware status.

 

Posted

This is what I came up with.

It's still not catching the error.

Opt("WinWaitDelay", 100)
Opt("WinTitleMatchMode", 2)
Opt("WinDetectHiddenText", 1)
Opt("MouseCoordMode", 0)
Opt("TrayAutoPause", 0)

#include "Notify.au3"
#include "StringSize.au3"
#include <MsgBoxConstants.au3>
AutoItSetOption("TrayIconDebug", 1) ;0-off
; Set so that tray displays current line number

; Press ESC to exit script
HotKeySet("{ESC}", "_Exit")

Dim $ErrorCount, $textLine
; Register message for click event
_Notify_RegMsg()

; Set notification location
_Notify_Locate(0)
_Notify_Set(Default)

; Show notifications
Global $aNotCID[5]
;$aNotCID[1] = _Notify_Show(0, "", "Message 2" & @CRLF & "more Message 2")
;$aNotCID[4] = _Notify_Show(0, "DAZzle 3", "Auto-retract", 1)

While 1
    WinExists("DAZzle Professional")
    If Not WinActive("DAZzle Professional", "") Then WinActivate("DAZzle Professional", "")
    Local $title = WinGetTitle("DAZzle Professional", "")
    MsgBox($MB_SYSTEMMODAL, "", "Full title read is: " & $title)
    Local $text = WinGetText("", "")
    ;MsgBox(4096, "", "Full text read is: " & StringStripWS(StringReplace($text, @CRLF, ' '), 7))
    MsgBox(4096, "", "Full text read is: " & StringStripWS(StringReplace(StringReplace($text, Chr(0), ''), @CRLF, ' '), 7))
    ;ConsoleWrite ( StringStripWS(StringReplace($text, @CRLF, ' '), 7))
    $file = FileOpen("\Dnload\DazzleErrorFix.txt", 2)
        FileWrite($file, StringStripWS(StringReplace($text, @CRLF, ' '), 7))
        FileClose($file)
    If $title = "DAZzle Professional" And $text = "The file DAZzle Prof" Then
        $ErrorCount = $ErrorCount + 1
        $aNotCID[1] = _Notify_Show(0, "DAZzle 2", "The file DAZzle Prof")
        Send("{ENTER}")
    EndIf

    ;If $title = "Error" And $text = "The remote server returned" Then
    ;   $ErrorCount = $ErrorCount + 1
    ;   $aNotCID[3] = _Notify_Show(0, "DAZzle 4", "The remote server")
    ;   Send("{ENTER}")
    ;EndIf
    If $title = "DAZzle Professional" And $text = "Error from CreateLab" Then
        $ErrorCount = $ErrorCount + 1
        $aNotCID[4] = _Notify_Show(0, "DAZzle 5", "Error from CreateLab" & @CRLF & "more Message 4")
        Send("{ENTER}")
    EndIf
    If $title = "DAZzle Professional" And $text = "Failed to complete t" Then
        $ErrorCount = $ErrorCount + 1
        $aNotCID[5] = _Notify_Show(0, "DAZzle 6", "Failed to complete" & @CRLF & "more Message 4")
        Send("{ENTER}")
    EndIf
    WinExists("Error")
    If Not WinActive("Error", "") Then WinActivate("Error", "")
    Local $title = WinGetTitle("Error", "")
    MsgBox($MB_SYSTEMMODAL, "", "Full title read is: " & $title)
    Local $text = WinGetText("", "")
    ;MsgBox(4096, "", "Full text read is: " & StringStripWS(StringReplace($text, @CRLF, ' '), 7))
    MsgBox(4096, "", "Full text read is: " & StringStripWS(StringReplace(StringReplace($text, Chr(0), ''), @CRLF, ' '), 7))
    If $title = "Error" And $text = "Tab1" Then
        $ErrorCount = $ErrorCount + 1
        $aNotCID[2] = _Notify_Show(0, "DAZzle 3", "The remote server" & @CRLF & "more Message 4")
        Send("{ENTER}")
    EndIf
    If $ErrorCount > 0 Then
        $aNotCID[0] = _Notify_Show(0, "DAZzle 1", "Errors Found: " & $ErrorCount, 8)
    EndIf
    Sleep(8000)
    ; For debug purposes only
    For $i = 0 To 4
        $sRet = _CheckRetractionMethod($aNotCID[$i])
        If $sRet Then
            ConsoleWrite("Notification " & $i + 1 & ": " & $sRet & @CRLF)
        EndIf
    Next

WEnd


Func _CheckRetractionMethod($hWnd)
    Local $sRet = ""
    ; Check if notification was the last clicked
    Local $aFuncRet = _Notify_RetractCheck($hWnd)
    ; Determine method of retraction
    Switch $aFuncRet[0]
        Case 0
            ; Do nothing - notification either still visible or already retracted
        Case 1
            $sRet = "Title clicked :: " & $aFuncRet[1]
        Case 2
            $sRet = "Message clicked :: " & $aFuncRet[1]
        Case 9
            $sRet = "Timeout :: " & $aFuncRet[1]
    EndSwitch
    Return $sRet
EndFunc   ;==>_CheckRetractionMethod

Func _Exit()
    Exit
EndFunc   ;==>_Exit

 

Posted

Try this:

AutoItSetOption("WinWaitDelay", 100)
AutoItSetOption("WinTitleMatchMode", 2)
AutoItSetOption("WinDetectHiddenText", 1)
AutoItSetOption("MouseCoordMode", 0)
AutoItSetOption("TrayAutoPause", 0)
#include "Notify.au3"
#include "StringSize.au3"
#include <MsgBoxConstants.au3>
AutoItSetOption("TrayIconDebug", 1) ;0-off
; Set so that tray displays current line number

; Press ESC to exit script
HotKeySet("{ESC}", "_Exit")

Dim $ErrorCount, $textLine
; Register message for click event
_Notify_RegMsg()

; Set notification location
_Notify_Locate(0)
_Notify_Set(Default)

; Show notifications
Global $aNotCID[5]
;$aNotCID[1] = _Notify_Show(0, "", "Message 2" & @CRLF & "more Message 2")
;$aNotCID[4] = _Notify_Show(0, "DAZzle 3", "Auto-retract", 1)
Global $sTitle, $sText

While 1
    If WinExists('DAZzle Professional') Then
        $sTitle = WinGetTitle('DAZzle Professional')
        $sText = WinGetText('DAZzle Professional')
        MsgBox(4096, $sTitle ,StringStripWS(StringReplace(StringReplace($sText, Chr(0), ''), @CRLF, ' '), 7))
        
        Switch $sText
            Case "The file DAZzle Prof"
                $ErrorCount = $ErrorCount + 1
                $aNotCID[1] = _Notify_Show(0, "DAZzle 2", "The file DAZzle Prof")
                Send("{ENTER}")
            Case "Error from CreateLab"
                $ErrorCount = $ErrorCount + 1
                $aNotCID[4] = _Notify_Show(0, "DAZzle 5", "Error from CreateLab" & @CRLF & "more Message 4")
                Send("{ENTER}")
            Case "Failed to complete t"
                $ErrorCount = $ErrorCount + 1
                $aNotCID[5] = _Notify_Show(0, "DAZzle 6", "Failed to complete" & @CRLF & "more Message 4")
                Send("{ENTER}")
        EndSwitch
    EndIf
    If WinExists('Error') Then
        $sTitle = WinGetTitle('Error')
        $sText = WinGetText('Error')
        MsgBox(4096, $sTitle ,StringStripWS(StringReplace(StringReplace($sText, Chr(0), ''), @CRLF, ' '), 7))
        Switch $sText
            Case "The remote server re"
                $ErrorCount = $ErrorCount + 1
                $aNotCID[2] = _Notify_Show(0, "DAZzle 3", "The remote server" & @CRLF & "more Message 4")
                Send("{ENTER}")
            Case "The remote server returned" Then
                $ErrorCount = $ErrorCount + 1
                $aNotCID[3] = _Notify_Show(0, "DAZzle 4", "The remote server")
                Send("{ENTER}")
        EndSwitch
    EndIf
    If $ErrorCount > 0 Then
        $aNotCID[0] = _Notify_Show(0, "DAZzle 1", "Errors Found: " & $ErrorCount, 8)
    EndIf
    Sleep(8000)
    ; For debug purposes only
    For $i = 0 To 4
        $sRet = _CheckRetractionMethod($aNotCID[$i])
        If $sRet Then
            ConsoleWrite("Notification " & $i + 1 & ": " & $sRet & @CRLF)
        EndIf
    Next
WEnd


Func _CheckRetractionMethod($hWnd)
    Local $sRet = ""
    ; Check if notification was the last clicked
    Local $aFuncRet = _Notify_RetractCheck($hWnd)
    ; Determine method of retraction
    Switch $aFuncRet[0]
        Case 0
            ; Do nothing - notification either still visible or already retracted
        Case 1
            $sRet = "Title clicked :: " & $aFuncRet[1]
        Case 2
            $sRet = "Message clicked :: " & $aFuncRet[1]
        Case 9
            $sRet = "Timeout :: " & $aFuncRet[1]
    EndSwitch
    Return $sRet
EndFunc   ;==>_CheckRetractionMethod

Func _Exit()
    Exit
EndFunc   ;==>_Exit

 

Posted (edited)

It isn't catching the window.

DazzelError5.jpg.26425d1b4616a5732ee569ba21333914.jpg

I tried changing one of the errors with the text of Tab1.

It still doesn't catch it.

If WinExists('Error') Then
        $sTitle = WinGetTitle('Error')
        $sText = WinGetText('Error')
        MsgBox(4096, $sTitle ,StringStripWS(StringReplace(StringReplace($sText, Chr(0), ''), @CRLF, ' '), 7))
        Switch $sText
            Case "Tab1"
                $ErrorCount = $ErrorCount + 1
                $aNotCID[2] = _Notify_Show(0, "DAZzle 3", "The remote server" & @CRLF & "more Message 4")
                Send("{ENTER}")
            Case "The remote server returned"
                $ErrorCount = $ErrorCount + 1
                $aNotCID[3] = _Notify_Show(0, "DAZzle 4", "The remote server")
                Send("{ENTER}")
        EndSwitch
    EndIf

 

Edited by Docfxit
Posted

This is not going to work. I can't help you without having the app that generates these errors and without the AutoIt Info Tool. Maybe listing all the windows WinList() and looking for your specific window will help you to identify the window.

Posted

I used this code:

#include <MsgBoxConstants.au3>

Example()

Func Example()
        ; Retrieve a list of window handles.
        Local $aList = WinList()

        ; Loop through the array displaying only visable windows with a title.
        For $i = 1 To $aList[0][0]
                If $aList[$i][0] <> "" And BitAND(WinGetState($aList[$i][1]), 2) Then
                        MsgBox($MB_SYSTEMMODAL, "", "Title: " & $aList[$i][0] & @CRLF & "Handle: " & $aList[$i][1])
                EndIf
        Next
EndFunc   ;==>Example

And it gave me this window:

DazzelError7.jpg.0447d8c6f7592c19d29c1f3c30a67fd6.jpg

Posted

Would it help if you changed this code:

#include <MsgBoxConstants.au3>

Example()

Func Example()
        ; Retrieve a list of window handles.
        Local $aList = WinList()

        ; Loop through the array displaying only visable windows with a title.
        For $i = 1 To $aList[0][0]
                If $aList[$i][0] <> "" And BitAND(WinGetState($aList[$i][1]), 2) Then
                        MsgBox($MB_SYSTEMMODAL, "", "Title: " & $aList[$i][0] & @CRLF & "Handle: " & $aList[$i][1])
                EndIf
        Next
EndFunc   ;==>Example

To create a list of open windows with their text?

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
  • Recently Browsing   0 members

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