Mask password in dialog box?
Moderators: Dorian (MJT support), JRL
Mask password in dialog box?
I would like to prompt the user for their login name and password from a dialog box.
Is it possible to mask an "edit" variable within a dialog box?
Is it possible to mask an "edit" variable within a dialog box?
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
INPUT_PASSWORD=1 Doesn't work with Dialogs
The trick with INPUT_PASSWORD only seems to work when using the "input>" command. "tmallardi" had asked if it was possible when using a Dialog form. I now have the same need. I have the following dialog code:
Dialog>Dialog1
Caption=Dialog1
Top=207
Width=388
Left=148
Height=205
Label=UserName,72,32
Label=Password,72,72
Edit=msEdit1,136,24,121,
Edit=msEdit2,136,72,121,
Button=Save,160,120,75,25,10,,Save settings to INI file at location C:\ProxySettings.ini
EndDialog>Dialog1
So I need the msEdit2 object to implement the password masking behavior. Is this possible? Can it be added as an enhancement?
-Thanks
Dialog>Dialog1
Caption=Dialog1
Top=207
Width=388
Left=148
Height=205
Label=UserName,72,32
Label=Password,72,72
Edit=msEdit1,136,24,121,
Edit=msEdit2,136,72,121,
Button=Save,160,120,75,25,10,,Save settings to INI file at location C:\ProxySettings.ini
EndDialog>Dialog1
So I need the msEdit2 object to implement the password masking behavior. Is this possible? Can it be added as an enhancement?
-Thanks
Input>variable,prompt[,default_value]
Displays a dialog box to request information from the user. The dialog box displays the prompt specified in prompt and accepts input into variable. Optionally, a default value can be specified.
The Input box now also has a file browse button, making it useful for accepting filenames from the user.
If the Input dialog is cancelled (cancel is pressed) Input returns an empty string.
prompt can be a variable, containing the prompt to display.
It is possible to mask the value entered by the user with asterisks by setting the INPUT_PASSWORD variable to 1. Set to zero for default behaviour.
Here you go:
Dialog>dlgPassword
Caption=Enter Password
Top=121
Width=273
Left=134
Height=155
Label=Username:,24,24
Label=Password,24,64
Edit=txtUsername,88,24,121,
Edit=txtPassword,88,64,121,txtPassword
Button=OK,88,96,75,25,2
EndDialog>dlgPassword
//show the form so that we can access it
Show>dlgPassword
//set edit box to a password box, note we have initially set
//edit box contains to "txtPassword" so that we can locate it
Let>EM_SETPASSWORDCHAR=204
Let>ASTERISKCHAR=42
LibFunc>user32,FindWindowA,dlgHwnd,TForm,Enter Password
LibFunc>user32,FindWindowExA,txtHwnd,dlgHwnd,0,TEdit,txtPassword
LibFunc>user32,SendMessageA,nowt,txtHwnd,EM_SETPASSWORDCHAR,ASTERISKCHAR,0
//Set the password text to nothing
Let>dlgPassword.txtPassword=
ResetDialogAction>dlgPassword
//wait for user to close box
Label>waitpassword
GetDialogAction>dlgPassword,r
If>r2,waitpassword
Message>User entered Password: %dlgPassword.txtPassword%
Dialog>dlgPassword
Caption=Enter Password
Top=121
Width=273
Left=134
Height=155
Label=Username:,24,24
Label=Password,24,64
Edit=txtUsername,88,24,121,
Edit=txtPassword,88,64,121,txtPassword
Button=OK,88,96,75,25,2
EndDialog>dlgPassword
//show the form so that we can access it
Show>dlgPassword
//set edit box to a password box, note we have initially set
//edit box contains to "txtPassword" so that we can locate it
Let>EM_SETPASSWORDCHAR=204
Let>ASTERISKCHAR=42
LibFunc>user32,FindWindowA,dlgHwnd,TForm,Enter Password
LibFunc>user32,FindWindowExA,txtHwnd,dlgHwnd,0,TEdit,txtPassword
LibFunc>user32,SendMessageA,nowt,txtHwnd,EM_SETPASSWORDCHAR,ASTERISKCHAR,0
//Set the password text to nothing
Let>dlgPassword.txtPassword=
ResetDialogAction>dlgPassword
//wait for user to close box
Label>waitpassword
GetDialogAction>dlgPassword,r
If>r2,waitpassword
Message>User entered Password: %dlgPassword.txtPassword%
MJT Net Support
[email protected]
[email protected]
- CyberCitizen
- Automation Wizard
- Posts: 721
- Joined: Sun Jun 20, 2004 7:06 am
- Location: Adelaide, South Australia
Is There Any Chance We Can Get A Feature Added Similar To INPUT_PASSWORD?
This Is A Feature I Would Very Much Like. I Can Do It The Way Its Posted However That Is Alot Of Work.
As You Can See There Are 3 People What Would Like This Feature At Least, People Post Here If You Would Like This An An Option.
This Is A Feature I Would Very Much Like. I Can Do It The Way Its Posted However That Is Alot Of Work.
As You Can See There Are 3 People What Would Like This Feature At Least, People Post Here If You Would Like This An An Option.
FIREFIGHTER
Just to note: ability added in v9
V9 Help file History says...
Added PasswordChar property to Custom Dialog Edit fields
Thanks Marcus!
V9 Help file History says...
Added PasswordChar property to Custom Dialog Edit fields
Thanks Marcus!
jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
- CyberCitizen
- Automation Wizard
- Posts: 721
- Joined: Sun Jun 20, 2004 7:06 am
- Location: Adelaide, South Australia
Hi CyberCitizen,
I don't think v9 will be officially released until January, Marcus mentions January in this post. You could wait until then or... just upgrade now to the beta.
If you don't want to install a beta version on your main machine, if you have the version with the compiler, you could download the beta with compiler to a different machine, install it there, compile that one script you want to use this new feature with to a standalone .exe and just use that .exe on any machine you needed to until January.
Note: I'm not positive, but I also think that some time in January, the .exe that you made using the beta would no longer function (beta expires) and you'd have to re-compile it using the released version. Marcus can you confirm the above?
I don't think v9 will be officially released until January, Marcus mentions January in this post. You could wait until then or... just upgrade now to the beta.
If you don't want to install a beta version on your main machine, if you have the version with the compiler, you could download the beta with compiler to a different machine, install it there, compile that one script you want to use this new feature with to a standalone .exe and just use that .exe on any machine you needed to until January.
Note: I'm not positive, but I also think that some time in January, the .exe that you made using the beta would no longer function (beta expires) and you'd have to re-compile it using the released version. Marcus can you confirm the above?
jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -