Jump to content

Help please, Im new to this


 Share

Recommended Posts

Hi I'm trying to make a script its when I press the number -Not on numberpad- "1" key it will spam the letter "w" or any letter i set to it... The scipt I made is this: >_<

Func main()

While 1

If _IsPressed("49") Then; 49 = 1

Send("w")

EndFunc

EndIf

WEnd

I'm trying to keep it as simple as possible, Thanks for the help ahead of time!

Link to comment
Share on other sites

I still dont understand, I tried looking at it, and im not trying to make a hotkey for it, I want it to be when I hold down 1 it will spam the letter W, sorry I ment it that way. I guess I made it seem like I wanted to make a hotkey. Still didnt figure it out though :(

Link to comment
Share on other sites

I didn't test it, sorry it's my fault.

Here's further corrections to the code:

#include <Misc.au3>

main()

Func main()
    While 1
        If _IsPressed("31") Then; 31 = 1
            Send("{BackSpace}") ; Delete the number 1
            Send("w")
        EndIf
        Sleep(100) ; Allow time for the key to be released
    WEnd
EndFunc

But Hotkey will do the same thing:

HotKeySet("1", "MySendFunc")

While 1
    Sleep(10)
WEnd

Func MySendFunc()
    Send("w")
EndFunc
Edited by czardas
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...