Can a script preempt substack name conflicts?

dfepstein at comcast.net dfepstein at comcast.net
Fri May 15 17:21:25 EDT 2015


Thanks for this prudent advice.  The case I am contemplating would involve a user creating new substacks to hold content.  While I can make sure each substack created by my program gets a unique name, if a file created on one machine is moved to another machine there is some chance of a conflict (reduced but not absolutely eliminated if I went to great lengths, like embedding in each substack's name "the ticks" at creation time). 
I think I can work around this IF the "substack name conflict problem" is only a problem for the LiveCode UI.  In other words if in my own scripts I am careful always to refer to a substack by its long name, am I safe even if two substacks have the same short name? 
  
David Epstein 
  
-- 



On 5/14/2015 8:16 PM, David Epstein wrote: 
> With stack A already open, I open stack B and get a alert like this: 
> 
> "A stack "<substackName>" in file <fileName of stack A> is already in > memory.  The Revolution UI does not distinguish stacks which have 
> identical names, so editing these stack files while both are in 
> memory could result in data loss.” 
> 
> Is it possible by script to intercept the message that generates this 
> alert, and rename either the substack that is already in memory or 
> the substack of the stack I am trying to open, so as to avoid both 
> the alert and the risk of data loss?  My impression is that if I try 
> to learn the substack names of a file I will already be loading that 
> file into memory, and it will be too late to head off the alert. 

I don't think it's worth it to try and hack the IDE to get around the 
warning. You won't lose any data unless you make changes to one of the 
duplicate stacks and then try to save it. So what I usually do is note 
the name of the problem stack and quit LC. Then I restart, open the 
stack I want to change, and temporarily alter its name in the property 
inspector. I don't save it. 

Then open the second stack, do whatever work is necessary, and then 
close and remove it from memory. After that you can change the name of 
the original stack back to what it was again. 

When I know in advance I'm going to open duplicate-named stacks, I just 
change the first stack temporarily before opening the second one. It 
saves time. 

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com 
HyperActive Software           |     http://www.hyperactivesw.com 





More information about the use-livecode mailing list