Sign in to follow this  
Followers 0
houseonfire

STopping a loop while its runnning

10 posts in this topic

I have a loop that I need to run until the a ($stop) button is pressed. But if i use

if $stop then ExitLoop

Then it just ends the loop when that command is hit.

Can someone help me out please?

Share this post


Link to post
Share on other sites



I have a loop that I need to run until the a ($stop) button is pressed. But if i use

if $stop then ExitLoop

Then it just ends the loop when that command is hit.

Can someone help me out please?

do a hotKeySet at the start of your script. should look something like this:

HotKeySet( "{ESC}" , "Terminate")

Func Terminate ()

Exit 0

EndFunc

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hmm..

Thanks for your guys' help.

I cant get the Dim to work..

Dim $stop = False

...

...

If $stop1 = True Then Exitloop

That seems to just make the loop stop when it hits the "If $stop1 = True Then Exitloop".

Thanks tgarr for the suggestion, but I considered this and I didn't like the idea of the hotkeys. Thanks though.

Edited by houseonfire

Share this post


Link to post
Share on other sites

Exit loop does work, It just exits the loop when it hits the string that tells it to, and not when I click the button.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Add

MsgBox(0,"",$stop)
right before the if statement to verify that $stop is really false at that point.

It might also be an issue with it being a string "True". Try switching it to:

If $stop = "True" Then Exitloop
Edited by Prab

Share this post


Link to post
Share on other sites

The MSGbox pops up the number 10..

Share this post


Link to post
Share on other sites

The MSGbox pops up the number 10..

do

until $stop = 1

While $stop <> 1

wend


[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]

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