Jump to content
Sign in to follow this  
aoc153

Noob Needs Some Help

Recommended Posts

aoc153

Hey,

I'm making a program that requires a form to be filled out. I'm trying to make a GUI form that has an input box to put your name and a done button that will change the name variable in the code... but it isn't working correctly... here's what I have:

$varname = "xxx"

#include <GUIConstants.au3>
$Form1 = GUICreate("Set Name", 339, 305, 243, 118)
$Done = GUICtrlCreateButton("Done", 136, 152, 75, 25)
$Button2 = GUICtrlCreateButton("Close", 136, 208, 75, 25)
$Input1 = GUICtrlCreateInput("Name Here", 120, 88, 121, 21, -1, $WS_EX_CLIENTEDGE)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        Exitloop 
    Case $msg = $Done
    $varname = $input1
                Case $msg = $button2
                 exit
    Case Else
    ;;;;
    EndSelect
WEnd

; Test if the variable changed
Msgbox(0, "Test", $varname)

Anyone see whats wrong with this? The message box shows "5" no matter what I enter in the input box ><

Any Help is greatly appreciated :think:

Share this post


Link to post
Share on other sites
GaryFrost

$varname = "xxx"

#include <GUIConstants.au3>
$Form1 = GUICreate("Set Name", 339, 305, 243, 118)
$Done = GUICtrlCreateButton("Done", 136, 152, 75, 25)
$Button2 = GUICtrlCreateButton("Close", 136, 208, 75, 25)
$Input1 = GUICtrlCreateInput("Name Here", 120, 88, 121, 21, -1, $WS_EX_CLIENTEDGE)
GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Done
            $varname = GUICtrlRead($Input1)
        Case $msg = $Button2
            ExitLoop
        Case Else
        ;;;;
    EndSelect
WEnd

; Test if the variable changed
MsgBox(0, "Test", $varname)


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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.