Jump to content
Sign in to follow this  
Ultima2

Inputbox password check?

Recommended Posts

Ultima2

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
November

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
Ultima2

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
November

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
Ultima2

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
TehWhale

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.