Sign in to follow this  
Followers 0
Ultima2

Inputbox password check?

6 posts in this topic

I've been trying to write a script for checking password. I've got it this far.

#include <GUIConstants.au3>

$pass = InputBox("Password", "Password", "", "*")
While 1
    If $pass <> "my-pass" Then
        $WrongPass = MsgBox(1, "Wrong Pass", "Retry?")
        If $WrongPass = 1 Then
            $pass = InputBox("Password", "Password", "", "*")
        EndIf
        If $WrongPass = 2 Then
            ExitLoop
        EndIf
    EndIf
WEnd

MsgBox(0,"Good Job", "Good Job")

The problem I've been having is that when the wrong password is put in, the script kept continuing to the MsgBox part. Is there a way to write it such that if a wrong password is entered, the script will stop and not continue to the other part?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi there m8,

Try this code:

#include <GUIConstants.au3>

Do
    $pass = InputBox("Password", "Password", "", "*")
    If @error = 1 Then
            Exit
    EndIf

Until $pass = "my-pass"

MsgBox(0,"Good Job", "Good Job")

Cheers

Edited by November

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites

Hi there m8,

Try this code:

Do
    $pass = InputBox("Password", "Password", "", "*")
Until $pass = "my-pass"

MsgBox(0,"Good Job", "Good Job")

Cheers

Thanks a lot, but if someone click close or cancel on the inputbox it will just keep looping. Is there a way to make it so that it wont loop, but if a wrong password is entered the script will end right there and not continue?

Share this post


Link to post
Share on other sites

Thanks a lot, but if someone click close or cancel on the inputbox it will just keep looping. Is there a way to make it so that it wont loop, but if a wrong password is entered the script will end right there and not continue?

:)

Yeah... i updated the code :)

Check it now o:)

Cheers


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites

o:)

Yeah... i updated the code :)

Check it now ;)

Cheers

Oh cool now it works, thanks man :)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Do
    $pass = InputBox("Password", "Password", "", "*")
    If @error Then Exit
Until $pass = "password"

Ah, I'm a little late.

Edited by TehWhale

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