Jump to content

Recommended Posts

Posted

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?

Posted

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

Posted

And there's also the wait-for-user pause:

msgBox(0x40048, "Paused", "Press OK to continue.")
Posted

or if you don't want it paused completely, You can do this.

$Pause = TimerInit()

Do
   Sleep(50)
Until TimerDiff($Pause) = 5000

That Pauses for 5 seconds as well.

Posted

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)
  • 2 weeks later...
Posted

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

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...