darito84 Posted April 17, 2017 Share Posted April 17, 2017 Hi people! My name is Damian I just started using AutoIt with some of my projects and I will love it! I have a question. I want to create an infinite loop that runs when pc starts and keep "waiting" until an error popup appear, then it clicks the OK button and continue waiting until it appears again. (I just want to do that because I have another bot working with selenium webdriver/firefox and from time to time an error ocurr and then the whole bot keep held until I press OK). I coded this reading from this forum: While True $hWnd = WinWait("[CLASS:32770]", "", 5) If WinExists($hWnd) Then WinActivate("[CLASS:32770]") Send("Hello World") WinClose($hWnd) Else MsgBox(0, "", "Window no exists") EndIf Wend I tried adding [Class:32770; TEXT some text] but it doesnt seems to work. The popup window doesnt have a title, it just has contnet or visible text. This is the summary info for the window: expandcollapse popup>>>> Window <<<< Title: Class: #32770 Position: 443, 122 Size: 486, 535 Style: 0x94C801C5 ExStyle: 0x00010101 Handle: 0x001C0610 >>>> Control <<<< Class: Static Instance: 1 ClassnameNN: Static1 Name: Advanced (Class): [CLASS:Static; INSTANCE:1] ID: 65535 Text: ExBrowser.Webdriver.WebDriverException: Failed to start up socket within 45000 milliseconds. Attempted to connect to the following addresses: 127.0.0.1:7055 en ExBrowser.Webdriver.Firefox.FirefoxDriverServer.#=qQZqd_UFbLtgiYEaJObL3p_r3HZUkxVmWSheHwg0v4nc=(TimeSpan #=qnMPJwUf99Jn90R2Tu9kV7g==) en ExBrowser.Webdriver.Firefox.FirefoxDriverServer.Start() en ExBrowser.Webdriver.Firefox.FirefoxDriverCommandExecutor.Execute(Command commandToExecute) en ExBrowser.Webdriver.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) en ExBrowser.Webdriver.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities) en ExBrowser.Webdriver.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities) en ExBrowser.Webdriver.Firefox.FirefoxDriver..ctor(FirefoxBinary binary, FirefoxProfile profile) en #=qAlclrRQk3iWdl38OgqME4LwgSUDhBUM0KS5Omtqu9c4=.#=qEDiyHqvKLpN9XgA1a_iKHg==(Int32 #=qzl0RcW1qF6w5$nftUb$f7A==, String #=qCBqJWBV2TlIqiFmRHJONmQ==, String #=q2iEWL2rXfQobePGhdDgqlQ==, String #=qkU2KvS4xNx8dgB3qT31z1Q==) en #=qP_zMLA06gs2RoQQ8l50QTjdn3U6jDIuUFfwJp26DbkqU5g5G$ws4lc_RKSCo9wkLJWZgEUtzAgK49KpjRPI11A==.Execute(IUBotStudio #=qGEgvonzUKfQxiQJkAwxaVQ==, Dictionary`2 #=qOquGOLomVr3Vm0_2ZA$n2A==) Position: 12, 26 Size: 431, 407 ControlClick Coords: 126, 188 Style: 0x50022080 ExStyle: 0x00000004 Handle: 0x001B03D4 >>>> Mouse <<<< Position: 584, 362 Cursor ID: 0 Color: 0xFFFFFF >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< Aceptar ExBrowser.Webdriver.WebDriverException: Failed to start up socket within 45000 milliseconds. Attempted to connect to the following addresses: 127.0.0.1:7055 en ExBrowser.Webdriver.Firefox.FirefoxDriverServer.#=qQZqd_UFbLtgiYEaJObL3p_r3HZUkxVmWSheHwg0v4nc=(TimeSpan #=qnMPJwUf99Jn90R2Tu9kV7g==) en ExBrowser.Webdriver.Firefox.FirefoxDriverServer.Start() en ExBrowser.Webdriver.Firefox.FirefoxDriverCommandExecutor.Execute(Command commandToExecute) en ExBrowser.Webdriver.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) en ExBrowser.Webdriver.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities) en ExBrowser.Webdriver.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities) en ExBrowser.Webdriver.Firefox.FirefoxDriver..ctor(FirefoxBinary binary, FirefoxProfile profile) en #=qAlclrRQk3iWdl38OgqME4LwgSUDhBUM0KS5Omtqu9c4=.#=qEDiyHqvKLpN9XgA1a_iKHg==(Int32 #=qzl0RcW1qF6w5$nftUb$f7A==, String #=qCBqJWBV2TlIqiFmRHJONmQ==, String #=q2iEWL2rXfQobePGhdDgqlQ==, String #=qkU2KvS4xNx8dgB3qT31z1Q==) en #=qP_zMLA06gs2RoQQ8l50QTjdn3U6jDIuUFfwJp26DbkqU5g5G$ws4lc_RKSCo9wkLJWZgEUtzAgK49KpjRPI11A==.Execute(IUBotStudio #=qGEgvonzUKfQxiQJkAwxaVQ==, Dictionary`2 #=qOquGOLomVr3Vm0_2ZA$n2A==) >>>> Hidden Text <<<< I just want to locate this window by the text "Attempted to connect to the following address" for example. What would you add to my bot code to let me select and click OK on this window based on that info? Thank you in advance. Damian Link to comment Share on other sites More sharing options...
232showtime Posted April 18, 2017 Share Posted April 18, 2017 try??? While True $hWnd = WinWait("[CLASS:#32770]", "Aceptar", 5) If WinExists($hWnd) Then WinActivate("[CLASS:#32770]") Consolewrite("Hello World" & @crlf) WinClose($hWnd) Else Consolewrite("Window no exists" & @crlf) EndIf Wend ill get to that... i still need to learn and understand a lot of codes Correct answer, learn to walk before you take on that marathon. Link to comment Share on other sites More sharing options...
darito84 Posted April 18, 2017 Author Share Posted April 18, 2017 Thank you, it works!!! 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