Jump to content

dynamically show/hide a password


31290
 Share

Recommended Posts

Hi Guys, 

Hope you're fine today!

I'd like to create a small GUI that, when clicking a button, the password set in the GUICtrlCreateInput is revealed and when the click is released, the password is hidden again. W8/10 style in fact...

Here's what I have so far:

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

Opt("GUIOnEventMode", 1)

f_RemedyUpdate()

While 1
   Sleep(10)
Wend

Func f_RemedyUpdate()
    $gMailCreds = GUICreate("SEE CHECKLISTS", 300, 140)
    GUISetBkColor($Color_White)
    GUISetFont(8.5, 700, 0)
    GUICtrlCreateLabel("Password required for your account" , 5, 10)
    GUICtrlCreateLabel("Your Password:", 10, 70, 100, 30)
    $g_PassInput = GUICtrlCreateInput("", 110, 66, 150, 20, $ES_PASSWORD)
    GUICtrlSetColor(-1, 0x800080)
    $g_ShowPassButton =  GuiCtrlCreateButton ("", 270, 67, 16, 16, $BS_ICON)    
    GUICtrlSetImage(-1, "C:\eye.ico")
    GuiCtrlSetOnEvent ($g_ShowPassButton, "f_ShowPassword") 
    $g_SubmitBtn = GUICtrlCreateButton ("Submit", 120, 100, -1, -1,  $BS_DEFPUSHBUTTON)
    GUICtrlSetOnEvent(-1, "f_SendMail")
    GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")
    GUISetState(@SW_SHOW)
EndFunc

Func f_ShowPassword()
    $s_PWD = GuiCtrlRead ($g_PassInput)
    If $s_PWD = "" Then 
        Msgbox (64, "Your password", "You did not type any password")
        Else
        Msgbox (64, "Your Password", "You typed --> " & $s_PWD & " <-- as password.")
    EndIf
EndFunc

I've enclosed the small ico file I'm using 

Thanks in advance for any help provided

-31290

 

eye.ico

~~~ Doom Shall Never Die, Only The Players ~~~

Link to comment
Share on other sites

EDIT
---
Solution has been found, even if it's not "dynamic", this will do the job. Thanks for pointing that me out :)

Cheers!
---

Thanks but all examples are shown with Switch...Case mode...

And I don't know how to integer this within a OnEvent script.

Maybe you could help?

Thanks :)

-31290

Edited by 31290
Solution Found

~~~ Doom Shall Never Die, Only The Players ~~~

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