Jump to content
Misomaniac

Problems with the Inputboxes

Recommended Posts

Misomaniac

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

 

Share this post


Link to post
Share on other sites
Starf0x

Hi,

So if I look at the code, where do you want the name and age to appear?
If it is in the input boxes, (eitherway) you should use different variables for the function key send.

Cheers.

 

Share this post


Link to post
Share on other sites
Misomaniac

The Name and Age is just a example. I just want to save Words or Numbers with the help of  Inputboxes in a assigned Hotkey. The Text of the Variables should appear everywhere (Word,Exel,Paint,Facebook)

Share this post


Link to post
Share on other sites
JoHanatCent

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

 


Share this post


Link to post
Share on other sites
Misomaniac

Work. Thanks :)

Share this post


Link to post
Share on other sites
JoHanatCent

It's a pleasure


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

×