shiv Posted December 16, 2013 Share Posted December 16, 2013 Winwait("Configuration Failed") is working Winwait("Configuration Failed","",5) is not working with this statement However i have also tried to use WinExists("Configuration Failed") but it does not work. Actually i want to use WinExists("Configuration Failed") because the window for which i am using is sometime occurs during execution of the script and some time does not pop out. if i use Winwait("Configuration Failed") then window pop up is hadled but the remaining script does not executes. This window is an error prompt with OK button so either i can click on OK button or i ccan close the window using winclose. But the main thing is that Winwait("Configuration Failed","",5) WinExists("Configuration Failed") are not working I have faced these problems in past. please don't mind but it is very difficult to handle the error pop ups using autoit. Could you please provide some solution to handle these error pop ups Thanks Link to comment Share on other sites More sharing options...
JohnOne Posted December 16, 2013 Share Posted December 16, 2013 "Not working" means nothing. Elaborate. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
guinness Posted December 16, 2013 Share Posted December 16, 2013 Does WinGetHandle() return anything? UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
jdelaney Posted December 16, 2013 Share Posted December 16, 2013 (edited) Throwing out a guess, that this error message is deadlocking the autoit script, which then starts again when you manually close the window. If that's the case, you can look into using a second process to perform the action that causes the message to appear. Pleanty of examples, search deadlock, and helpfile for command line parameters (examples of running a second instance of a script) Edited December 16, 2013 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
shiv Posted December 17, 2013 Author Share Posted December 17, 2013 Hi All, Thanks for the response. as mentioned by JohnOne. i tr to more elaborate it Winwait("Configuration Failed") this window occurs only once during running my application. That why i want to use like If WinExists("Configuration Failed") Then MsgBox(0,0,0) EndIf but the above code is not working; i used autoit window info to get the title and text of this window. in the title it shows "Configuration Failed" but no text is there. However all other texts are displayed in visible text info in autoit window info tool. all these texts have different classes and ids. I tried to use all those text with winexists but that does not work f.ex.-- Winexists("Configuration Failed","Please contact") I also tried to use text classes instead but that also does not work. well may be not clear to you i am pasting the whole function i have built Func _Config( $machine, $Password) Local $sRemark Local $iWindow = WinActivate("Configure event","") If $iWindow == 0 Then $sRemark = "FAIL" Else ControlSend("Configure ","text","Edit3",$machine) ControlClick("Configure ","text","Button3") Sleep(7000) ;------------------------------------------------ ; this code is not working ; this code should only execute if the title window exsist If WinExists("Configuration Failed") Then WinActivate("Configure Failed") ControlClick("Configure Failed","OK","[CLASS:Button; INSTANCE:1]") ControlClick("Configure ","text","Button3") EndIf ; and if this code is executed successfully then the below code should run successfully ;--------------------------------------------------------------------- Sleep(2000) WinActivate("Configure event","Please enter value") ControlSend("Configure event","Please enter value","Edit2",$Password,1) ControlClick("Configure event","Please value","Button3") WinWait("Configure event","Click Finish to test and save these settings") WinActivate("Configure event","Click Finish to test and save these settings") ControlClick("Configure event","Click Finish to test and save these settings","Button3") Sleep(30000) EndIf Return $sRemark EndFunc Link to comment Share on other sites More sharing options...
JohnOne Posted December 17, 2013 Share Posted December 17, 2013 (edited) You understand that if you don't know when or even if a window will appear, you have to add your If WinExists() condition in a loop? Perhaps the main loop of your code. Edited December 17, 2013 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
shiv Posted December 17, 2013 Author Share Posted December 17, 2013 How to use loop? But i know when that window will appear that why i used "if winexists" Window will occur once means that it occurs one in start of the application . once it is handled then it does not appear again till the completion of the script Link to comment Share on other sites More sharing options...
JohnOne Posted December 17, 2013 Share Posted December 17, 2013 Try this. For $i = 1 To 5 If WinExists("Configuration Failed") Then MsgBox(0,"Detected","Deal with the window") ExitLoop EndIf Sleep(1000) Next AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
shiv Posted December 17, 2013 Author Share Posted December 17, 2013 (edited) Ok I will try this but as i told before winexist not able to read the window. the other thing which i tried is handling the window successfully but the code below that stops working. i think it can be modified but i am not reaching there. please have look on the code below expandcollapse popupFunc _Config( $machine, $Password) Local $sRemark Local $iWindow = WinActivate("Configure event","") If $iWindow == 0 Then $sRemark = "FAIL" Else ControlSend("Configure ","text","Edit3",$machine) ControlClick("Configure ","text","Button3") Sleep(7000) ;------------------------------------------------------ ; other option which i tried and which run successfully is below Local $win = WinWait("Configuration Failed") ; if i use WinWait("Configuration Failed"," " ,5) then it does not work if $win <> 0 Then WinActivate("Configure Failed") ControlClick("Configure Failed","OK","[CLASS:Button; INSTANCE:1]") ControlClick("Configure ","text","Button3") EndIf ;--------------but the code below stops working Sleep(2000) WinActivate("Configure event","Please enter value") ControlSend("Configure event","Please enter value","Edit2",$Password,1) ControlClick("Configure event","Please value","Button3") WinWait("Configure event","Click Finish to test and save these settings") WinActivate("Configure event","Click Finish to test and save these settings") ControlClick("Configure event","Click Finish to test and save these settings","Button3") Sleep(30000) EndIf Return $sRemark EndFunc ;---------------------------- ;But as i said before this window occurs only once, therefore when same function is called then the code below slee(2000)does not work ; I mean to say if i handle this window successfully then the code below it does not work. Edited December 17, 2013 by shiv Link to comment Share on other sites More sharing options...
JohnOne Posted December 17, 2013 Share Posted December 17, 2013 Where does the popup window come from? Your script? Somewhere else? Post contents of summary tab from window info tool. Seems odd that winwait sees window but winexists does not. If that really is the case then it would almost certainly be a bug, which I doubt. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
shiv Posted December 17, 2013 Author Share Posted December 17, 2013 pop up does not come from the script its my application issue. However now winexists has worked by using it within the loop. is it necessary to use winexist with in the loop?? may be i am wrong but as i mentioned above that WinWait("Configuration Failed") worked properly But if i use WinWait("Configuration Failed"," " ,5) then it does not work It does not happen every time but i have faced this issue some days ago also. I think you should do some workaround on this But thank you very much for your support. Link to comment Share on other sites More sharing options...
JohnOne Posted December 17, 2013 Share Posted December 17, 2013 Well the loop with winexists is similar to winwait with 5 second timeout. Just increase the amount of iterations for each other second you wish to wait. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
shiv Posted December 17, 2013 Author Share Posted December 17, 2013 Thanks 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