zaraijamel Posted August 14, 2017 Share Posted August 14, 2017 (edited) 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. expandcollapse popup#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 August 14, 2017 by JLogan3o13 Added code tags Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted August 14, 2017 Moderators Share Posted August 14, 2017 @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 More sharing options...
zaraijamel Posted August 14, 2017 Author Share Posted August 14, 2017 Hi @JLogan3o13 Thank you for you quick answer, I will test this right away and keep you posted. Best regards. Link to comment Share on other sites More sharing options...
zaraijamel Posted August 14, 2017 Author Share Posted August 14, 2017 8 minutes ago, JLogan3o13 said: Hi @JLogan3o13 I added this condition but i noticed that the text tooks be the same with slight change in th order level (between the OK and KO cases). Could you please advise if i can use any other detail. degards. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now