Script only Stacks
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Script only Stacks
Good Afternoon All
I am currently trying to get to grips with Script Only Stacks and I have a couple of questions:
1) Is there a tutorial anywhere that will walk me through how to create the script only stacks through to including them in a standalone application?
2) how do I include the script only stacks in a standalone application?
Many Thanks
I am currently trying to get to grips with Script Only Stacks and I have a couple of questions:
1) Is there a tutorial anywhere that will walk me through how to create the script only stacks through to including them in a standalone application?
2) how do I include the script only stacks in a standalone application?
Many Thanks
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Script only Stacks
Hi hrcap,
I never used script only stack but i found a doc about it.
https://livecode.com/script-only-stacks/
Best regards
Jean-Marc
I never used script only stack but i found a doc about it.
https://livecode.com/script-only-stacks/
Best regards
Jean-Marc
https://alternatic.ch
Re: Script only Stacks
Hi Jean Marc
Thanks for the reply, I had already seen this one but unfortunately it doesn’t go into enough detail.
Thanks for taking the time to reply much appreciated
Thanks for the reply, I had already seen this one but unfortunately it doesn’t go into enough detail.
Thanks for taking the time to reply much appreciated
Re: Script only Stacks
Heya hrcap,
Trevor posted this a while back, might be helpful to you. My take on it (much like Mark W. said in Jean-Marc's post) is that the main benefit to it is version control, since it is just a plain text file.
It looks like replacing libraries or objects with behaviors would be the next best use for them. As far as deploying them goes, I'd just copy the files into the standalone builder, and save them out when your stack runs *if* your stack doesn't find them already there (alternately, you could just save them out every time and delete them when done).
Trevor posted this a while back, might be helpful to you. My take on it (much like Mark W. said in Jean-Marc's post) is that the main benefit to it is version control, since it is just a plain text file.
It looks like replacing libraries or objects with behaviors would be the next best use for them. As far as deploying them goes, I'd just copy the files into the standalone builder, and save them out when your stack runs *if* your stack doesn't find them already there (alternately, you could just save them out every time and delete them when done).
Re: Script only Stacks
Hi All
Thanks for the reply so far.
I have two elements to my test scenario:
a) a stack with a button on with the following script:
on mouseup
open stack (specialFolderPath ("resources") & "/test.livecodescript")
end mouseup
b) a 'script only stack' titled: 'test.livecodescript' containing the script
script "hello world"
on openstack
answer "hello world"
Close me
end openstack
When creating the standalone for an iOS device I have two questions:
1) do I include the script only stack within the 'Copy Files' tab of the standalone application settings?
2) if so what adjustments do I need to make to the button scrip mentioned in a) above in order to use that script only stack
open stack (specialFolderPath ("resources") & "/test.livecodescript")
Many thanks
Hadleigh
Thanks for the reply so far.
I have two elements to my test scenario:
a) a stack with a button on with the following script:
on mouseup
open stack (specialFolderPath ("resources") & "/test.livecodescript")
end mouseup
b) a 'script only stack' titled: 'test.livecodescript' containing the script
script "hello world"
on openstack
answer "hello world"
Close me
end openstack
When creating the standalone for an iOS device I have two questions:
1) do I include the script only stack within the 'Copy Files' tab of the standalone application settings?
2) if so what adjustments do I need to make to the button scrip mentioned in a) above in order to use that script only stack
open stack (specialFolderPath ("resources") & "/test.livecodescript")
Many thanks
Hadleigh
Re: Script only Stacks
Hm, maybe no one knows (but I'm sure that isn't true, so *bump*)
-
- VIP Livecode Opensource Backer
- Posts: 7215
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Script only Stacks
1} Yes, script only stacks go into the Copy Files pane.
2) Script only stacks are no different from regular stacks with the exception that they only contain a stack script. Treat them exactly like a library stack. When your app launches, start using the stack. That will insert its script into the message hierarchy similar to a backscript.
Since your script only stack triggers on openstack, you'll want to start using it before that, or change the trigger to something later in the message hierarchy. Or use a "send in time" command to trigger it after startup is fully complete.
2) Script only stacks are no different from regular stacks with the exception that they only contain a stack script. Treat them exactly like a library stack. When your app launches, start using the stack. That will insert its script into the message hierarchy similar to a backscript.
Since your script only stack triggers on openstack, you'll want to start using it before that, or change the trigger to something later in the message hierarchy. Or use a "send in time" command to trigger it after startup is fully complete.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Script only Stacks
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: Script only Stacks
Ok All
Thank you so much for the input so far, I am starting to get there, one problem that I have is...:
- When I first open the main stack I have the following code to start using the script only stack
- The code on the script only stack is as follows:
- When the first stack is opened it immediately displays "helloworld"
can I change the 'on Openstack' part within the script only stack to something else to stop this from happening when the main stack is first opened?
Thank you so much for the input so far, I am starting to get there, one problem that I have is...:
- When I first open the main stack I have the following code to start using the script only stack
Code: Select all
start using stack(specialFolderPath ( desktop ) & "/test.livecodescript") //this is a remote script
- The code on the script only stack is as follows:
Code: Select all
script "test"
On openstack
Answer "helloworld"
End openstack
- When the first stack is opened it immediately displays "helloworld"
can I change the 'on Openstack' part within the script only stack to something else to stop this from happening when the main stack is first opened?
Re: Script only Stacks
Do yourself a favour and get used to use QUOTES around ANY string:hrcap wrote: ↑Wed Apr 24, 2019 6:48 pmCode: Select all
start using stack(specialFolderPath ( desktop ) & "/test.livecodescript") //this is a remote script
Code: Select all
start using stack(specialFolderPath("desktop") & "/test.livecodescript")
Yes, and that is correct behavior,right!hrcap wrote: ↑Wed Apr 24, 2019 6:48 pm- When the first stack is opened it immediately displays "helloworld"Code: Select all
script "test" On openstack Answer "helloworld" End openstack
Why don't you just try?
If you are too scared, yes this is of course possible.
Hint:
If you put that script-only stack into the same folder as your stack, the you can use this in the IDE AND in your standalone::
Code: Select all
start using stack(specialFolderPath ("resources") & "/test.livecodescript")
Re: Script only Stacks
Hi Klaus
Thank you very much.
I will be sure to start using "" around all strings.
The problem that I was having was that "hello world" was displaying straight away and I didn't want it to display until I clicked a button.
On further investigation this was because on prestackopen of the main stack I was using the wording
I changed this to
This has stopped the "hello world" message displaying at the initial stack open and it now only displays when a button is used to call the script only stack (the desired behaviour).
I have added this script only stack example incase it of use to anyone.
Many Thanks for everyones help.
Thank you very much.
I will be sure to start using "" around all strings.
The problem that I was having was that "hello world" was displaying straight away and I didn't want it to display until I clicked a button.
On further investigation this was because on prestackopen of the main stack I was using the wording
Code: Select all
start using stack (and then the path of the script only stack)
Code: Select all
start using (and then the path of the script only stack)
This has stopped the "hello world" message displaying at the initial stack open and it now only displays when a button is used to call the script only stack (the desired behaviour).
I have added this script only stack example incase it of use to anyone.
Many Thanks for everyones help.
- Attachments
-
- Script only stack example.zip
- (2.7 KiB) Downloaded 206 times
Re: Script only Stacks
Problem is you scripted "on openstack" (start using is like GO stack!), but leaving out "stack" while "start using" that file is really puzzling me and I consider this a bug!
However you should have named your script like "on helloworld" which makes more sense:
Know what I mean?
However you should have named your script like "on helloworld" which makes more sense:
Code: Select all
script "test"
On helloworld
Answer "helloworld"
End helloworld
Re: Script only Stacks
Your example stack will work right "out of the box" if you use my proposed specialfolderpath() code!
No need to move the script only stack anywhere else!
Code: Select all
on preopenstack
start using (specialFolderPath("resources") & "/test_script_only_stack.livecodescript")
end preopenstack
Re: Script only Stacks
excellent thank you, I have modified the script only stack here:
- Attachments
-
- Script only stack example.zip
- (3.85 KiB) Downloaded 215 times
Re: Script only Stacks
When the stack is built into a standalone application, is the resources folder protected? i.e could the user potentially access the resources folder and modify a script only stack?