Save a Clone

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
thehat
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 31
Joined: Mon Apr 16, 2007 5:32 am
Contact:

Save a Clone

Post by thehat » Wed Nov 16, 2016 5:52 pm

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!

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Save a Clone

Post by dunbarx » Wed Nov 16, 2016 5:58 pm

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

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Save a Clone

Post by Klaus » Wed Nov 16, 2016 6:16 pm

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"
...

thehat
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 31
Joined: Mon Apr 16, 2007 5:32 am
Contact:

Re: Save a Clone

Post by thehat » Thu Nov 17, 2016 8:01 am

Thank you both for the help!

Post Reply