Jump to content

Entering passwords


Graeme
 Share

Recommended Posts

I have code to enter password using the setting $ES_PASSWORD. It seems that with this setting you can't enter more than the letters that fill box. Can anyone tell me how to enter more characters?

GUICreate("Password Test",500,200)
    $Input = GUICtrlCreateInput("Password",10,20,40,50,$ES_PASSWORD)
GUISetState(@SW_SHOW,"Password Test")
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUISetState(@SW_HIDE,"Password Test")
            ExitLoop
    EndSwitch
WEnd
If GUICtrlRead($Input) <> "" Then MsgBox(0,GUICtrlRead($Input),"Done")

With this code you can only enter 4 characters of password.

Link to comment
Share on other sites

With using $ES_Password you have dropped all other default style values. You need to add them using something like this:

#include <GUIConstantsEx.au3>
#include <EditConstants.au3>

GUICreate("Password Test", 500, 200)
$Input = GUICtrlCreateInput("Password", 10, 20, 40, 20, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
$OK = GUICtrlCreateButton("OK", 60, 20, 40, 20)
GUISetState(@SW_SHOW, "Password Test")
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUISetState(@SW_HIDE, "Password Test")
            ExitLoop
        Case $OK
            MsgBox(0, "Password", "Password has " & StringLen(GUICtrlRead($Input)) & " characters!")
    EndSwitch
WEnd

BTW: When posting code, please post a fully working script with all needed includes etc. Makes testing much easier und faster ;)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Even better and more flexible :)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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

×
×
  • Create New...