Changing a stack script on the fly and other stuff

Ken Ray kray at sonsothunder.com
Sun Aug 21 12:29:06 EDT 2005


On 8/21/05 9:09 AM, "Jason Vickers" <jvickers2002 at hotmail.com> wrote:

> In order to prevent future saving to this stack, I want to comment out the "on
> closeStack" portion of the stack script.

Well, you're going to run into problems with changing scripts at runtime -
there are script limits (10 lines I believe) that you can change from a
standalone, so that's not going to work for you most likely.

Better approach would be to set a custom property in the stack that
identifies whether it can be saved or not. For example, you could set the
"uCantSave" of a stack to "true" to prevent the ability of saving the stack
my modifying the closeStack handler as follows:

on closeStack
  put the short name of this stack into sName
  if sName <> "mc" and (the uCantSave of this stack is not "true") then
    answer "Do you want to save this stack?" with "yes" or "no"
    if it is "yes" then
       save this stack as stack "myStack"
       set the uCantSave of stack "myStack" to true
       save stack "myStack"  -- make the property change permanent
    end if
  end if
end closeStack

HTH,

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





More information about the use-livecode mailing list