Jump to content

Make Condition on windows layout change.


 Share

Recommended Posts

Hello Guys, 

I am trying to write a script to mass load data into a desktop Application. My application is developed in DotNet. I managed to write the script to do the mass load but when an error occurs there an error frame that's displayed in the down side of the main window. Both screenshots will be attached before the error and after. also i will attach the Windows info output.

My question is how to detect this frame change and get the error message then abort the load when error occurs.

Best regards And thank you in advance.

 

#include <Array.au3>
#include <File.au3>
#include <MsgBoxConstants.au3>
#include <AutoItConstants.au3>

RunQAD()
MenuSelect()
RunLoad()

Func RunLoad()
    WinWait("test: QAD System Domain [USD] > 999 - SYSADM SYSTEM")
    WinActivate("test: QAD System Domain [USD] > 999 - SYSADM SYSTEM ")


 ;Global $aCA = WinGetClientSize($hErrWnd); Width, height


    Global $aRetArray, $sFilePath = "C:\Users\Jamel\Documents\role.txt"
    _FileReadToArray($sFilePath, $aRetArray, $FRTA_NOCOUNT + $FRTA_ENTIRESPLIT, ";")
    Global $iRows = UBound($aRetArray, $UBOUND_ROWS)
    Global $iCols = UBound($aRetArray, $UBOUND_COLUMNS)

    For $i = 0 To $iRows - 1
        For $j = 0 To $iCols - 1
            $a =$aRetArray[$i][$j]
            Send($a)
            Sleep(800)
            Send("{TAB}")
            Sleep(500)
        Next
        Sleep(800)
        Send("{TAB}")
        ;ConsoleWrite(WinWait('test: QAD System Domain [USD] > 999 - SYSADM SYSTEM','Error Viewer - Role Create Close Detail Processes ultraStatusBar1'))
        Sleep(800)
        Sleep(800)
    Next

EndFunc   ;==> RunLoad

;Input File Read Function
Func InputFileRead()
 Global $aRetArray, $sFilePath = "C:\Users\Jamel\Documents\role.txt"
 _FileReadToArray($sFilePath, $aRetArray, $FRTA_NOCOUNT + $FRTA_ENTIRESPLIT, ";")
; _ArrayDisplay($aRetArray, "Split on full delimiter", Default, 2)

EndFunc   ;==> InputFileRead

;========================================================================================
; Run QAD Function
;========================================================================================
Func RunQAD()
    ;;Run("C:\Program Files (x86)\QAD\QAD EE 2016\QAD.Applications.exe")
    ;;Global $hWnd = WinWait("Login")
    ;;WinActivate($hWnd)
    ;;Send ("mfg")
    ;;Send ("{Enter}")
    If WinExists("test: QAD System Domain [USD] > 999 - SYSADM SYSTEM") Then
        WinActivate("test: QAD System Domain [USD] > 999 - SYSADM SYSTEM")
    Else
    WinWait("test: QAD System Domain [USD] > 999 - SYSADM SYSTEM")
    WinActivate("test: QAD System Domain [USD] > 999 - SYSADM SYSTEM ")
    MsgBox('','Done Waitin','2454')
    EndIf
EndFunc   ;==>RunQAD

;========================================================================================
; Menu Selection Func
;========================================================================================
Func MenuSelect()
    Sleep(1000)
    Send ("{CTRLDOWN}")
    Send ("m")
    Send ("{CTRLUP}")
    Send ("Role Create")
    Sleep(500)
    Send ("{Enter}")
    Sleep(500)
    Sleep(500)
EndFunc ;===> MenuSelect


 

AutoITError.docx

Edited by JLogan3o13
Added code tags
Link to comment
Share on other sites

  • Moderators

@zaraijamel it appears that the error produces some unique text, as evidenced by your last screenshot 0 "Error Viewer - Role Create" etc,etc,etc

Have you tried doing a WinExists loop, looking specifically for this text? Something like:

If WinExists("test: QAD System Domain [USD] > 999 - SYSADM SYSTEM", "Error Viewer - Role Create") Then ...

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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...