best way to open a script-only library stack?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

best way to open a script-only library stack?

Stephen MacLean via use-livecode
I'm just getting started with the idea of a library stack for scripts,
and have a dopey question: what's the best way to edit the library as I
work on the project?

I've created a script-only stack and included

start using stack "myScriptStack.livecodescript"

in the preOpenStack handler of my main stack.

When I open the main stack, I don't see a way to get to the library
stack. So I open the library stack through 'recent files' in Livecode,
but then I see the message "A stack [library stack name] in file [path
to the main stack file] is already in memory. The LiveCode UI does not
distinguish stacks which have identical names, so editing these stack
files while both are in memory could result in data loss."

If this is a real concern, how do I get back to work on the library
stack? Any suggestions on best practices?

Curt

Sent from Postbox
<https://www.postbox-inc.com/?utm_source=email&utm_medium=siglink&utm_campaign=reach>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: best way to open a script-only library stack?

Stephen MacLean via use-livecode
On 9/17/18 12:49 PM, Curtis Ford via use-livecode wrote:

> I'm just getting started with the idea of a library stack for scripts,
> and have a dopey question: what's the best way to edit the library as I
> work on the project?
>
> I've created a script-only stack and included
>
> start using stack "myScriptStack.livecodescript"
>
> in the preOpenStack handler of my main stack.
>
> When I open the main stack, I don't see a way to get to the library
> stack. So I open the library stack through 'recent files' in Livecode,
> but then I see the message "A stack [library stack name] in file [path
> to the main stack file] is already in memory. The LiveCode UI does not
> distinguish stacks which have identical names, so editing these stack
> files while both are in memory could result in data loss."
>
> If this is a real concern, how do I get back to work on the library
> stack? Any suggestions on best practices?

When you start using a script-only stack, LC creates a temporary hidden
stack in RAM and assigns the script to it. It's there but not visible.
If you try to open it again as a file, you get a conflict because the
stack in RAM has no filename per se, so the engine sees it as a duplicate.

The stack should be listed in the Application Browser and probably the
Project Browser (I didn't look) so you should be able to edit its script
from there. But what I usually do is look in the "Stacks In Use" pane
(last icon in the row) of the message box, where you can just click the
blue rectangle to open the script.

Saving the script will rewrite it to the text file.

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: best way to open a script-only library stack?

Stephen MacLean via use-livecode
In reply to this post by Stephen MacLean via use-livecode
Curtis Ford wrote:

 > I'm just getting started with the idea of a library stack for scripts,
 > and have a dopey question: what's the best way to edit the library as
 > I work on the project?
 >
 > I've created a script-only stack and included
 >
 > start using stack "myScriptStack.livecodescript"
 >
 > in the preOpenStack handler of my main stack.
 >
 > When I open the main stack, I don't see a way to get to the library
 > stack. So I open the library stack through 'recent files' in Livecode,
 > but then I see the message "A stack [library stack name] in file [path
 > to the main stack file] is already in memory. The LiveCode UI does not
 > distinguish stacks which have identical names, so editing these stack
 > files while both are in memory could result in data loss."
 >
 > If this is a real concern, how do I get back to work on the library
 > stack? Any suggestions on best practices?

There is only one thing to know about script-only stacks:  they are just
like the binary stacks in every respect, except that the only thing that
is written to disk is the stack script.

While in memory it has all the properties of any stack in memory.  You
can even add objects to it.  Add a hundred cards if you like, and a
thousand custom props too.  Set its backcolor.  It's all good, as long
as you know the one rule about script-only stacks: the only thing that
will get written to disk is the script.

Once this one rule is accepted, so many things become clearer.
Mysteries that seemed somehow specific to script-only stacks go away.
Many lights come on, many doors open.


The error you experienced can happen with any stack file.  Replace your
script-only stack with a binary one and you'll see.  Sometimes opening a
stack depends on *how* you opened it, with a partial or a full path, or
how the path was derived.

For example, here are two ways to describe one file path:

   /home/rg/Desktop/stack.livecode
   ~/Desktop/stack.livecode

If I use each of those in separate statements, LC will complain that I'm
attempting to open two different stacks with the same name, despite both
paths being for the exact same file.

I had reported that once, but can't find the report now. :(

But what I learned stays with me:  double-check that you're using the
exact same path to the file both times you access it, when using it as a
library and when opening it.

If you do and the problem persists, let's explore it further.

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: best way to open a script-only library stack?

Stephen MacLean via use-livecode
On 9/17/18 8:45 PM, Richard Gaskin via use-livecode wrote:
> While in memory it has all the properties of any stack in memory.

I just checked, and script-only stacks do have filenames. I didn't
realize that before, I'd assumed they were temporary only. Good info.

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: best way to open a script-only library stack?

Stephen MacLean via use-livecode
I work on all my SOS's with a text editor instead of in the LC script
editor.  If you're using Atom or Sublime Text you can generate "projects"
which are just pointers to a folder.  Then on the left panel there will be
a quick-click list of SOS's to edit for that project.  If you use Sublime,
you can do what Trevor is doing with Levure projects, and have it send a
message to LC to have it reload the stack when you save it.
I think the easiest way to get at them from inside LC is through the PB.

On Tue, Sep 18, 2018 at 1:17 AM J. Landman Gay via use-livecode <
[hidden email]> wrote:

> On 9/17/18 8:45 PM, Richard Gaskin via use-livecode wrote:
> > While in memory it has all the properties of any stack in memory.
>
> I just checked, and script-only stacks do have filenames. I didn't
> realize that before, I'd assumed they were temporary only. Good info.
>
> --
> Jacqueline Landman Gay         |     [hidden email]
> HyperActive Software           |     http://www.hyperactivesw.com
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


--
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode