opening stacks from variables
Rodney Tamblyn
rodneytamblyn at paradise.net.nz
Sun Jan 5 17:03:01 EST 2003
Further to a recent thread on the list, I've been experimenting with
opening stacks from variables. One issue is how you refer to the stack
after it has been opened.
Does anyone know of any issues with opening stacks from variables when
compared to the conventional method of opening from a file? Seems to
work fine.
--
-- Script example
-- Binary read a stack file and create 4 example stack windows from the
data
--
on mouseUp
local tFile,tData,tStacks,x
#read a stack in (binary)
answer file "Select a stack file" with filter "MSTK"
put it into tFile
open file tFile for binary read
read from file tFile until eof
put it into tData
close file tFile
#note stack windows open. There's no way to determine what the name
of the stack
#being opened is so must compare against this list.
put openStacks() into tStacks
open stack (tData)
#find out it's name
repeat for each line x in openStacks()
if lineOffset(x,tStacks) = 0 then
put x into tStackName
exit repeat
end if
end repeat
#rename stack
set the name of stack tStackName to "Example 1"
#open a few more...
repeat with x = 2 to 4
open stack (tData)
set the name of stack tStackName to "Example "&x
end repeat
end mouseUp
--
Rodney Tamblyn
44 Melville St
Dunedin, New Zealand
+64 3 4778606
http://rodney.weblogs.com
More information about the metacard
mailing list