Making a Standalone's Material Savable.

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
trailboss
Posts: 112
Joined: Sat Dec 13, 2008 4:55 pm

Making a Standalone's Material Savable.

Post by trailboss » Thu Nov 15, 2012 11:54 pm

I'm not a beginner at all but this is so basic that I thought I'd ask here. I've completely forgotten how to make my changes in a standalone SAVABLE.

I'm making a little flash card program for language students. They will put in their words and save them.

The standalone settings have to allow this.

What did I use to do?

Thank you very kindly, for refreshing my memory.

Tom in Arizona

trailboss
Posts: 112
Joined: Sat Dec 13, 2008 4:55 pm

Re: Making a Standalone's Material Savable.

Post by trailboss » Fri Nov 16, 2012 12:35 am

I'm posting a reply to my own question. I just looked; it's not in the standalone settings.

I put this is the stack script:

on closestack
answer "Save Changes?" with "Yes" or "No"
if it is "yes" then save stack "datastack"
end closestack

Never mind!

Thanks anyway,

Tom

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5142
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Making a Standalone's Material Savable.

Post by Mark » Fri Nov 16, 2012 1:04 am

Hi Tom,

You can't save changes in a standalone. You need to save your data in a file outside your standalone. This file can also be a stack. Good places to save such files are the preferences folder or application data folder, the documents folder, and sometimes the home folder or application support folder. These folders are not always available on every operating system.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

trailboss
Posts: 112
Joined: Sat Dec 13, 2008 4:55 pm

Re: Making a Standalone's Material Savable.

Post by trailboss » Fri Nov 16, 2012 3:44 am

You're right. I've discovered that it doesn't work after all. I thought it did.

I'm not sure what to do. I have a stack where you do your work and a data stack that has the data. How can I make that data stack a file that can be saved? The idea is for people to write in material to be studied later and added to.

Thanks for helping me.

Tom

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1682
Joined: Sat Feb 28, 2009 11:49 pm

Re: Making a Standalone's Material Savable.

Post by sturgis » Fri Nov 16, 2012 4:05 am

A couple ways. You can set the mainstack of your data stack to point to itself and save it as a separate stack file, then load it from your standalone stack. (you can add files to the build in the standalone settings, forget the exact name of the tab but it's pretty obvious. Select the stack you want to add to the build and it will be included and placed in the .app package on mac, or next to the exe on win/linux, or in the apk for android. I assume for ios is the same (inside the package) but haven't built for ios so not sure.

If you're building for a mobile device you'll need to copy the stack file from the engine folder into the documents folder so that it is writable.


You can also change a setting in the standalone settings that will "save substacks as separate stack files.." but I forget where that checkbox is.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6518
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Making a Standalone's Material Savable.

Post by dunbarx » Fri Nov 16, 2012 5:25 am

This is an issue because no OS will allow an executable to save to itself.

I use the "splash screen" approach, whereby a mostly functionless mainstack is used as the executable, and any number of other stacks are added to it as ancillary files. The splash screen is sort of the front end, and the working stack(s) can then be used in the ordinary way, and you can save as needed. These ancillary stacks are added in the standalone settings. You can also add other files, (e.g ".bundle") as required.

Craig Newman

trailboss
Posts: 112
Joined: Sat Dec 13, 2008 4:55 pm

Re: Making a Standalone's Material Savable.

Post by trailboss » Fri Nov 16, 2012 4:47 pm

Yes, now I see how I used to do this. I used a splash screen and a datastack. Thanks. It's working now!

Klaus
Posts: 11561
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Making a Standalone's Material Savable.

Post by Klaus » Fri Nov 16, 2012 5:07 pm

Hi friends,

please keep in mind that this will only work, if the current user has admin rights!
Other users do NOT have permissions to write (= save a stack) in the current OS
"Application" or "Programms" folder!


Best

Klaus

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1682
Joined: Sat Feb 28, 2009 11:49 pm

Re: Making a Standalone's Material Savable.

Post by sturgis » Fri Nov 16, 2012 6:57 pm

yeah, better to treat desktop as if they were mobile also and make a copy in appdata or documents folder and use it from there.
Klaus wrote:Hi friends,

please keep in mind that this will only work, if the current user has admin rights!
Other users do NOT have permissions to write (= save a stack) in the current OS
"Application" or "Programms" folder!


Best

Klaus

trailboss
Posts: 112
Joined: Sat Dec 13, 2008 4:55 pm

Re: Making a Standalone's Material Savable.

Post by trailboss » Fri Nov 16, 2012 8:30 pm

I don't understand. It seems to work for me on both mac and windows platform standalones. How will I come to grief?
Tom

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1682
Joined: Sat Feb 28, 2009 11:49 pm

Re: Making a Standalone's Material Savable.

Post by sturgis » Fri Nov 16, 2012 9:05 pm

If the standalone package (or on windows/linux, the standalone and any other files and folders) are placed into the applications folder, program files folder, or one of the binary paths on linux, a regular user may not be able to write to those directories without elevating privilege. Of course on desktop, if the files are in user space then its not really an issue.

trailboss
Posts: 112
Joined: Sat Dec 13, 2008 4:55 pm

Re: Making a Standalone's Material Savable.

Post by trailboss » Fri Nov 16, 2012 11:10 pm

Well, this is for friends, so I can tell them that. Thanks

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”