Jump to content

Convert Text In Labels To Asterisks For Passwords


Recommended Posts

If I can get this one little thing solved (Convert text in a label to asterisks), the program will be completed and be available in scripts and scraps.

Thanks to all who have helped me get this far.

:)

F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent]
Link to comment
Share on other sites

  • Moderators

Did you try $ES_PASSWORD?

GUICtrlCreateLabel('Text', X, Y, Width, Height, $ES_PASSWORD)

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Yes, but my program reads its text from an input box and puts it into the label...

The style doesn't work with labels

Edited by eynstyne
F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent]
Link to comment
Share on other sites

  • Moderators

Yes, but my program reads its text from an input box and puts it into the label...

The style doesn't work with labels

You're right, and I'm too tired to find the right solution :)... but here is a work around till it happens.
#include <guiconstants.au3>
Global $INPUT1_2_LABEL1_B4 = ''
$MAIN = GUICreate('main', 120, 100)
$INPUT1 = GUICtrlCreateInput('', 10, 10, 100, 20, $ES_PASSWORD)
$LABEL1 = GUICtrlCreateLabel('', 10, 35, 100, 20)
$BUTTON = GUICtrlCreateButton('TESTIT', 10, 60, 100, 30)
GUICtrlSetFont($LABEL1, 14, 400, '', 'ARIAL BOLD')


GUISetState()

While 1
    $MSG = GUIGetMsg()
    If $MSG = - 3 Then Exit
    If $MSG = $BUTTON Then
        CONVERTTEXT($INPUT1, $LABEL1)
        MsgBox(0, 'Test', 'This is only a test' & @CR & _
        'Using the $INPUT1_2_LABEL1_B4 variable that stored the information' & @CR & _
        'The label is: ' & $INPUT1_2_LABEL1_B4)
    EndIf
WEnd

Func CONVERTTEXT($v_INPUT2READ, $v_CONTROLLABEL)
    $INPUT1_2_LABEL1_B4 = GUICtrlRead($v_INPUT2READ)
    Local $s_Store = ''
    For $i_Count = 1 To StringLen($INPUT1_2_LABEL1_B4)
        $s_Store = $s_Store & Chr(149)
    Next
    GUICtrlSetData($v_CONTROLLABEL, $s_Store)
EndFunc

Using Gloabal for the variable $INPUT1_2_LABEL1_B4, you can use that as instead of GUICtrlRead() for the label, try the example out see if it will suit your needs till someone has the "right" solution.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Perfect, the label is hidden that's exactly it TYVM

:)

F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent]
Link to comment
Share on other sites

  • Moderators

Perfect, the label is hidden that's exactly it TYVM

:)

I tried using Global Const $EM_SETPASSWORDCHAR = 0xCC and GUICtrlSendMsg() but I couldn't get it to work right for some reason.

Anyway I got to looking at it and this made more sense:

#include <guiconstants.au3>

$MAIN = GUICreate('main', 120, 100)
$INPUT1 = GUICtrlCreateInput('', 10, 10, 100, 20)
$OUTPUT1 = GUICtrlCreateInput('', 10, 35, 100, 20, BitOR($WS_DISABLED, $ES_PASSWORD), $WS_EX_TRANSPARENT)
$BUTTON = GUICtrlCreateButton('TESTIT', 10, 60, 100, 30)

GUISetState()

While 1
    $MSG = GUIGetMsg()
    If $MSG = - 3 Then Exit
    If $MSG = $BUTTON Then
        GUICtrlSetData($OUTPUT1, GUICtrlRead($INPUT1))
    EndIf
WEnd

EDIT:

Or another type of output could be:

#include <guiconstants.au3>

$MAIN = GUICreate('main', 120, 75)
$INPUT1 = GUICtrlCreateInput('', 10, 10, 100, 20)
$BUTTON = GUICtrlCreateButton('TESTIT', 10, 35, 100, 30)

GUISetState()

While 1
    $MSG = GUIGetMsg()
    If $MSG = - 3 Then Exit
    If $MSG = $BUTTON Then
        $INPUTREAD = GUICtrlRead($INPUT1)
        GUICtrlDelete($INPUT1)
        GUICtrlSetState($BUTTON, $GUI_DISABLE)
        GUICtrlCreateInput($INPUTREAD, 10, 10, 100, 20, BitOR($WS_DISABLED, $ES_PASSWORD), $WS_EX_TRANSPARENT)
    EndIf
WEnd
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...