Page 1 of 1

copy paste stack

Posted: Tue Aug 27, 2013 3:31 pm
by pascalh4
Hi
I'm back.

When I copy and paste a stack, a new stack "'copy of stack" is created.
To change the name, this code works perfectly.
copy
paste

set name of the stack "copy of aa" to "bb"

or

go to stack "copy of aa"
set name of this stack to "bb"
But if I replace stack "name" by this stack, the first stack is always renamed and not the copy.


How is it possible to rename the copy without using his name?

Pascal

Re: copy paste stack

Posted: Tue Aug 27, 2013 3:38 pm
by FourthWorld
With most commands in LC that create new objects, the local variable "it" will contain a reference to the newly-created object - try this in the Message Box:

Code: Select all

copy this stack; paste; put it
FWIW, while copy and paste will work, it will overwrite the user's clipboard, requiring you to store and restore the clipboard contents or your user may lose data.

LC includes a "clone" command as a way of copying objects without altering the clipboard - see its Dictionary entry for details.

Re: copy paste stack

Posted: Tue Aug 27, 2013 3:40 pm
by Klaus
Hi Pascal,
pascalh4 wrote:How is it possible to rename the copy without using his name?
Use "clone stack xyz" instead of "copy/paste" and then do this:
...
clone stack "aa"
## "clone" will put the long ID of the new object/card/stack into the variable IT
set the name of IT to "bb"
...

Best

Klaus

Re: copy paste stack

Posted: Tue Aug 27, 2013 5:06 pm
by pascalh4
hi,
thank you both, that's exactly what I wanted.
Pascal