Sign in to follow this  
Followers 0
HcDevel

Get input type

7 posts in this topic

#1 ·  Posted (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 by HcDevel

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

1 person likes this

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

You would need to build detection methods for each browser, not an easy task, and the other applications.

Share this post


Link to post
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
Sign in to follow this  
Followers 0