Jump to content

INPUT BOX FOR PASSWORD


star2
 Share

Recommended Posts

when I run my GUI it starts with an input box asking for password

and I've set the password and a MsgBox to apear if password entered not correct

but I can't just make it go back to the input box to make the user try again using [ OK & Cancel ] MsgBox

if anyone can help

this is the gui

#include <GUIConstants.au3>

GUICreate("test", 300, 250)
GUISetFont(12)

$pass = InputBox ("enter password", "please enter your password","","!",150,80)
    

GUICtrlCreateLabel("one line input", 4, 4)
$put1 = GUICtrlCreateInput("", 4, 25, 200, 25)
GUICtrlCreateLabel("Multi line input", 4, 60)
$put2 = GUICtrlCreateEdit("", 4, 80, 150, 100)
$send = GUICtrlCreateButton("send all to file", 4, 215, 150, 25)

GUISetState()



While  1
    $msg = GUIGetMsg()
    If $pass <> "my-pass" Then
        MsgBox (1,"warning" , "incorrect password" & @CRLF & "tRY AGAIN ?")
    EndIf
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    If $msg = $send Then SendMyData ()
WEnd



Func SendMyData()
    FileDelete('test.inf')
    $data = "[General]" & @CRLF & GUICtrlRead($put1) & @CRLF & @CRLF & GUICtrlRead($put2)
    FileWrite('\test.inf', $data)
    MsgBox(0,'Info','Data written to test.inf')
EndFunc
Edited by star2

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Link to comment
Share on other sites

#include <GUIConstants.au3>

Do
    $pass = InputBox ("enter password", "please enter your password","","*",150,80)
    If $pass<>"my-pass"Then
        $msgbox=MsgBox (1,"warning" , "incorrect password" & @CRLF & "tRY AGAIN ?")
        If $msgbox=2 Then
            Exit
        EndIf
    EndIf
Until $pass="my-pass"

GUICreate("test", 300, 250)
GUISetFont(12)


   

GUICtrlCreateLabel("one line input", 4, 4)
$put1 = GUICtrlCreateInput("", 4, 25, 200, 25)
GUICtrlCreateLabel("Multi line input", 4, 60)
$put2 = GUICtrlCreateEdit("", 4, 80, 150, 100)
$send = GUICtrlCreateButton("send all to file", 4, 215, 150, 25)

GUISetState()



While  1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    If $msg = $send Then SendMyData ()
WEnd



Func SendMyData()
    FileDelete('test.inf')
    $data = "[General]" & @CRLF & GUICtrlRead($put1) & @CRLF & @CRLF & GUICtrlRead($put2)
    FileWrite('\test.inf', $data)
    MsgBox(0,'Info','Data written to test.inf')
EndFunc

Not Tested.

Link to comment
Share on other sites

Is this maybe what you are looking for?

#include <GUIConstants.au3>

Do
    $pass = InputBox ("enter password", "please enter your password","","!",150,80)
    If $pass <> "my-pass" Then
        MsgBox (1,"warning" , "incorrect password" & @CRLF & "tRY AGAIN ?")
    EndIf
Until $pass == "my-pass"

GUICreate("test", 300, 250)
GUISetFont(12)
GUICtrlCreateLabel("one line input", 4, 4)
$put1 = GUICtrlCreateInput("", 4, 25, 200, 25)
GUICtrlCreateLabel("Multi line input", 4, 60)
$put2 = GUICtrlCreateEdit("", 4, 80, 150, 100)
$send = GUICtrlCreateButton("send all to file", 4, 215, 150, 25)

GUISetState()

While  1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    If $msg = $send Then SendMyData ()
WEnd

Func SendMyData()
    FileDelete('test.inf')
    $data = "[General]" & @CRLF & GUICtrlRead($put1) & @CRLF & @CRLF & GUICtrlRead($put2)
    FileWrite('\test.inf', $data)
    MsgBox(0,'Info','Data written to test.inf')
EndFunc
Link to comment
Share on other sites

#include <GUIConstants.au3>

GUICreate("test", 300, 250)
GUISetFont(12)

$pass = InputBox ("enter password", "please enter your password","","!",150,80)
   

GUICtrlCreateLabel("one line input", 4, 4)
$put1 = GUICtrlCreateInput("", 4, 25, 200, 25)
GUICtrlCreateLabel("Multi line input", 4, 60)
$put2 = GUICtrlCreateEdit("", 4, 80, 150, 100)
$send = GUICtrlCreateButton("send all to file", 4, 215, 150, 25)

GUISetState()



While  1
    $msg = GUIGetMsg()
    If $pass <> "my-pass" Then
            $WrongPass = MsgBox (1,"warning" , "incorrect password" & @CRLF & "tRY AGAIN ?")
            If  $WrongPass = 1 Then
                $pass = InputBox ("enter password", "please enter your password","","!",150,80)
            ElseIf $WrongPass = 2 Then
                $Exting = MsgBox (0,"Exiting" , "Due to cancelation by user.." & @CRLF & "Now exiting test.")
                ExitLoop
            EndIf
    EndIf
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    If $msg = $send Then SendMyData ()
WEnd



Func SendMyData()
    FileDelete('test.inf')
    $data = "[General]" & @CRLF & GUICtrlRead($put1) & @CRLF & @CRLF & GUICtrlRead($put2)
    FileWrite('\test.inf', $data)
    MsgBox(0,'Info','Data written to test.inf')
EndFunc

Link to comment
Share on other sites

Generator

Dickb

smashly

thanks alot

this is what I've beedn looking for

thanks again

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Link to comment
Share on other sites

I guess this is working fine if you dont' need a case-sensitive password.

If you need to be case-sensitive, the easiest way I've found is to use _StringToHex to convert the input and the password to a hex string and then to do the check.

(case-sensitive means that "PaSSword" <> "password" ... sorry for this explanation - it is obvious but ... :) )

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

I guess this is working fine if you dont' need a case-sensitive password.

If you need to be case-sensitive, the easiest way I've found is to use _StringToHex to convert the input and the password to a hex string and then to do the check.

(case-sensitive means that "PaSSword" <> "password" ... sorry for this explanation - it is obvious but ... :) )

thanks didn't try it yet but I will soon

thank you

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Link to comment
Share on other sites

  • 1 year later...

thanks for scripts. muttley

additionally, i just add one line to trigger CANCEL button.

$pass = InputBox ("enter password", "please enter your password","","*",150,80)

if (@Error == 1) Then Exit ; *** new line added

Link to comment
Share on other sites

If you want a true password you use Encryption/Decryption on the input box while keeping it in RAM and never entering the real password decrypt onto the hard drive. Lookup _StringEncrypt($i_Encrypt, $s_EncryptText, $s_EncryptPassword[, $i_EncryptLevel = 1])

Contact via MSN: [email=terarink_msn@hotmail.com]terarink_msn@hotmail.com[/email], yahoo: terarink_yah

Link to comment
Share on other sites

If you want a true password you use Encryption/Decryption on the input box while keeping it in RAM and never entering the real password decrypt onto the hard drive. Lookup _StringEncrypt($i_Encrypt, $s_EncryptText, $s_EncryptPassword[, $i_EncryptLevel = 1])

Look at the other 'more secure' examples, floating around the forum. There is MD5, SHA1, blowfish... Its all there muttley

EDIT: Oh! And did I mention that this was a wonderful bump of an old topic?

Edited by Bert
Link to comment
Share on other sites

I guess this is working fine if you dont' need a case-sensitive password.

If you need to be case-sensitive, the easiest way I've found is to use _StringToHex to convert the input and the password to a hex string and then to do the check.

(case-sensitive means that "PaSSword" <> "password" ... sorry for this explanation - it is obvious but ... muttley )

You could just use ==

[size="10"]Pure Au3 crypt funcs(I'm currently also working on making a dll from this)[/size][Y] Be more active in the community[Y] Get 200 posts[N] Get 300 posts[N] Make a Topic in the example scripts forum with at least 50 replies.People who currently hate me:ValikSmOke_N

Link to comment
Share on other sites

  • 3 years later...

Wunderful bump. The last post in this thread is over 3 years old :D

And no. The script as it now is can only save one password because it deletes the file before saving.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

  • Recently Browsing   0 members

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