Jump to content

How to pause a script?


Kaze
 Share

Recommended Posts

I need a way to pause and unpause a simple script like this:

HotKeySet("{PAUSE}", "EndScript")
While 1
ControlSend ("MyProcess", "", "", "{2}")
Sleep(Int(Random(75,105)))
WEnd

; End
Func EndScript()
Exit
EndFunc

by using hotkeys.

J and/or H would be prefereable.

Thank you, i actually have NO idea!

Edited by Kaze
Link to comment
Share on other sites

maybe

Global $Paused
HotKeySet("j", "TogglePause")
HotKeySet("{PAUSE}", "EndScript")

While 1
    ControlSend("MyProcess", "", "", "{2}")
    Sleep(Int(Random(75, 105)))
WEnd

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


Func EndScript()
    Exit
EndFunc  ;==>EndScript

PAUSE WAS STRAIGHT FROM HELP

8)

welcome to the forums....

Maybe take a look at "Welcome to Autoit 1-2-3" in my signature below

its a great place to start

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

@ Valuater arent u missing a { in the hot key ?

Global $Paused

HotKeySet("J}", "TogglePause")

Func TogglePause()

$Paused = NOT $Paused

While $Paused

sleep(100)

ToolTip('Script is "Paused"',0,0)

WEnd

ToolTip("")

EndFunc

My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! you’re the best in town Fight!
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...