Sign in to follow this  
Followers 0
eekhoorn12

Help on a script

4 posts in this topic

Why does this script return 3

#include <GUIConstants.au3>

GUICreate ( "title" , 800 , 600 ) ; will create a dialog box that when displayed is centered
$RESULT = GUICtrlCreateInput("", 110, 40, 100, 20)

$Start = GUICtrlCreateButton ("OK",  60, 70, 50)
GUICtrlSetState(-1,$GUI_DEFBUTTON)
GUISetState (@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Select
        Case $MSG = $GUI_EVENT_CLOSE
            Exit

        Case $msg = $Start
            MsgBox(0, '', $RESULT)
    EndSelect
Wend

Share this post


Link to post
Share on other sites



It's showing you the control id, if you move the $start above the $result, you should get $result to return "4" as an example.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Example:

#include <GUIConstants.au3>

GUICreate ( "title" , 800 , 600 ); will create a dialog box that when displayed is centered
$Start = GUICtrlCreateButton ("OK",  60, 70, 50)
$RESULT = GUICtrlCreateInput("", 110, 40, 100, 20)

GUICtrlSetState(-1,$GUI_DEFBUTTON)
GUISetState (@SW_SHOW)

While 1
    $msg = GUIGetMsg()
       Select
           Case $MSG = $GUI_EVENT_CLOSE
            Exit

           Case $msg = $Start
               MsgBox(0, '', $RESULT)
       EndSelect
Wend

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

In case you're still wondering, to see the value of the input field you want to change your MsgBox() line to this:

MsgBox(0, '', GUICtrlRead($Result))

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