Jump to content

Auto space bar program (pls help)


Recommended Posts

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.

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

  • Moderators

@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.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

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.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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...