Welcome! Log In Create A New Profile

Advanced

WD-24 Break a While not/End loop.

Posted by AadG 
WD-24 Break a While not/End loop.
July 18, 2020 12:45PM
Hello to you all,

I have a While not/end loop and I want to have the possibility to interrupt that loop.
Tried with "IF KeyPressed(kpEscape) THEN Info("Loop stopped.");BREAK"

Does not seem to work. Anybody with a better idea ?

Thanks for any assistance.

Best regards,

Aad
Al
Re: WD-24 Break a While not/End loop.
July 18, 2020 12:58PM
Hello Aad

It's been awhile since I have done it but from memory, the Multitask() function allow for the activty that is running to suspend for a micro second and nominated intervals and while the activity is suspended it will accept a keystroke. You might have to play with it to get it going or someone might have an example.

Regards
Al
Re: WD-24 Break a While not/End loop.
July 19, 2020 12:32PM
Hi Al,

Did some experimenting, but can not get it to work.
Thanks voor your help.

Best regards,

Aad
Re: WD-24 Break a While not/End loop.
July 19, 2020 01:30PM
Hey Aad

Show us your code...
Re: WD-24 Break a While not/End loop.
July 19, 2020 05:50PM
Hi Jan,

I have no real code. It's just a standaard loop.
I want to make a ReIndex-module for several hundreds of files.
Was wondering if there's a way to interrupt that loop, because
it takes quite some time to finish.

Hreadfirst(File,Index)
While not h.Out(File)
IF KeyPressed(kpEscape) THEN Info("Loop stopped.");BREAK
Hreadnext(File)
End
Re: WD-24 Break a While not/End loop.
July 19, 2020 06:42PM
Works pretty well here the way Al described with Multitask(-1) and a progress window with a cancel button

OpenChild (WindowProgress)
LOOP
MultiTask(-1)
IF WindowProgress.bCancelPressed
BREAK
END

-- your reindex here

END

Close(WindowProgress)

Arie
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: