Jump to content

GUI Input Variable Problem


NSearch
 Share

Recommended Posts

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)

Link to comment
Share on other sites

  • Developers

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

Just do the GUIRead after OK is clicked..

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

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.

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