Jump to content
Sign in to follow this  
MattLight

Help please, Im new to this

Recommended Posts

MattLight

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!

Share this post


Link to post
Share on other sites
MattLight

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 :(

Share this post


Link to post
Share on other sites
MattLight

Yes I hold down 1 and it spams the letter W so it would do -Example- "wwwwwwwwwwwwwwwwwwwwwwwwwwww" And I'm new to autoit sorry, I honestly dont see whats wrong with it =/

Share this post


Link to post
Share on other sites
czardas

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
  • Like 1

Share this post


Link to post
Share on other sites
MattLight

Thank you so much! you were a big help :D Anyway you have a great christmas/Holiday Thanks again!

  • Like 1

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  

×