Jump to content

Pause in script?


Recommended Posts

Can anybody advise me of the best way to pause a script? I can't seem to fine anything in the help file or reference lists. I have used a counter and a loop that exits the loop after XX times. The more times that longer the pause. This doesn't seem right though. I thought about using the system clock but then the script will be dependant upon that functioning properly. What is the best way?

Link to comment
Share on other sites

Sleep(5000) ; Sleeps for 5 seconds


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

Just to elaborate on Knight's example: right now it's only equivalent to Sleep(5000) but its beauty lies in its ability to do things during that five seconds:

local $pause = timerInit()

do

    sleep(50)
    ; do some number crunching
    ; or perhaps search for some files

until (timerDiff($pause) = 5000)
Link to comment
Share on other sites

  • 2 weeks later...

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

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

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