Jump to content

Problems with the Inputboxes


Recommended Posts

Hey everybody,

can someone tell me please what is wrong in my Code? When i click "F1" my Script send "5" instead of my $Name.

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

HotKeySet("{F1}", "_Name")
HotKeySet("{F2}", "_Age")

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 331, 186, 228, 135)
$Label1 = GUICtrlCreateLabel("Name", 0, 0, 42, 21, $SS_CENTERIMAGE)
$Label2 = GUICtrlCreateLabel("Age", 0, 24, 42, 21, $SS_CENTERIMAGE)
$Name = GUICtrlCreateInput("", 48, 0, 121, 21)
$Age = GUICtrlCreateInput("", 48, 24, 121, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Func _Name()
    Send ($Name)
EndFunc
Func _Age()
    Send ($Age)
EndFunc

 

Link to comment
Share on other sites

Use  GUICtrlRead

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

HotKeySet("{F1}", "_Name")
HotKeySet("{F2}", "_Age")

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 331, 186, 228, 135)
$Label1 = GUICtrlCreateLabel("Name", 0, 0, 42, 21, $SS_CENTERIMAGE)
$Label2 = GUICtrlCreateLabel("Age", 0, 24, 42, 21, $SS_CENTERIMAGE)
$Inp1 = GUICtrlCreateInput("", 48, 0, 121, 21)
$Inp2 = GUICtrlCreateInput("", 48, 24, 121, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
    Sleep(9)
WEnd

Func _Name()
$name = GUICtrlRead($Inp1)
    Send($name)
EndFunc   ;==>_Name
Func _Age()
    $Age = GUICtrlRead($Inp2)
    Send($Age)
EndFunc   ;==>_Age

 

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