Jump to content

Recommended Posts

Posted

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
  • Moderators
Posted

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.

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.

  • Moderators
Posted

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

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.

Posted

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...