Jump to content
Sign in to follow this  
Arienda

Spam Button On Key Down

Recommended Posts

Arienda

I'm trying to write a program to spam a designated key when i hold down a key. The current program i have words but it has more of a toggle feature.

What could i do to only spam 1 when i hold down the ` key and stop spamming when i let go of the ` key. I also made it where if i didn't target the right window it sends they key normally.

Opt('SendKeyDownDelay', 50)
HotKeySet("{end}","stop")

Global $sendKey, $rand

HotKeySet("{`}", "spamthebutton")

While 1
    Sleep(100)
WEnd

Func spamthebutton()
    $sendKey = NOT $sendKey
    
    if WinActive("World of Warcraft") then
        While $sendKey
            $rand=Random(200,500)
            sleep($rand)
            Send("1")
        WEnd
    Else
        Send("`")
    EndIf

EndFunc

func stop()
    Exit
endfunc

Share this post


Link to post
Share on other sites
picea892

I think you may need to change to the _ispressed function in order to accomplish that task. Look it up in the help

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.