Jump to content

Use a hotkey to send the same key as the hotkey without triggering itself?


Recommended Posts

I'm trying to make a macro that will spam the 1 key as long as I'm holding it down (as in repeatedly press and release until I release the hotkey.) But what it does is do a loop of the hotkey triggering itself which does absolutely nothing. I'm wondering if there's a way to work around this somehow?

Another example is if I'm trying to make the hotkey "h" send the string "hello", if I do this it inputs 'ello' and triggers itself, which inputs 'ello' again and continues until I terminate it.

Here's the code I'm working with

Global $Paused
HotKeySet("{END}", "Terminate")
HotKeySet("1", "one")

While 1
WEnd

Func Terminate()
    Exit 0
EndFunc

Func one()
    While 1
        Send("1")
        sleep(2)
    WEnd
EndFunc

I'll try to be reasonable, I haven't worked with AutoIt much.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...