Page 1 of 2

Saving as LiveCodeScript

Posted: Sun Apr 21, 2024 9:46 am
by richmond62
saveAS.png
-
While I understand it is comparatively straightforward to write a script-only stack in a text editor . . .

. . . I wonder if there is a way to convert a stack into a script-only stack.

It is entirely possible, also, to edit a script-only stack using a text editor (I know, I have done that):

but one of the difficulties about that is if one wants the script-only stack to generate a full stack that is visible to end-users with graphic elements.

Re: Saving as LiveCodeScript

Posted: Sun Apr 21, 2024 11:04 am
by Klaus
In LC 9.6.11 (and probably in versions below) we have a menuitem for that.
Bildschirmfoto 2024-04-21 um 12.00.34.png
However a "script-only" stack is exactly what the name says, so this:
but one of the difficulties about that is if one wants the script-only stack to generate a full stack that is visible to end-users with graphic elements.
is not possible with a "script-only" stack.
Get it? SCRIPT ONLY! :D :D :D

Re: Saving as LiveCodeScript

Posted: Sun Apr 21, 2024 11:37 am
by richmond62
is not possible with a "script-only" stack.
The menuBar.livecodescript script-only stack generates the LC menuBar.

Re: Saving as LiveCodeScript

Posted: Sun Apr 21, 2024 12:02 pm
by Klaus
Yes, sorry, looks like I misunderstood your question.

Well, a script-only stack can of course create another stack with lots of controls, if that is what you mean.

Re: Saving as LiveCodeScript

Posted: Sun Apr 21, 2024 1:07 pm
by richmond62
That is part of what I meant.

But, just as a script-only stack can create another stack with lots of controls, I want to know if one can reverse the process where a "stack with lots of controls" can be saved as a script-only stack in such a fashion that on that script-only stack being opened inwith the IDE it can re-create that "stack with lots of controls".

Re: Saving as LiveCodeScript

Posted: Sun Apr 21, 2024 1:13 pm
by Klaus
I don't think this is possible this way.
The only way seem to save the actual stack script as a script-only stack

Re: Saving as LiveCodeScript

Posted: Sun Apr 21, 2024 1:32 pm
by dunbarx
Richmond.

How could a stack that contains even a single control ever be reduced to a script-only stack? What would we do with that control?

Craig

Re: Saving as LiveCodeScript

Posted: Sun Apr 21, 2024 1:36 pm
by dunbarx
I am not sure that even a control-less stack can be "reduced" to being script-only. Such a stack has properties, for example its rect, that a script only stack does not, and aren't there conservation laws such as:
"rects can neither be created not destroyed"?
Craig

Re: Saving as LiveCodeScript

Posted: Sun Apr 21, 2024 4:14 pm
by FourthWorld
richmond62 wrote:
Sun Apr 21, 2024 1:07 pm
That is part of what I meant.

But, just as a script-only stack can create another stack with lots of controls, I want to know if one can reverse the process where a "stack with lots of controls" can be saved as a script-only stack in such a fashion that on that script-only stack being opened inwith the IDE it can re-create that "stack with lots of controls".
What benefit are you looking for with that? We can come up with a solution once we know the goal.

Re: Saving as LiveCodeScript

Posted: Sun Apr 21, 2024 6:25 pm
by richmond62
Many years ago I wrote a stack to modify the revMenBar stack on the fly to make it horizontal, vertical, black, blue and sky-blue-pink.

The revMenuBar is generated from a script-only stack: I should like to have a way where end-users of the LC IDE can modify the appearance of the revMenuBar so that those modifications will stick between LC sessions.

Re: Saving as LiveCodeScript

Posted: Sun Apr 21, 2024 6:50 pm
by jacque
richmond62 wrote:
Sun Apr 21, 2024 1:07 pm
But, just as a script-only stack can create another stack with lots of controls, I want to know if one can reverse the process where a "stack with lots of controls" can be saved as a script-only stack in such a fashion that on that script-only stack being opened inwith the IDE it can re-create that "stack with lots of controls".
I'm not sure why you want a script-only stack instead of a regular one. Script-only stacks are just text files. However you could probably script the creation of controls when the stack loads but that seems like way more work than just using a normal stack.

Why are you thinking a script-only stack is preferable?

Edit: I see you answered while I was writing a response.

Re: Saving as LiveCodeScript

Posted: Sun Apr 21, 2024 8:40 pm
by FourthWorld
richmond62 wrote:
Sun Apr 21, 2024 6:25 pm
Many years ago I wrote a stack to modify the revMenBar stack on the fly to make it horizontal, vertical, black, blue and sky-blue-pink.

The revMenuBar is generated from a script-only stack: I should like to have a way where end-users of the LC IDE can modify the appearance of the revMenuBar so that those modifications will stick between LC sessions.
Modify the revMenubar file directly. But upgrades will overwrite your changes. Modifying IDE stuff is an ongoing treadmill.

Simpler to do as suggested in these forums years ago: write a plug-in that makes the mods to the revMenubar stack after it's been instantiated.

Re: Saving as LiveCodeScript

Posted: Sun Apr 21, 2024 9:00 pm
by richmond62
that makes the mods to the revMenubar stack after it's been instantiated
That is exactly what I am trying to avoid,

Re: Saving as LiveCodeScript

Posted: Sun Apr 21, 2024 9:35 pm
by FourthWorld
richmond62 wrote:
Sun Apr 21, 2024 9:00 pm
that makes the mods to the revMenubar stack after it's been instantiated
That is exactly what I am trying to avoid,
Why?

Re: Saving as LiveCodeScript

Posted: Mon Apr 22, 2024 6:06 am
by richmond62
Portativity.