Jump to content

Password incorrect using ControlSetText()


Recommended Posts

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.

post-15116-12512703633744_thumb.png

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

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

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

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

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

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

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

:D

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

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