File Scanning Problem
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 344
- Joined: Tue Feb 24, 2009 6:14 pm
- Contact:
File Scanning Problem
I made a program that does a scan of all the files in the computer... my problem is, i made a cancel button that supposedly cancels the scanning or stop it while it's currently running but somehow, i can't do that as the program (my program) just hangs up and the cancel button can't be clicked because my program is too busy with the scanning process... please help me out on how i can make my cancel button clickable in a manner that it can be clicked even if the program is too busy with the scanning process...
Hi Shadowslash,
You need to use send instead of a repeat loop, i.e. you need to learn how to write recursive functions. Here's a simple example.
You need a stack with two buttons and a field. Call the field "Simple Time Field".
Put the following into the script of the first button.
Put the following at card or stack level.
and put the following into the script of button 2:
Now, you should see the time appear in the field and being refreshed until you click the second button. The first button will beep if you click on it a second time, because you don't want to run this script in two different cycles next to each other --it would claim too much processing power eventually.
Exercise for the reader: make this with only one button
Best,
Mark
You need to use send instead of a repeat loop, i.e. you need to learn how to write recursive functions. Here's a simple example.
You need a stack with two buttons and a field. Call the field "Simple Time Field".
Put the following into the script of the first button.
Code: Select all
--button 1
global gGoOn
on mouseUp
if gGoOn is not true then
put true into gGoOn
send "foo" to me
else beep
end mouseUp
Code: Select all
-- card or stack script
global gGoOn
on foo
if gGoOn is true then
put the long time into fld "Simple Time Field"
send "foo" to me in 200 millisecs
end if
end foo
Code: Select all
-- another button
global gGoOn
on mouseUp
put false into gGoOn
end mouseUp
Exercise for the reader: make this with only one button

Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- Posts: 344
- Joined: Tue Feb 24, 2009 6:14 pm
- Contact:
um... i used the sample included with revolution (i think in the resource center) and i modified it a bit so that it checks each file if it matches any query in my virus database... (123 items currently) it uses the progress bar.. i still haven't tried the code yet but i'll get to it as soon as i finish my friggin Research Paper due monday.. man! it's tough dividing time with school and programming T_T