File Scanning Problem

Deploying to Windows? Utilizing VB Script execution? This is the place to ask Windows-specific questions.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
shadowslash
Posts: 344
Joined: Tue Feb 24, 2009 6:14 pm
Contact:

File Scanning Problem

Post by shadowslash » Thu Mar 19, 2009 6:30 am

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...
Parañaque, Philippines
Image
Image

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Thu Mar 19, 2009 9:29 am

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.

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
Put the following at card or stack level.

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
and put the following into the script of button 2:

Code: Select all

-- another button
global gGoOn
on mouseUp
  put false into gGoOn
end mouseUp
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
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

shadowslash
Posts: 344
Joined: Tue Feb 24, 2009 6:14 pm
Contact:

Post by shadowslash » Thu Mar 19, 2009 4:18 pm

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
Parañaque, Philippines
Image
Image

Post Reply