Ryan Posted January 7, 2009 Posted January 7, 2009 Hey guys, im trying to learn this program, and the help guide is helping me, But im stuck at this point. I want this script to send keystrokes every 3 seconds when a # is selected with the GUI. i cant figure out how to get the $data to send key strokes. #include <GuiConstantsEx.au3> Opt('MustDeclareVars', 1) _Main() Func _Main() Local $Label_1, $Combo_2, $button1, $msg, $data GUICreate("Key Selector", 191, 157, (@DesktopWidth - 191) / 2, (@DesktopHeight - 157) / 2) $Label_1 = GUICtrlCreateLabel("Select Button", 30, 40, 131, 21, 0x1000) $Combo_2 = GUICtrlCreateCombo("", 30, 60, 130, 21) GUICtrlSetData($Combo_2, "1|2|3|4|5|6|7|8|9|0") $button1 = GUICtrlCreateButton("Set Button", 30, 90, 130, 20) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $button1 $data = GUICtrlRead($Combo_2) GUICtrlSetData($Label_1, $data) EndSelect WEnd Exit EndFunc
7h331337 Posted January 7, 2009 Posted January 7, 2009 hi this one will send what ever is in the label but insted of # i used tab but it works all i added was the key function at the bottom expandcollapse popup#include <GuiConstantsEx.au3> #include <misc.au3> Opt('MustDeclareVars', 1) Global $key,$Label_1, $combo_2, $button1, $msg, $data _Main() Func _Main() GUICreate("Key Selector", 191, 157, (@DesktopWidth - 191) / 2, (@DesktopHeight - 157) / 2) $Label_1 = GUICtrlCreateLabel("Select Button", 30, 40, 131, 21, 0x1000) $combo_2 = GUICtrlCreateCombo("", 30, 60, 130, 21) GUICtrlSetData($combo_2, "1|2|3|4|5|6|7|8|9|0") $button1 = GUICtrlCreateButton("Set Button", 30, 90, 130, 20) GUISetState() While 1 key() $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $button1 $data = GUICtrlRead($combo_2) GUICtrlSetData($Label_1, $data) EndSelect WEnd Exit EndFunc ;==>_Main Func key() $key = _IsPressed("09") If WinActive("Key Selector") = True And $key = True Then While 1 Send(GUICtrlRead($label_1)) Sleep(3000) WEnd EndIf EndFunc ;==>key
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now