Jump to content
Sign in to follow this  
will88

$var1 = $var2

Recommended Posts

will88

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

Share this post


Link to post
Share on other sites
KaFu

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

Share this post


Link to post
Share on other sites
Jos

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

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
will88

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

Not really I've never seen the IF with ( ) in autoit and I tried == instead of = before but that didn't work ethier.

Edited by will88

Share this post


Link to post
Share on other sites
Jos

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

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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.