storing a stack as a customprop
Peter Brigham MD
pmbrig at gmail.com
Sat Oct 17 19:59:46 EDT 2009
I'm stuck. I swear I got this to work for a few minutes and now it
isn't working. I changed something and broke it.
I'm trying to store a stack ("stackToSave") as a customproperty of a
stack called "updateList". As far as I can tell the way to store a
currently open stack in a property is to first save it to disk and use
something like
set the storedStack of stack "updateList" to URL "file:" & filepath
First question: is this the way to approach this task?
If so, then a few more details: the stack "stackToSave" is a substack
of a stack "myMainStack" currently open in the IDE (all of this is
taking place in the IDE). The stack "updateList" is not part of the
same stackfile. I'm thinking I have to clone the stack "stackToSave"
first so I can save it independently. Second question: is this true?
I have a script in the stack "updateList" that calls a handler
"storeStack":
...
put "stackToSave" into stName
storeStack stName
...
on storeStack s
clone invisible stack s
-- when I do a clone stack s (without the invisible)
-- I can see the cloned stack open fine and it's
-- listed in the Application Browser as
-- "Copy of stackToSave"
put the filename of stack "myMainStack" into filePath
set the itemdelimiter to "/"
put s & ".rev" into item -1 of filePath
put "Copy of" && s into sName
save stack sName as filePath
-- breakpoint
-- when I break here and look in the Finder I see
-- that the stack is indeed saved successfully
put url "file:" & filePath into stackData
set the storedstack[s] of stack "updateList" to stackData
save stack "updateList"
delete file filePath
close stack sName
end storeStack
However, the result of this is that the contents of the property <the
storedStack["stackToSave"] of stack "updateList"> is simply the
filepath of the saved cloned stack. Clearly I'm not actually getting
the stack itself into the property.
I'm using a custompropertyset because I will eventually be storing
several stacks at a time in the updateList stack.
Is there some wrinkle here I don't get? I'm using a MacBook, OSX
10.5.8, Rev Studio 3.5.0-gm-2, build 870.
-- Peter
Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig
More information about the use-livecode
mailing list