Jump to content

$var1 = $var2


will88
 Share

Recommended Posts

I'm sure this is a simple fix and I feel really dumb for posting this <.< but after messing around with it for 20min I can't seem to get it to work. :)

GUICreate("Enter User & Pass",230,90)
GUICtrlCreateLabel("Username:",15,5)
$User=GUICtrlCreateInput("",70,0,100,20)
GUICtrlCreateLabel("Password:",16,35)
$Pass=GUICtrlCreateInput("",70,32,100,20)
GUICtrlCreateLabel("Password:",16,65)
$Pass2=GUICtrlCreateInput("",70,62,100,20)
$DoneButton=GUICtrlCreateButton("Done",180,33)
GUISetState()

While 1
$msg = GUIGetMsg()
If $msg = -3 Then ExitLoop
If $msg = $DoneButton Then 
$Username=GUICtrlRead($User)
$Password=GUICtrlRead($Pass)
$Password2=GUICtrlRead($Pass2)

If Not $Password = $Password2 Then
MsgBox(0,"Mismatch","The passwords do not match")
EndIf
EndIf
Wend

for the some reason the above code won't work, if I take out the "Not" then the message box goes off. so $Password does = $Password2

Username: a

Password: b

Password: b

Edited by will88
Link to comment
Share on other sites

GUICreate("Enter User & Pass", 230, 90)
GUICtrlCreateLabel("Username:", 15, 5)
$User = GUICtrlCreateInput("", 70, 0, 100, 20)
GUICtrlCreateLabel("Password:", 16, 35)
$Pass = GUICtrlCreateInput("", 70, 32, 100, 20)
GUICtrlCreateLabel("Password:", 16, 65)
$Pass2 = GUICtrlCreateInput("", 70, 62, 100, 20)
$DoneButton = GUICtrlCreateButton("Done", 180, 33)
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = -3 Then ExitLoop
    If $msg = $DoneButton Then
        
        $Username = GUICtrlRead($User)
        $Password = GUICtrlRead($Pass)
        $Password2 = GUICtrlRead($Pass2)

        If $Password <> $Password2 Then
            MsgBox(0, "Mismatch", "The passwords do not match")
        Else
            MsgBox(0, "Match", "The passwords do match")
        EndIf
    EndIf
WEnd

Link to comment
Share on other sites

  • Developers

Understand the difference with your code and where yours went wrong?

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Its simple ones you understand:

This

If Not $Password = $Password2 Then

Is resolved from left to right... thus first step is to resolve "Not $Password"

This will resolve to False.

After that you compare "False = $password2"

so your statement is resolved like coding it as:

If (Not $Password) = $Password2 Then

The == just makes it compare Case-sensitive which is something you want for passwords.

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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