Sign in to follow this  
Followers 0
star2

INPUT BOX FOR PASSWORD

14 posts in this topic

#1 ·  Posted (edited)

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]

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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]

Share this post


Link to post
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 :)

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

You could just use ==

Good point muttley

Thanks


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

Share this post


Link to post
Share on other sites

But I have 1 question:

Can you insert more passwords?

Share this post


Link to post
Share on other sites

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0