will never learn Posted August 26, 2009 Share Posted August 26, 2009 This is a very odd problem. Totally unexplainable to me... I am trying to log into a program and therefore use run() to call the login window. Real simple this far. However, when I am trying to log in using ControlSetText, the password is called incorrect and the login fails. ControlSetText("Production Anmeldung in proALPHA","",15,"username") Sleep(300) ControlSetText("Production Anmeldung in proALPHA","",17,"password") Sleep(300) ControlClick("Production Anmeldung in proALPHA","OK",11) When using one of the two examples of code below, it works... ControlSetText("Production Anmeldung in proALPHA","",15,"username") Sleep(300) ControlSend("Production Anmeldung in proALPHA","",17,"password") Sleep(300) ControlClick("Production Anmeldung in proALPHA","OK",11) ControlSetText("Production Anmeldung in proALPHA","",15,"username") Sleep(300) ControlClick("Production Anmeldung in proALPHA","",17) Sleep(300) Send("password{ENTER}") From my testing, ControlSetText() seems to set the text in the Control, but in fact doesn't. If for exampe the window is called and the username is set to, say "user1" and I use ControlSetText() to change it to "user2", I will receive an error message, saying that "user1 is unknown or the password is incorrect". And this even though the text fiel shows "user2". Can someone explain this to me? Is this a known issue? Are there elegant workarounds? Because right now I can only image using ControlClick(), Send() with a bunch of Delete and Backspace keys and then ControlSend(). Not very nice... Looking forward to the experts' answers... Link to comment Share on other sites More sharing options...
GodlessSinner Posted August 26, 2009 Share Posted August 26, 2009 Im not sure, but try this: ControlSetText("Production Anmeldung in proALPHA","",15,"username",1) Sleep(300) ControlSetText("Production Anmeldung in proALPHA","",17,"password",1) Sleep(300) ControlClick("Production Anmeldung in proALPHA","OK",11) ([optional] when different from 0 (default) will force the target window to be redrawn.) _____________________________________________________________________________ Link to comment Share on other sites More sharing options...
will never learn Posted August 26, 2009 Author Share Posted August 26, 2009 Thanks for the tip. However, it doesn't change a thing :-( Just for the archives: my Workaround: Dim $user $user = ControlGetText("Production Anmeldung in proALPHA","",15) Sleep(3000) If $user <> "username" Then ControlSend("Production Anmeldung in proALPHA","",15,"{BACKSPACE}{BACKSPACE}{BACKSPACE}{BACKSPACE}{BACKSPACE}{BACKSPACE}{BACKSPACE}{BACKSPACE}{BACKSPACE}{BACKSPACE}{BACKSPACE}{BACKSPACE}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}") Sleep(3000) ControlSend("Production Anmeldung in proALPHA","",15,"username") EndIf Sleep(3000) ControlSend("Production Anmeldung in proALPHA","",17,"password") Sleep(3000) ControlClick("Production Anmeldung in proALPHA","OK",11, "primary",1) Link to comment Share on other sites More sharing options...
GodlessSinner Posted August 26, 2009 Share Posted August 26, 2009 Tip: Use {BACKSPACE X} instead of {BACKSPACE}(1) {BACKSPACE}(2) ...{BACKSPACE}(X) _____________________________________________________________________________ Link to comment Share on other sites More sharing options...
will never learn Posted August 31, 2009 Author Share Posted August 31, 2009 Ok. Scrap the workaround. It is still not working, for some reason. Any other ideas? I am out of clues here Link to comment Share on other sites More sharing options...
jvanegmond Posted August 31, 2009 Share Posted August 31, 2009 It's probably the GUI you're trying to automate that is not following good GUI design practices. If you say ControlSend works, I recommend using that. github.com/jvanegmond Link to comment Share on other sites More sharing options...
ResNullius Posted September 1, 2009 Share Posted September 1, 2009 I recently encountered a similar problem with automating an app written in Clarion Topspeed: I could ControlSetText() for a filename edit control, but on clicking the OK button, the operation failed. Slowing down the process actually revealed that as soon as the edit field lost focus to the OK button the text was cleared. In the end, ControlSend() was the way to go. Link to comment Share on other sites More sharing options...
Dschingis Posted September 1, 2009 Share Posted September 1, 2009 In my opinion everything working fine. Password controls are handled differently in common to prevent exactly this automated entering of passwords. This behaviour is totally different to normal edit or input controls and therefore not expected. But the workaround with sending x times BS char is not useable. You have to send a few hundreds of BS chars to get rid of very long passwords. I would use ControlSend("Production Anmeldung in proALPHA","",15,"{HOME}+{END}") So the whole text will be selected and can be overwritten instantly with your password. Hope that helps. D. Link to comment Share on other sites More sharing options...
will never learn Posted September 3, 2009 Author Share Posted September 3, 2009 Resolved!Here's what's working:I use ControlFocus() and then ControlSend().Don't ask me why exactly this works. But this done so repeatedly, so it is a good enough solution for me...Thanks for y'all's help.Will Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 3, 2009 Share Posted September 3, 2009 Resolved!Here's what's working:I use ControlFocus() and then ControlSend().Don't ask me why exactly this works. But this done so repeatedly, so it is a good enough solution for me...Thanks for y'all's help.WillDepending on how complex your passwords are, it can be critical to use the RAW flag for Send() or ControlSend(), otherwise special characters get interpreted as Send codes. For example, "Adm!n" would be send as A, d, m, ALT-n. 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 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