windows handle and password box problem

Recommended Posts

xtrm 0

xtrm 0

hello, I have a problem with a password edit box. I can input text into the password box but I cannot delete the text sending "". Seems the password box disables some properties or has different properties than a normal edit box when its focused. The following command did not work for me:

finds everytime "", you can type anything in the password field but only "" will be return

the control E which select all the text doesnt work here.

there could be a fix but i dont like it very much, and its just with ALT C in my case, which will automaticaly set focus to the box because its the predefined key, and then deleting the selection with {BACKSPACE}.

in case it could be a sensitive problem but $a shows "" even when there is text, so i think this time it is a limitation of this password box which doesnt allow checking its content. dunno if this password box could be fully managed directly with a handle and skip its attributes.

Share this post

Link to post

Share on other sites

xtrm 0

xtrm 0

I remember the script can be improved a lot, there are some things which could be skip.

Also make sure you change the **** with the necessary text of your window.

$pass="123456";your password$a="";getting focus of active windows by title which are hard to be focused;script can be improved, seems to work nice most of the times :);the script has to be improved;sending the handle of a window and checking if existFunc IsVisible($handle)IfBitAnd(WinGetState($handle),1)ThenReturn1ElseReturn0EndIfEndFuncWhile1$var=WinList();needs to be here to refresh each time the array list of windows;loop to check all the active windowsFor$i=1to$var[0][0];checking if it is our window, **CHECK YOUR TEXT IN TASKBARIf($var[$i][0]=="Credenciales de Microsoft Office Outlook"OR$var[$i][0]=="Conectar a ****")AND IsVisible($var[$i][1])Then;messagebox test to check script errors;MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1]) ;set the window attribute on topWinSetOnTop("Conectar a ****","",1);show the window in case its hiddenWinSetState("title","text",@SW_SHOW);while we have focus on the windowWhile(WinActivate("Conectar a ****",""));if we got focus to the window, then we set focus to the textbox and finally send the text clearing it before.If(WinActive("Conectar a ****",""))Then;setting textbox focus;$a = ControlGetText("Conectar a ****", "", 1005);MsgBox(0, "Details", "a = " & $a);clear textbox if it has something;If ($a = "" ) Then ;its already clear;clear and send text to the passwordbox identified by ID (1005).;MsgBox(0, "Details", "no text found, found:" & $a);this password box doesnt allow to check its content so we will have to clear everytime and put the passwordControlSetText("Conectar a ****","",1005,"");clear the textControlSend("Conectar a ****","",1005,$pass&"{ENTER}");sending the password;second alternative method to send text to the password box, --less secure.;Clipput("") ;clean clipboard memory;ClipPut($pass) ;send text to the clipboard;Send("^V");Send("{ENTER}");Else ;the textbox if not clear, and we must clear it before sending text. ;ControlSend must clear the textbox before adding more text.;MsgBox(0, "Details", "text found!!");ControlSetText("Conectar a ****", "", 1005, "");ControlSend("Conectar a ****", "", 1005, $pass) ;EndIf;if the window is found and info has been sent to the control, wait more seconds to search for the windows againSleep(20000)EndIfWEndEndIf;Clipput("") ;clean clipboard memory if second method has been usedNextSleep(1000)WEnd