Page 1 of 1

Save a Clone

Posted: Wed Nov 16, 2016 5:52 pm
by thehat
I would like to clone a stack from a standalone and then save it to the documents folder. So that I can save data.
I have tried this:

on mouseUp
local tFolderPath
local tStack

put SpecialFolderPath ("documents") into tFolderPath
Clone this stack
set the name of stack "Copy of New Test" to "New Testt1"
set the filename of stack "New Test1" to tFolderPath
put "New Test1" into tStack
save stack "New Test1"
Put tFolderPath &"/New Test1.livecode" into fld "GoGet" of Stack "Opener"
Answer tFolderPath &"/New Test1.livecode"
end mouseUp

This renames the clone but does not save the clone to the Documents folder.
Thanks in advance for your help!

Re: Save a Clone

Posted: Wed Nov 16, 2016 5:58 pm
by dunbarx
Hi.

When you saved the stack, you did not say where. How would it know?

Check the dictionary for the syntax: "save stack [as filePath]"

Craig

Re: Save a Clone

Posted: Wed Nov 16, 2016 6:16 pm
by Klaus
You only provide the FOLDER where to save in the filename!
...
set the name of stack "Copy of New Test" to "New Testt1"

## tFolderPath only contains the FOLDER as its name suggests!
## set the filename of stack "New Test1" to tFolderPath
set the filename of stack "New Test1" to (tFolderPath & "/New Test1.livecode")
put "New Test1" into tStack
save stack "New Test1"
...

Re: Save a Clone

Posted: Thu Nov 17, 2016 8:01 am
by thehat
Thank you both for the help!