thehum Posted April 24, 2008 Share Posted April 24, 2008 What I'm trying to do: Automate login checking for a list of given accounts. To do so I use functions from IE.au3 to logout first then go to the login page and enter user info. So far so good, but I get two Security Alerts going to the logout page and two more after entering login info and logging in. I know I can lower or disable security in IE but I'd like to account for those errors anyway in my code. I found a function from this thread that pretty much does exactly what I want but I could not get it to work (Autoit gave me an error that the while loop in the function needed a Wend even though one was clearly there.) So here's what I basically have:;create IE window $oIE = _IECreate() ;logout of exed _IENavigate($oIE, "logout") ;log into exed _IENavigate($oIE, $website)From the above mentioned thread, anyday created an _IEpopup function, which was revised by Nuffilein805that I couldn't get working:;1. Func _IEPopUps() Sleep( 3000 ) While 1 $windowtitle = WinGetTitle("", "") Select Case $windowtitle = "Security Alert" WinActivate("Security Alert", "") ControlClick("Security Alert", "", "Button1") Case $windowtitle = "Choose a digital certificate" WinActivate("Choose a digital certificate", "") ControlClick("Choose a digital certificate", "", "Button3") Case $windowtitle = "your title"; <---- ExitLoop; <------ EndSelect WEnd EndFunc ;or 2. Func _IEPopUps() Sleep( 3000 ) $tim = timerinit() While 1 $windowtitle = WinGetTitle("", "") Select Case $windowtitle = "Security Alert" WinActivate("Security Alert", "") ControlClick("Security Alert", "", "Button1") Case $windowtitle = "Choose a digital certificate" WinActivate("Choose a digital certificate", "") ControlClick("Choose a digital certificate", "", "Button3") EndSelect if timerdiff($tim) > 5000 then exitloop; <----- set the delay to whatever you need WEnd EndFuncand I don't know how to go about selecting yes in the security alert boxes because the _IENavigate function waits for the page to load completely before moving onto the next line of code. Any ideas? thanks. Link to comment Share on other sites More sharing options...
thehum Posted April 24, 2008 Author Share Posted April 24, 2008 EDIT: The IEPopUps Script actually does work. But I was trying to use the function in a while loop, which I've just learned isn't possible and is the reason I was getting the error. Link to comment Share on other sites More sharing options...
luzif3r Posted April 25, 2008 Share Posted April 25, 2008 i also had this problem and i got help AdlibEnable("_popup", 250) Func _popup() Local $sPopup = "[CLASS:#32770; TITLE:Windows Internet Explorer;]" Local $sButton = "[CLASSNN:Button1; TEXT:OK]" Local $active = WinGetHandle("") If WinExists($sPopup) Then ControlClick($sPopup, "", $sButton) Return True EndIf EndFunc customize the class and button to your liking and be aware that the function is called every 250 millseconds so either raise that or disable it when not needed. 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