Here's another twist on this. The Message Box has the ability to create "global variables" - click the 4th icon from the left in the toolbar at the top left of the message bar.
If you define a global variable with a name that starts with a $ sign, it seems to be available from any script without declaring it, thus making it truly global. It also shows up in the Variables tab of the script editor window. If you want a variable that is truly global without having to declare it everywhere, this seems to offer that option. You'd have to find a way to create such variables by script rather than through the message box though - maybe they are created as OS environment variables with a shell command, like the other $ variables? Pete Molly's Revenge <http://www.mollysrevenge.com> On Sun, Jul 10, 2011 at 9:30 AM, Mark Wieder <mwie...@ahsoftware.net> wrote: > Slava- > > Sunday, July 10, 2011, 7:46:21 AM, you wrote: > > > handler was forwarding the openCard message which in turn reinitialized > the > > globals, and thus the new value got lost. My only excuse is that it was 3 > AM > > on a Sunday. > > And this is exactly why I think the use of global variables is a Bad > Idea. Global variables can be set from anywhere, and trying to track > down what happened and why your code isn't working the way you expect > it to is a real pain. I think I can count the number of times I've had > to resort to global variables on the fingers of one hand. I don't > think 3AM Sunday is the issue - it's not particularly anything you did > wrong, it's just that the nature of global variables encourages these > problem scenarios. > > -- > -Mark Wieder > mwie...@ahsoftware.net > > > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > > _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode