Creating Stack via script help?

John Patten johnpatten at
Fri Nov 19 17:09:29 EST 2004

Hi All!

Does someone have an example of a recommended strategy for creating a stack from a standalone via a script?

I?m attempting to create a script, ?fishing through many of the similar questions in the archive.

I?ve been getting all kinds of strange results. I can get it to work, sort of,  but it seems to create multiple instances of the new stack at times.  And when I go into the Application Browser I see even more of my inept attempts at getting this to work.  Here?s what I?ve been trying to do:

On mouseDown
Ask file ?Save stack as:? --set path and filename for new stack
Put it into theNewStackname
Ask ?How many questions/cards??
Put it into x
Create stack theNewStackName with background ?quizTemplate?
Set the defaultstack to theNewStackName
Put 1 into y
 Repeat x
    Clone this card  
     Put y into cd fld ?TheCardNumber? --assuming that when you clone a card it becomes current card
     Add 1 to y
 End repeat
Put ?? into x
Put ?? iinto y
Put ?? into theNewStackname
End mousedown

At times it appears that I get two new stacks, can?t really explain because I?m unclear what?s happening. It will create the new stack, but then it doesn?t appear to have created the cards after the new stack has been created??? (Also probably because I've been going at creating the script via trial and error...lots of error :-)

Eventually, I would like to create the new stack from a standalone, so I?m also concerned that there will be other issues I need to be aware of when doing this from a standalone? True? If so, like what?

What I would like to happen, is a new stack is created via  a script with the name, as determined by the end user, and with the number of cards.  It doesn?t seem like it should be too difficult but I think I?m getting tripped up on naming the new stack, setting the defaultstack for cloning of the cards in the new stack, and then determining what settings need to be set for purging, or cleaning up after the new stack is created?

Anybody have an example?

Thank you!
John Patten
Tech Dept

More information about the Use-livecode mailing list