Jump to content

Please recitfy


shiv
 Share

Recommended Posts

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

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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

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

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

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

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

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

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

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)
    ;------------------------------------------------------
        ; 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 by shiv
Link to comment
Share on other sites

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

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

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