How can i save the workflow in stendalone application?

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: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
SEAL29
Posts: 63
Joined: Fri Oct 02, 2020 3:32 pm

How can i save the workflow in stendalone application?

Post by SEAL29 » Mon Nov 09, 2020 7:15 pm

I tried>

Code: Select all

save stack "Database" as "/Volumes/Data/Database.livecode"

Code: Select all

save this stack
does not work, does not save changes.

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

Re: How can i save the workflow in stendalone application?

Post by dunbarx » Mon Nov 09, 2020 7:18 pm

Hi.

You don't have the executable as the stack you are trying to change, right?

Craig

SEAL29
Posts: 63
Joined: Fri Oct 02, 2020 3:32 pm

Re: How can i save the workflow in stendalone application?

Post by SEAL29 » Mon Nov 09, 2020 7:24 pm

Database is the stendalone application name.
The Database.livecode is what I made of stendalone application.

SEAL29
Posts: 63
Joined: Fri Oct 02, 2020 3:32 pm

Re: How can i save the workflow in stendalone application?

Post by SEAL29 » Mon Nov 09, 2020 7:37 pm

What script can I use to save the workflow in stendalone application?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10048
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: How can i save the workflow in stendalone application?

Post by FourthWorld » Mon Nov 09, 2020 7:58 pm

The User Guide reminds us that OSes prevent an executable from modifying itself (p513), with guidance on saving stack files separately from the executable:
Note: A stack file directly attached to a standalone application cannot have changes saved
to it. This stack is bound directly to the executable file that runs. The OS locks an
executable file while it is running. If you want to save changes in your standalone
application, split your stack up until multiple files. A common technique is to create a
"splash screen" stack that contains a welcome screen and then loads the stacks that make
up the rest of your application. These stacks are referenced as stackFiles on this pane in
the standalone settings screen. It is thus possible to automatically update these
component stacks, or to save changes to them. You may also want to consider creating
preference files in the appropriate location on your end user's system (see the
specialFolderPath function and query/setRegistry functions for more information).
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: How can i save the workflow in stendalone application?

Post by dunbarx » Mon Nov 09, 2020 8:58 pm

Aha.

To make the User Guide simpler to understand, when you make your standalone, make the executable stack the frontStack. I believe you already do this.

There is a "Stacks" pane in the "Standalone Application Settings" in the "File" menu. Form there you attach one or more stacks to the executable stack. Then when you actually make the standalone, those "working" stacks can all be saved. You can also attach files in the "Copy Files" pane, and set your inclusions, which I recommend you do individually.

Craig

SEAL29
Posts: 63
Joined: Fri Oct 02, 2020 3:32 pm

Re: How can i save the workflow in stendalone application?

Post by SEAL29 » Tue Nov 10, 2020 4:45 pm

I don't understand this, i followed this description https://livecode.fandom.com/wiki/Standa ... n_Settings but i don't know how to save the changes. Why need a standalone application if you can't save in it?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10048
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: How can i save the workflow in stendalone application?

Post by FourthWorld » Tue Nov 10, 2020 5:29 pm

All operating systems prevent executables from modifying themselves.

So maybe the better question might be: how do applications save data?

We see that they save data to a variety of special folders, depending on what the data is, such prefs files, documents, and other application data.

LiveCode provides a function for getting the paths to the most commonly used folders, specialFolderPath. You can use that to clone your stack file on first launch, and open that for subsequent runs.

But you may also want to separate data from the user interface. This allows you to update the interface without altering the user's data.

There are many approaches possible, and the best one for your app will depend on the nature of your app. Can you tell us a bit about what it does?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

SEAL29
Posts: 63
Joined: Fri Oct 02, 2020 3:32 pm

Re: How can i save the workflow in stendalone application?

Post by SEAL29 » Tue Nov 10, 2020 5:49 pm

This is a database of my movies and tv series with pictures and some text fields like Title, cast, etc.

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

Re: How can i save the workflow in stendalone application?

Post by dunbarx » Tue Nov 10, 2020 8:36 pm

Create, name and save two new stacks. Stack 1 will be the "splash" stack, that is, the executable which you cannot modify. Stack 2 will be your "working" stack.

Put some sort of simple handler in a button on stack 2, for example one that puts a random number into a field. In the stack script of stack 2, put something like this:

Code: Select all

on closeStackRequest
      save this stack
      pass closeStackRequest
end closeStackRequest
You can easily automate navigation to Stack 2, for example in the stack 1 card script, perhaps:

Code: Select all

on preOpenCard
      get specialFolderPath("documents") & "/" & "yourWorkingStack" & ".livecode"
      go stack it
end preOpenCard

or simply:

on opencard
   go stack "yourWorkingStack"
  close stack "yourSplashStack"
end opencard
Save everything.

With Stack 1 in front, in the standalone settings "Stacks" pane, click the "Add Stack File..." button and attach the Stack 2 stack file. Now make the standalone. Run the standalone by placing a random number into the field, and remember it. Quit the standalone. now re-open the standalone. You will see the new number in the field.

Not tested, but the general ideas should be OK. The working stack can have subStacks, and there is no limit to the number of stack files you can attach to stack 1.

Craig

SEAL29
Posts: 63
Joined: Fri Oct 02, 2020 3:32 pm

Re: How can i save the workflow in stendalone application?

Post by SEAL29 » Tue Nov 10, 2020 9:24 pm

Thanks. Now work with "splash" stack. Thanks for description.

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

Re: How can i save the workflow in stendalone application?

Post by dunbarx » Tue Nov 10, 2020 11:12 pm

Make the experiment. Get it to work at the basic level. Then get fancy.

Craig

Post Reply