Ravage Posted September 21, 2007 Share Posted September 21, 2007 I've read the help file alot and I was wondering if it's possible to change the keys (example: When you press a it types What I've tried isWhile 1If _ispressed("41") thenSend("{BS}")Send("4")EndifWendIt changes the A into a 4.Now my question is, can I activate that commend when I press a command button in my GUI and can I disable it? (So when I click the disable button it sends a when I type a..)My searching didn't get me far, and if it's possible can you tell me how.Thanks in advance.(An easier way to change the keys is also fine ) Link to comment Share on other sites More sharing options...
frostfel Posted September 21, 2007 Share Posted September 21, 2007 (edited) I've read the help file alot and I was wondering if it's possible to change the keys (example: When you press a it types What I've tried isIt changes the A into a 4.Now my question is, can I activate that commend when I press a command button in my GUI and can I disable it? (So when I click the disable button it sends a when I type a..)My searching didn't get me far, and if it's possible can you tell me how.Thanks in advance.(An easier way to change the keys is also fine )Hope this helps#include <GUIConstants.au3> #Include <Misc.au3> $KeyChange = 1 $Form2 = GUICreate("Form2", 109, 68, 711, 209) $Button1 = GUICtrlCreateButton("Enable", 12, 4, 87, 29, 0) $Button2 = GUICtrlCreateButton("Disable", 12, 34, 87, 29, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $KeyChange = 1 Case $Button2 $KeyChange = 0 EndSwitch If $KeyChange = 1 Then If _ispressed("41") Then Send("{BS}") Send("4") Endif EndIf WEnd Edited September 21, 2007 by frostfel Link to comment Share on other sites More sharing options...
Nahuel Posted September 21, 2007 Share Posted September 21, 2007 (edited) ^ beaten to it But here's mine with only one button: #include <GUiconstants.au3> Opt("GuiOnEventMode",1) Global $enableFUN GUICreate("test") GUISetOnEvent($GUI_EVENT_CLOSE,"_exit") $enable=GUICtrlCreateButton("Enable/Disable",50,150,150) GUICtrlSetOnEvent(-1,"enable_disable") GUISetState() While 1 Sleep(10) WEnd Func _4() Send("4") EndFunc Func enable_disable() $enableFUN=not $enableFUN If $enableFUN Then HotKeySet("a","_4") MsgBox(0,"","Enabled") Else HotKeySet("a") MsgBox(0,"","Disabled") EndIf EndFunc Func _exit() Exit EndFunc Edited September 21, 2007 by Nahuel Link to comment Share on other sites More sharing options...
Ravage Posted September 21, 2007 Author Share Posted September 21, 2007 Thanks for all the help Works now Link to comment Share on other sites More sharing options...
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