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!
I am successfully using multiple script only stacks read in by a main stack. My problem at the moment is encrypting the SOS's in standalone. This is something I still have to work out. If this is of interest to you, then please see this thread:
on mouseup
if the optionkey is down then
FromPath
else
ExplicitFromFile
end if
putmilliseconds
end mouseup
on FromPath
start using stack "/Users/robertcailliau/Desktop/pms.livecodescript"
end FromPath
on ExplicitFromFile
create script only stack "pms"
open file "/Users/robertcailliau/Desktop/pms.livecodescript" for "utf-8" text read
read from file "/Users/robertcailliau/Desktop/pms.livecodescript" until EOF
set the script of stack "pms" to it
start using stack "pms"
end ExplicitFromFile
The ExplicitFromFile handler works fine, but the FromPath one gives the error.
start using stack "/Users/robertcailliau/Desktop/pms.txt"
the first line (script "pms") is removed from the loaded stack script, but when it's read explicity that line is not removed (in fact that's as expected) but it also does not give an error either.
Thanks everyone, have a nice locked-down day if you're in a locked-down situation (I am).
Just wondering, Robert, whether or not you had come across this article, it seems to answer your observation:
https://livecode.com/script-only-stacks/ wrote:
In a nutshell, a script only stack is a text file, structured in a specific way, which the engine can load and save as if it were a normal stackfile. When the engine loads a script only stack, it creates a stack with the name specified in text file and sets the stacks script property to the script specified in the text file. When the engine saves a script only stack it reverses this process, writing out a text file containing the stack name and stack script and absolutely nothing else.
A little further down, you will see what Thierry mentioned...
The fact that script only stack files really are just text files is really important! It means you can edit and create them in any text editor you choose, and use any text based processing tool on them (the key thing for git is that you can diff and patch them)! The only thing to remember is that the very first line in the text file has to be of the form:
script "<name>"
With every line after the first being taken as the stack script.
Hello.
I got my test version of the script only stack (see the attachment).
It works.
What I don't understand is why every time I try to save the "TestSOStack" stack or the "TestScript", be it in the project browser or directly in the stack, the Openstack of the TestScript starts running. It runs also when opening for the first time the inspector of the "TestScript" stack.
Is this a bug?
One more thing: I am not sure of how I arranged the opening order of things. I did my best, considering how little informations there is about it, but I may have done some confusion, in preopestack, openstack, in the card, in the stack, front, back, sideways...
When you save a stack, LC actually creates a new copy and deletes the old one. When the new one runs it's like you just opened it and all normal messages are sent. You can try locking messages before saving, or just type "save stack TestSOStack" in the message box.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com