Sign in to follow this  
Followers 0
MattLight

Help please, Im new to this

8 posts in this topic

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



Hi welcome to the forum. Take a look at HotKeySet in the help file. It might be what you are looking for.

Share this post


Link to post
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 :(

Share this post


Link to post
Share on other sites

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

#6 ·  Posted (edited)

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
1 person likes this

Share this post


Link to post
Share on other sites

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

1 person likes this

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