Sign in to follow this  
Followers 0
NSearch

GUI Input Variable Problem

3 posts in this topic

Can anyone see what I am doing wrong here? I am trying to store a username and password in two seperate variables. I have tried to output what they should be, but I am not having any luck. Please advise, thanks.

#include <GuiConstants.au3>

Dim $username

Dim $password

Dim $correct_password

Dim $correct_username

GUICreate("NPOS",280,200)

GuiCtrlCreateGroup("Username/Password", 20, 10, 240, 170)

GuiCtrlCreateLabel("Username:", 30, 65)

$username = GUICtrlCreateInput("", 85, 63, 100)

$correct_username = GUICtrlRead($username)

GuiCtrlCreateLabel("Password:", 30, 95)

$password = GUICtrlCreateInput("", 85, 93, 100)

$correct_password = GUICtrlRead($password)

GUICtrlCreateGroup ("",-99,-99,1,1)

$okbutton = GuiCtrlCreateButton ("OK",50,140,70,20)

$cancelbutton = GuiCtrlCreateButton ("Cancel",150,140,70,20)

GuiSetState()

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton

ExitLoop

Case $msg = $okbutton

ExitLoop

EndSelect

WEnd

GUIDelete()

MsgBox(0,$correct_password,$corrected_username)

Share this post


Link to post
Share on other sites



You are doing a GUIRead before anybody had the chance to type the information.

Just do the GUIRead after OK is clicked..


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

Share this post


Link to post
Share on other sites

I get 0, and 0.....any ideas?

#include <GuiConstants.au3>

Dim $username

Dim $password

Dim $correct_password

Dim $correct_username

GUICreate("NPOS",280,200)

GuiCtrlCreateGroup("Username/Password", 20, 10, 240, 170)

GuiCtrlCreateLabel("Username:", 30, 65)

$username = GUICtrlCreateInput("", 85, 63, 100)

GuiCtrlCreateLabel("Password:", 30, 95)

$password = GUICtrlCreateInput("", 85, 93, 100)

GUICtrlCreateGroup ("",-99,-99,1,1)

$okbutton = GuiCtrlCreateButton ("OK",50,140,70,20)

$cancelbutton = GuiCtrlCreateButton ("Cancel",150,140,70,20)

GuiSetState()

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton

ExitLoop

Case $msg = $okbutton

ExitLoop

EndSelect

WEnd

GUIDelete()

$correct_username = GUICtrlRead($username)

$correct_password = GUICtrlRead($password)

MsgBox(0,$correct_password,$correct_username)

Exit

Nevermind, I got it now. Thank you for your help.

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