Mask password in dialog box?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
tmallardi
Newbie
Posts: 13
Joined: Tue Jul 08, 2003 1:50 am
Location: Dallas, TX, USA

Mask password in dialog box?

Post by tmallardi » Sun Sep 28, 2003 1:25 am

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?

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sun Sep 28, 2003 2:54 am

You can mask the value entered by the user with asterisks by setting the INPUT_PASSWORD variable to 1.

Remember to set it back to the default of 0 before you use it again.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

INPUT_PASSWORD=1 Doesn't work with Dialogs

Post by adroege » Fri Apr 22, 2005 7:45 pm

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

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Fri Apr 22, 2005 9:08 pm

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%
MJT Net Support
[email protected]

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Mon Sep 19, 2005 2:26 am

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

User avatar
JRL
Automation Wizard
Posts: 3517
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Sep 19, 2005 3:20 am

Just used Support's script last week and it works good. But I do agree that it was difficult to incorporate into my script. If we're voting, I'd vote for an edit box masking option within the dialog.

Dick

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Fri Oct 27, 2006 5:11 am

Just to note: ability added in v9

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 - :-)

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Fri Oct 27, 2006 7:24 am

True But Version 9 Not Released Yet. Once That Is Realeased I Will Be Getting It & Using That Option. I Think Its A Great One To Include I Asked Marcus About This A While Ago.
FIREFIGHTER

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Fri Oct 27, 2006 3:58 pm

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?
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 - :-)

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts