Cannot stop a running process with a Stop button.
Posted: Wed Feb 03, 2010 3:47 pm
Hi,
I have a small program. There is a button used to run something for quite a long time, about 15 minutes. There is a stop button that can used to stop the process if the user want to quit it. Here's the scripts of the two buttons:
Run Button's script
Please help to fix the problem.
P.S. This is really strange that I used this method about two years ago and it worked!
Thanks and best regards
I have a small program. There is a button used to run something for quite a long time, about 15 minutes. There is a stop button that can used to stop the process if the user want to quit it. Here's the scripts of the two buttons:
Run Button's script
Stop Button's scriptglobal check_server
on mouseUp
put true into check_server
GetServer
end mouseUp
on GetServer
Repeat with i = 1 to the num of lines of field "testing"
if check_server = false then exit GetServer
//...... do something here
wait 2 seconds
end repeat
end GetServer
However when the Run button is pressed, the stop button seems to be "inactivated". When try to press the stop button, nothing happens until the running is finished (i.e. 15 minutes later).global check_server
on mouseUp
repeat for each line whichMessage in the pendingMessages
if "GetServer" is in whichMessage then cancel item 1 of whichMessage
end repeat
put false into check_server
## notify user
put "Shutting down......." into fld "Alert"
end mouseUp
Please help to fix the problem.
P.S. This is really strange that I used this method about two years ago and it worked!
Thanks and best regards