Sign in to follow this  
Followers 0
HelpThisNewbie

Need help making a Function to repeat sending 2 keys a set number of times

5 posts in this topic

Hey, I'm new at this and tried searching, but really clueless. I need to make a function that sends Ctrl + x 100 times everytime I press the F9 key. Any help is appreciated, thanks.

Share this post


Link to post
Share on other sites



Here is an example:

HotKeySet("{F9}","_Spam")

While 1
    Sleep(100)
WEnd

Func _Spam()
    Send("^{x 100}")
EndFunc

Out of curiosity. What in earth is this script good for?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

OK, won't let me edit my original post, but I also want the script to run until I press another button, F7.

Just an easier way to cheat in a game, lol. Saves me some time :idea:

Damn that was a fast reply, thanks.

Edited by HelpThisNewbie

Share this post


Link to post
Share on other sites

Ok you should be able to do so if you take the previous script as an example:

HotKeySet("{F9}","_Spam") ;this makes F9 run the function _Spam
;set a hotkey here to run function _Exit

While 1 ;this just lets the script do nothing untill a hotkey is pressed. Leave it as is.
    Sleep(100)
WEnd

Func _Spam() ;this is the function that runs when F9 is pressed. use the example to create a function called _Exit
    Send("^{x 100}") ;this is what the function does. Your new function should execute the command "Exit"
EndFunc

Share this post


Link to post
Share on other sites

Look in the guide for:

_IsPressed and ExitLoop

This may be of help in your problem with the F7 key toggle.

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