abort scripts

Ken Ray kray at sonsothunder.com
Wed Jun 13 11:16:13 EDT 2007


On Wed, 13 Jun 2007 15:02:53 +0000, runrev260805 at m-r-d.de wrote:

> Hi,
> 
> i have some questions again.
> 
> How can i stop the execution of a script. e.g. I want to stop 
> executing a script, which is already started by mouseup event.

Type Command-period (Mac) or Control-period (Windows). 

> Another thing is: I have a very large mouseup script, I want to 
> destroy the stack, when a special condition takes place. But the 
> script continues. I have set "the destroystack property to true".
> Found out, that this behaviour is normal, because the "close" 
> statement is in the same event handler. But how can i solve this. Do 
> i have to send a message to another obejct, which contains the 
> "close" statement?

If you're trying to close and remove the stack that's current running 
the mouseUP script, you *should* be able to just say "close this stack" 
in the script of your mouseUp handler and it should work. However if it 
doesn't, send a custom command to the same object ("me") in a short 
time (like 100 milliseconds), and then immediate do an "exit to top", 
which will get you out of the mouseUp handler you're in. Something like 
this:

on mouseUp
  -- do a bunch of stuff
  -- if the condition is met (I'm imagining the 'tCondition' variable 
starts off
  -- false and when the condition is met it gets set to true
  if tCondition is true then
    send "closeMe" to me in 100 milliseconds
    exit to top
  end if
  -- more stuff that could happen if the condition wasn't met
end mouseUp

on closeMe
  close this stack
end closeMe

> I need to delete files in a folder. The names of the files vary. I 
> thought i could use wildcards to delete, but that doesn´t work. Do i 
> have to read the content of the folder, put this in a container/var 
> and then delete within a repeat loop? Or how can i do this?

Yes, that's the best way (switch the defaultFolder to the folder you 
want to delete files from, put "the files" into a variable, switch your 
defaultFolder back to where it was, then loop through the list of files 
in the variable identifying the one(s) you want to delete, then delete 
them).


Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/



More information about the use-livecode mailing list