Solved!How to save a new stack from another stack with custom name?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 203
- Joined: Mon Oct 31, 2011 9:36 pm
- Location: Italy
- Contact:
Solved!How to save a new stack from another stack with custom name?
How to save a new stack from another stack with custom name?
thanks to everybody,
Lestroso
thanks to everybody,
Lestroso
Last edited by Fasasoftware on Tue Apr 10, 2018 9:09 pm, edited 3 times in total.
-
- Livecode Opensource Backer
- Posts: 9359
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: How to save a new stack from another stack with custom name?
Code: Select all
on mouseUp
ask "What is the name of your new stack?"
put it into IMENA
create stack IMENA
save stack IMENA
end mouseUp
-
- Livecode Opensource Backer
- Posts: 9359
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: How to save a new stack from another stack with custom name?
Improved code:
Thanks, bogs
Code: Select all
on mouseUp
ask "What is the name of your new stack?"
put it into IMENA
create stack IMENA
save stack IMENA as (IMENA & ".livecode")
end mouseUp
Re: How to save a new stack from another stack with custom name?
Thank YOU Richmond, I knew I forgot something! (The parenthesis )
-
- Posts: 203
- Joined: Mon Oct 31, 2011 9:36 pm
- Location: Italy
- Contact:
Re: How to save a new stack from another stack with custom name?
hi richmond62 and bogs,
your code for me works for a half....
it create the name and the stack itself...but your software don't save the new stack either in a directory where there's the first stack in this case stacker ....and no everywhere...
i need to save a new custom stack in a directory...not only in memory...but i think is Livecode fault.....
best regards...thank in any way..
Lestroso
your code for me works for a half....
it create the name and the stack itself...but your software don't save the new stack either in a directory where there's the first stack in this case stacker ....and no everywhere...
i need to save a new custom stack in a directory...not only in memory...but i think is Livecode fault.....
best regards...thank in any way..
Lestroso
-
- Posts: 203
- Joined: Mon Oct 31, 2011 9:36 pm
- Location: Italy
- Contact:
Re: How to save a new stack from another stack with custom name?
Dear friends,
i have tryed also to compile the richmond62 file example in to an app...for mac os x... but nothing works...the new stack appears , but the new stack is not saved on the disk....
Do i have done something wrong??
is it a mac os x issue??Only??a bug?? i have used 8.1.9 and 9.00 livecode community! for mac os x
Thank a lot again...best regards,
Lestroso
i have tryed also to compile the richmond62 file example in to an app...for mac os x... but nothing works...the new stack appears , but the new stack is not saved on the disk....
Do i have done something wrong??
is it a mac os x issue??Only??a bug?? i have used 8.1.9 and 9.00 livecode community! for mac os x
Thank a lot again...best regards,
Lestroso
-
- Livecode Opensource Backer
- Posts: 9359
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: How to save a new stack from another stack with custom name?
That may be because you are not permitted to make new, savable stacks in a standalone.i have tryed also to compile the richmond62 file example in to an app
Re: How to save a new stack from another stack with custom name?
Is this in the IDE?
Probably you are trying to write the file in the default folder which is (relative to the LC engine) in a write-protected loxation.
Try setting the default folder to a writeable location before the save.
Probably you are trying to write the file in the default folder which is (relative to the LC engine) in a write-protected loxation.
Try setting the default folder to a writeable location before the save.
Re: How to save a new stack from another stack with custom name?
Of course you need to supply a pathname/folder where you have write permissions to save the stack in!
You can only use this (NO pathname):
if you really KNOW what the current defaultfolder is and that you have write permission there!
In a standalone this will be probably the users "Applications" folder and we are NOT allowed to write there, unless the user is logged in as ADMIN!
And, as I mentioned in another thread, if something like this happens, check THE RESULT!
If in doubt, use -> specialfolderpath("documents")
You can only use this (NO pathname):
Code: Select all
...
save stack IMENA as (IMENA & ".livecode")
...
In a standalone this will be probably the users "Applications" folder and we are NOT allowed to write there, unless the user is logged in as ADMIN!
And, as I mentioned in another thread, if something like this happens, check THE RESULT!
If in doubt, use -> specialfolderpath("documents")
Code: Select all
...
save stack IMENA as (specialfolderpath("documents") & "/" & IMENA & ".livecode")
...
-
- VIP Livecode Opensource Backer
- Posts: 9648
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: How to save a new stack from another stack with custom name?
Try this experiment. There are just a few missing pieces.
Craig Newman
Code: Select all
on mouseUp
ask "What is the name of your new stack?"
put it into newStack
create stack newStack
answer folder "Select Folder" -- SELECT DESTINATION FOLDER FOR TESTING
save stack newStack as (it & "/" & newStack & ".livecode")
end mouseUp
-
- Posts: 203
- Joined: Mon Oct 31, 2011 9:36 pm
- Location: Italy
- Contact:
Re: How to save a new stack from another stack with custom name?
Dear Craig!!!! Thanks a lot MIllions!!!
THIS WORKS VERY FINE!!!!! either in Livecode IDE...either in a standalone app ...i tryed only for now in a mac os x platform!!! i hope will work also on windows10....i will change only the directory i think...
Thank a lot in every way to everybody for the support!!
Best regards,
Lestroso
THIS WORKS VERY FINE!!!!! either in Livecode IDE...either in a standalone app ...i tryed only for now in a mac os x platform!!! i hope will work also on windows10....i will change only the directory i think...
Thank a lot in every way to everybody for the support!!
Best regards,
Lestroso
Re: How to save a new stack from another stack with custom name?
Heya Lestroso, I'm sorry, I didn't bother putting in that you needed to specify a path with that example, based on how many programs I'd seen that you've authored, I assumed (theres that word again ) that you understood the default folder, and how to specify paths and such.Fasasoftware wrote: ↑Tue Apr 10, 2018 6:11 pmit create the name and the stack itself...but your software don't save the new stack either in a directory where there's the first stack in this case stacker ....and no everywhere...
i need to save a new custom stack in a directory...
Everyone above this post has laid it out for you, on a Mac, unlike windows or linux, you won't be able to write into an .app folder (I think I have that correctly). On all Os's, you have to have write permissions to save. For instance, I dev on Linux, the code I wrote uses the default (for the IDE) folder, which turns out to be the 'home' folder, on the other two Os's I believe it is equivalent to the 'Documents' folder.
You should be able to modify the path for saving the file using the specialFolderPath function. Alternately, you can build a path (relative, if your going to move this to different machines) to save the file anywhere you have write permissions.
I think in most cases, specialFolderPath("Documents" & "/whateverFolderYouMake") is the generic fall too.
Re: How to save a new stack from another stack with custom name?
Come on, Richmond, you can't be serious!?richmond62 wrote: ↑Tue Apr 10, 2018 6:54 pmThat may be because you are not permitted to make new, savable stacks in a standalone.i have tryed also to compile the richmond62 file example in to an app
-
- Posts: 203
- Joined: Mon Oct 31, 2011 9:36 pm
- Location: Italy
- Contact:
Re: Solved!How to save a new stack from another stack with custom name?
Hi, i have a little other problem.....
Can i clone a stack and rename it with a name i want with a modify of your script?
but this last don't work...can you help me??
best regards,
Lestroso
Can i clone a stack and rename it with a name i want with a modify of your script?
Code: Select all
on mouseUp
ask "What is the name of your new stack?"
put it into newStack
clone this stack --newStack
put newstack into title of the stack
answer folder "Select Folder" -- SELECT DESTINATION FOLDER FOR TESTING
save stack newStack as (it & "/" & newStack & ".livecode")
end mouseUp
best regards,
Lestroso
Re: How to save a new stack from another stack with custom name?
Why not take a look into the dictionary?
Code: Select all
...
ask "What is the name of your new stack?"
put it into newStack
clone this stack AS newStack
...