vatobeto Posted August 8, 2007 Posted August 8, 2007 (edited) Why is that a "32770" password window will accept autoit automation easily on some sites, but not others? I have used the following code on various sites: If WinExists("[CLASS:#32770]", "") Then WinActivate("[CLASS:#32770]", "") Sleep(1000) $hLogon = WinGetHandle("[CLASS:#32770]") Sleep(1000) ControlFocus($hLogon, "", "Edit2") ControlSetText($hLogon, "", "Edit2", $UName) Sleep(1000) ControlFocus($hLogon, "", "Edit3") ControlSetText($hLogon, "", "Edit3", $PW) Sleep(1000) ControlFocus($hLogon, "", "Button2") ControlClick($hLogon, "", "Button2") Else MsgBox(16, "Error", "Can't see window.") EndIf It works great on some sites, but on others, the dialog box just sits there, apparently ignoring my script, until I close it and the calling window. At that point the password and user name are written to my script! (This happens if I substitute Send calls for the ControlSetText and CotrolClick calls.) Are some sites turning off script recognition, while others are not? Is there a way around this? Puzzled. Edited August 8, 2007 by vatobeto
mikehunt114 Posted August 8, 2007 Posted August 8, 2007 Are you sure it's always a dialog box? Some pop-ups can be IE windows, and need to be handled differently. IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
PsaltyDS Posted August 8, 2007 Posted August 8, 2007 Are some sites turning off script recognition, while others are not? Is there a way around this? Puzzled. Give an example of one that doesn't work, and that we might have available... Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
jlq Posted August 15, 2007 Posted August 15, 2007 Why is that a "32770" password window will accept autoit automation easily on some sites, but not others? I have used the following code on various sites: If WinExists("[CLASS:#32770]", "") Then WinActivate("[CLASS:#32770]", "") Sleep(1000) $hLogon = WinGetHandle("[CLASS:#32770]") Sleep(1000) ControlFocus($hLogon, "", "Edit2") ControlSetText($hLogon, "", "Edit2", $UName) Sleep(1000) ControlFocus($hLogon, "", "Edit3") ControlSetText($hLogon, "", "Edit3", $PW) Sleep(1000) ControlFocus($hLogon, "", "Button2") ControlClick($hLogon, "", "Button2") Else MsgBox(16, "Error", "Can't see window.") EndIf It works great on some sites, but on others, the dialog box just sits there, apparently ignoring my script, until I close it and the calling window. At that point the password and user name are written to my script! (This happens if I substitute Send calls for the ControlSetText and CotrolClick calls.) Are some sites turning off script recognition, while others are not? Is there a way around this? Puzzled. Since you posted this, have you got any success ? I'm facing the same problem and can't solve it. jlq
PsaltyDS Posted August 15, 2007 Posted August 15, 2007 Since you posted this, have you got any success ? I'm facing the same problem and can't solve it.jlqAgain, can you give an example of a site others could try which demonstrates this problem? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
jlq Posted August 15, 2007 Posted August 15, 2007 Again, can you give an example of a site others could try which demonstrates this problem? Sorry try this: "http://www.calperelax.com/rudy/"
PsaltyDS Posted August 15, 2007 Posted August 15, 2007 Sorry try this: "http://www.calperelax.com/rudy/" I didn't have any trouble with that login box (except that I don't have a valid login!). I use a similar technique for a work script: #include <IE.au3> Opt("WinTitleMatchMode", 4) Global $sURL = "http://www.calperelax.com/rudy/" Global $sUser = "Annonymous", $sPW = "Password123" ; Open page in IE _IEErrorHandlerDeRegister() $oIE = _IECreate($sURL, 1, 1, 0) ; Detect login window While 1 If WinWait("[CLASS:#32770;TITLE:Connect]", "", 2) Then ConsoleWrite("Debug: Detected login window" & @LF) $hWin = WinGetHandle("[CLASS:#32770;TITLE:Connect]") WinActivate($hWin) ExitLoop Else ConsoleWrite("Debug: Login window not detected yet..." & @LF) EndIf WEnd ; Login Sleep(500) ControlSetText($hWin, "", "[CLASS:Edit;INSTANCE:2]", $sUser) Sleep(500) ControlSetText($hWin, "", "[CLASS:Edit;INSTANCE:3]", $sPW) Sleep(500) ControlClick($hWin, "", "[CLASS:Button;TEXT:OK]") Sleep(500) Just note that the login is treated as a regular window, not as an IE object. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
jlq Posted August 15, 2007 Posted August 15, 2007 I didn't have any trouble with that login box (except that I don't have a valid login!). I use a similar technique for a work script: #include <IE.au3> Opt("WinTitleMatchMode", 4) Global $sURL = "http://www.calperelax.com/rudy/" Global $sUser = "Annonymous", $sPW = "Password123" ; Open page in IE _IEErrorHandlerDeRegister() $oIE = _IECreate($sURL, 1, 1, 0) ; Detect login window While 1 If WinWait("[CLASS:#32770;TITLE:Connect]", "", 2) Then ConsoleWrite("Debug: Detected login window" & @LF) $hWin = WinGetHandle("[CLASS:#32770;TITLE:Connect]") WinActivate($hWin) ExitLoop Else ConsoleWrite("Debug: Login window not detected yet..." & @LF) EndIf WEnd ; Login Sleep(500) ControlSetText($hWin, "", "[CLASS:Edit;INSTANCE:2]", $sUser) Sleep(500) ControlSetText($hWin, "", "[CLASS:Edit;INSTANCE:3]", $sPW) Sleep(500) ControlClick($hWin, "", "[CLASS:Button;TEXT:OK]") Sleep(500) Just note that the login is treated as a regular window, not as an IE object. I ran the code you suggested replacing "Annonymous" & "Passoword123" by their exact value (Which I can't publish here) and the script goes in an endless loop until I stop executing [Ctrl+F5]. Here is a copy of the console: --> IE.au3 Warning from function _IEAttach, $_IEStatus_NoMatch Debug: Login window not detected yet... Debug: Login window not detected yet... Debug: Login window not detected yet... Debug: Login window not detected yet... Debug: Login window not detected yet... Debug: Login window not detected yet... >Process failed to respond; forcing abrupt termination... >Exit code: 1 Time: 14.455
PsaltyDS Posted August 15, 2007 Posted August 15, 2007 I ran the code you suggested replacing "Annonymous" & "Passoword123" by their exact value (Which I can't publish here) and the script goes in an endless loop until I stop executing [Ctrl+F5]. Here is a copy of the console: --> IE.au3 Warning from function _IEAttach, $_IEStatus_NoMatch Debug: Login window not detected yet... Debug: Login window not detected yet... Debug: Login window not detected yet... Debug: Login window not detected yet... Debug: Login window not detected yet... Debug: Login window not detected yet... >Process failed to respond; forcing abrupt termination... >Exit code: 1 Time: 14.455Look closely at what it's matching: WinWait("[CLASS:#32770;TITLE:Connect]", "", 2) Using AU3Info on the login window, does the title on your window start with "Connect" in that exact spelling? Perhaps regional spelling or characters are preventing a match? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
jlq Posted August 15, 2007 Posted August 15, 2007 Look closely at what it's matching: WinWait("[CLASS:#32770;TITLE:Connect]", "", 2) Using AU3Info on the login window, does the title on your window start with "Connect" in that exact spelling? Perhaps regional spelling or characters are preventing a match? Tks PsaltyDS, you are correct ! French spelling was the bug. Now it works. Although, Console still giving some warnings: --> IE.au3 Warning from function _IEAttach, $_IEStatus_NoMatch Debug: Detected login window >Exit code: 0 Time: 4.543
PsaltyDS Posted August 15, 2007 Posted August 15, 2007 Tks PsaltyDS, you are correct ! French spelling was the bug. Now it works.Although, Console still giving some warnings:--> IE.au3 Warning from function _IEAttach, $_IEStatus_NoMatchDebug: Detected login window>Exit code: 0 Time: 4.543That's a normal indication. The _IECreate() has the option set to try and attach before creating. It is just showing that it didn't find a instance of IE already at that page. Look up the options for _IECreate() in the help file and compare with the parameters used in my code. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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