Backing up a stack; problems with save as
Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller
Re: Backing up a stack; problems with save as
Yes, that's what I wrote here about six days ago with a script how to do so... 
Re: Backing up a stack; problems with save as
Klaus.
I read your post, and understand that there is a big difference between saving a copy of a stack and saving a copy of a stack file.
The dictionary is correct when it says:
What I was on about was with the dictionary example If I make a new stack, save it with the name "XXX", then execute that line of code, nothing happens. Neither within LC nor anywhere else on my machine. So forget everything I wrote, and simply tell me what happens, anywhere, when I run that line of code.
Craig
Calm down, mon ami.Yes, that's what I wrote here about six days ago with a script how to do so...
I read your post, and understand that there is a big difference between saving a copy of a stack and saving a copy of a stack file.
The dictionary is correct when it says:
Code: Select all
"save stack [as filePath] [with {format stackFormat | newest format}]Code: Select all
save this stack as "Backup"Craig
Re: Backing up a stack; problems with save as
I'm the calm in person! 
I made a test, created a stack name "test1" and it was the way I had described on the previous page here:
I did not supply a full path, so I ended with the saved stack inside of the APP package*** and without a suffix, see screenshot.
*** Which is the defaultfolder right after LC starts up. P.S.
save this stack as "new name..."
will ONLY change the filename of the stack, not the (internal) name of the stack and will not add the suffix .livecode
As I also told you calmly before, if you don't supply a path for the stack, on a Mac you may find it in THE DEFAULTFOLDER.What I was on about was with the dictionary example
CODE: SELECT ALL
save this stack as "Backup"
If I make a new stack, save it with the name "XXX", then execute that line of code, nothing happens. Neither within LC nor anywhere else on my machine. So forget everything I wrote, and simply tell me what happens, anywhere, when I run that line of code.
I made a test, created a stack name "test1" and it was the way I had described on the previous page here:
Code: Select all
on mouseUp
save this stack as "test2"
end mouseUp*** Which is the defaultfolder right after LC starts up. P.S.
save this stack as "new name..."
will ONLY change the filename of the stack, not the (internal) name of the stack and will not add the suffix .livecode
-
jimlehrman
- Posts: 2
- Joined: Wed Jul 10, 2013 7:04 pm
Re: Backing up a stack; problems with save as
I've been working on this for a quite a while. I've used your suggestions and they've helped to an extent. But the bottom line is that it's not doing what I think the script should make it do. My goal was/is to automate a way to do what the Finder does when I duplicate a file from within the Finder, and either leave the name of the new file as the Finder does (eg: "Client Emails copy 12") or replace the words "copy 12" with a date stamp. (The former is good enough for me. I don't need a date stamp.) I don't want to have to go out of LiveCode and into the Finder to do that, though.
So I created a simple stack which I named "test for cloning". I gave it no stack script. I put one button on the stack and I gave that button this script:
on mouseUp
#### These first 3 lines are just for coming up with a time stamped name for the cloned stack
put the date into vdate
convert vdate to dateItems
put the short name of this stack && item 1 of vdate & "-" & item 2 of vdate & "-" & item 3 of vdate && the short time into vNameBUstack
clone this stack as vNameBUstack
put "Save cloned stack " & vNameBUstack & "?" into vtoSave
answer vtoSave with "cancel" or "yes"
if it is "yes" then save stack vNameBUstack as vNameBUstack
close stack vNameBUstack
end mouseUp
It works just the way I'd like with the MAJOR EXCEPTION THAT IT SAVES THE ORIGINAL STACK, NOT THE CLONED STACK. I put a line in towards the end of the script "put vNameBUstack" to get assurance that I'm telling it to save the cloned stack. But even with that reassurance, it only saves the original stack, as if all those lines of code simply perform the function "save this stack". It successfully clones the original stack, gives it the name I expected, but closes that cloned stack while saving only the original.
What am I doing wrong?
Thank you all for what you've given me that got me this far! Lots of trial and error. And thanks for any additional direction you can share.
Jimmy in San Diego and Colorado
So I created a simple stack which I named "test for cloning". I gave it no stack script. I put one button on the stack and I gave that button this script:
on mouseUp
#### These first 3 lines are just for coming up with a time stamped name for the cloned stack
put the date into vdate
convert vdate to dateItems
put the short name of this stack && item 1 of vdate & "-" & item 2 of vdate & "-" & item 3 of vdate && the short time into vNameBUstack
clone this stack as vNameBUstack
put "Save cloned stack " & vNameBUstack & "?" into vtoSave
answer vtoSave with "cancel" or "yes"
if it is "yes" then save stack vNameBUstack as vNameBUstack
close stack vNameBUstack
end mouseUp
It works just the way I'd like with the MAJOR EXCEPTION THAT IT SAVES THE ORIGINAL STACK, NOT THE CLONED STACK. I put a line in towards the end of the script "put vNameBUstack" to get assurance that I'm telling it to save the cloned stack. But even with that reassurance, it only saves the original stack, as if all those lines of code simply perform the function "save this stack". It successfully clones the original stack, gives it the name I expected, but closes that cloned stack while saving only the original.
What am I doing wrong?
Thank you all for what you've given me that got me this far! Lots of trial and error. And thanks for any additional direction you can share.
Jimmy in San Diego and Colorado
Re: Backing up a stack; problems with save as
Jimmy, are you using a Mac?
If yes, take a look at my last posting about "save as..." without supplying a full pathname.
If yes, take a look at my last posting about "save as..." without supplying a full pathname.
Re: Backing up a stack; problems with save as
Your script DEFINITIVELY works, but maybe not how you exspect.
I used a shorter version of your script in a stack named "test1":
I ended with a COPY of stack "test1" on my desktop and the original stack "test1" was NOT saved during this action.
So I suspect you are on a Mac, please take a look into your App package of "Create" (right-click on the app and select "Show contents...").
I'm sure you will find the missing copies in there.
I used a shorter version of your script in a stack named "test1":
Code: Select all
on mouseUp
lock screen
put "test2" into vNameBUstack
clone this stack as vNameBUstack
## I ALWAYS provide a full pathname, since the script will fail on a Mac standalone otherwise
## We have NO write permissions inside of the App package on other machines than our own!
save stack vNameBUstack as (specialfolderpath("desktop") & "/" & vNameBUstack & ".livecode")
close stack vNameBUstack
unlock screen
end mouseUpSo I suspect you are on a Mac, please take a look into your App package of "Create" (right-click on the app and select "Show contents...").
I'm sure you will find the missing copies in there.
