Jump to content
Sign in to follow this  
Fabroni

Press button, delay and loop

Recommended Posts

I would like to make script to press space button, hold it for 5 seconds, release and delay 10 seconds and repeat this process until I stop script. It is great if anyone can help.

Thanks in advanced!

Share this post


Link to post
Share on other sites

Maybe...

; Press Esc to terminate script, Pause/Break to "pause"

Global $Paused, $Runner

HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("{F9}", "ShowMe")  

;;;; Body of program would go here ;;;;
While 1
    Sleep(100)
WEnd
;;;;;;;;

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

Func Terminate()
    Exit 0
EndFunc

Func ShowMe()
    $Runner = Not $Runner
    While $Runner
        ; To hold a key down (generally only useful for games)
        Send("{SPACE DOWN}")
        Sleep(5000) ; 5 seconds
        Send("{SPACE UP}")
        Sleep(10000) ; 10 seconds
    WEnd
EndFunc

8)

Share this post


Link to post
Share on other sites

Maybe...

; Press Esc to terminate script, Pause/Break to "pause"

Global $Paused, $Runner

HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("{F9}", "ShowMe")  

;;;; Body of program would go here ;;;;
While 1
    Sleep(100)
WEnd
;;;;;;;;

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

Func Terminate()
    Exit 0
EndFunc

Func ShowMe()
    $Runner = Not $Runner
    While $Runner
        ; To hold a key down (generally only useful for games)
        Send("{SPACE DOWN}")
        Sleep(5000) ; 5 seconds
        Send("{SPACE UP}")
        Sleep(10000) ; 10 seconds
    WEnd
EndFunc

8)

This is what I am looking for. Thanks man!! You are great!

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  

×
×
  • Create New...