Sign in to follow this  
Followers 0
Kaze

How to pause a script?

6 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

fixed...

actually i need to remove the right "}"

thanks

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

thanks, i already tried the "unfixed solution" and was kinda dissapointed so i opened this thread :o

thanks again!

Share this post


Link to post
Share on other sites

Welcome... and

Welcome to Autoit

Enjoy!!

8)


NEWHeader1.png

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