Jump to content

Recommended Posts

Posted

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

 

Posted

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.

 

Posted

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)

Posted

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

 

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