HcDevel Posted June 21, 2013 Share Posted June 21, 2013 (edited) Writing a script which should allow autocompletion in any textfield, I was wondering if there is a way to get the type of any selected input field such as in a webbrowser to prevent suggestions in a password input box. Thanks for your help Edited June 21, 2013 by HcDevel Link to comment Share on other sites More sharing options...
jdelaney Posted June 21, 2013 Share Posted June 21, 2013 (edited) Probably a better way, but this works for my window login #include <GuiEdit.au3> If Not _GUICtrlEdit_GetPasswordChar($hControl) Then ; This edit is not a password edit...do your autofill here EndIf conversely #include <GuiEdit.au3> If _GUICtrlEdit_GetPasswordChar($hControl) Then ; This edit is a password edit...do not do your autofill here EndIf oops, for a web broswer, the input generally will have an attribute: type="password" So if it has that attribute/value, then skip your functionality $oIE = _IEAttach("Your title") $oInputs = _IETagNameGetCollection($oIE, "input") For $oInput In $oInputs If $oInput.type = "password" Then ConsoleWrite("IS a password input: " & $oInput.outerhtml & @CRLF) Else ConsoleWrite("NOT a password input: " & $oInput.outerhtml & @CRLF) EndIf Next Edited June 21, 2013 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted June 21, 2013 Moderators Share Posted June 21, 2013 $oActiveElement = $oIE.document.activeElement If IsObj($oActiveElement) Then If String(ObjName($oActiveElement)) = "HTMLInputElement" Then If String($oActiveElement.type) = "password" Then ConsoleWrite("You have a password input." & @CRLF) EndIf EndIf EndIf Link to comment Share on other sites More sharing options...
jdelaney Posted June 21, 2013 Share Posted June 21, 2013 good call, I suppose the acive element would be the only one that matters. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted June 21, 2013 Moderators Share Posted June 21, 2013 good call, I suppose the acive element would be the only one that matters. Don't forget to convert property returns that should be strings to a string using String() or check that it is a string with IsString(). Otherwise you can end up with an inadvertent match. jdelaney 1 Link to comment Share on other sites More sharing options...
HcDevel Posted July 8, 2013 Author Share Posted July 8, 2013 Thanks for the answers. But this isn't what I was looking for. I don't want to use an Internet Explorer window. The user should be able to use his prefered webbrowser and the detection should also work in other applications. So my problem is how to get gui elements of other, external applications. It also would be a better way to recognize a textfield which was selected to be able to enable / disable the auto completition. Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted July 8, 2013 Moderators Share Posted July 8, 2013 You would need to build detection methods for each browser, not an easy task, and the other applications. 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