Jump to content

Inputbox password check?


Ultima2
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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]

Link to comment
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?
Link to comment
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]

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...