Sign in to follow this  
Followers 0
Ravage

Changing Keys

4 posts in this topic

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 is

While 1

If _ispressed("41") then

Send("{BS}")

Send("4")

Endif

Wend

It 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 :))

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 is

It 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 by frostfel

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by Nahuel

Share this post


Link to post
Share on other sites

Thanks for all the help :)

Works now

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
Sign in to follow this  
Followers 0