Jump to content
jeremyroberts

Auto space bar program (pls help)

Recommended Posts

jeremyroberts

so i have been trying to make an a program which:

presses the space-bar every 22 miliseconds, i can do that But its really annoying when i change pages on crome, i have to stop the script then start it again.

while true
Send("{SPACE}")
sleep(25)
WEnd

now i want to just set F1 so it starts to press space every 22miliseconds then when i press it again (it can be F2 to stop) it will pause the script, and if i press it again it will start again and so on.... I cant do that can someone help, please im a noob.

Share this post


Link to post
Share on other sites
david1337

Hi jeremyroberts

With this you can use F1 to pause and unpause :)

 

Global $Paused
HotKeySet("{F1}", "TogglePause")


While 1

Send("{SPACE}")
sleep(25)

WEnd


While 1
    Sleep(100)
WEnd
;;;;;;;;

Func TogglePause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip("")
EndFunc

 

  • Like 1

Share this post


Link to post
Share on other sites
JLogan3o13

@jeremyroberts what is the end goal with pressing the spacebar so often? Sending keys is always going to be a little unreliable; there is more than likely a much better way to accomplish what you are after.

  • Like 1

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
jeremyroberts

lol i just wanted to show my friends something, I found out about this lanuage the other day and its awesome

Share this post


Link to post
Share on other sites
JLogan3o13

It is awesome, I will agree with you there. But spamming a button pointlessly on the keyboard leads many to think you're either working at automating a game or trying to create a "joke" or "spoof" script - both of which are against our forum rules (I am sure you've take the time to read them, so it goes without saying that was not your intent).

If you are interested in showing your friends something that showcases the power of AutoIt, I suggest you look through our Examples forum. There are many scripts here that, in just a few lines, can show you and your friends what the language is capable of.


√-1 2^3 ∑ π, and it was delicious!

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

×

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.