Standalone not working with script only stack

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 539
Joined: Sun Dec 18, 2011 7:23 pm
Contact:

Standalone not working with script only stack

Post by kaveh1000 »

Hi folks. I am trying to put together a minimal stack to try out this excellent suggestion by Jacqueline to encrypt Script only Stacks (SoS's) on the fly:

http://lists.runrev.com/pipermail/use-l ... 58018.html

But I am falling at the first hurdle, before encryption. Please see attached minimal stack, consisting of a stack "Testing encryption", with stack script:

Code: Select all

on preopenstack
   put specialFolderPath("resources") into tLibraryPath
   put tLibraryPath & "/" & "ScriptOnlyStack.livecodescript" into tPath
   open stack tPath
   start using stack tPath
end preopenstack
and one button with script:

Code: Select all

on mouseup
   showtext
end mouseup
The script only stack has one handler:

Code: Select all

on showtext
   answer "Text coming from script-only stack"
end showtext
This works fine, showing that the SoS is being accessed. But when I create a standalone, the button does not work. I have added the SoS in the Copy files area of the Standalone Application settings.

Can someone tell me what elementary mistake I am making?

Kaveh
Attachments
testing_encryption.zip
(2.07 KiB) Downloaded 669 times
Kaveh
LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 870
Joined: Fri Feb 06, 2015 4:03 pm

Re: Standalone not working with script only stack

Post by LiveCode_Panos »

Hello Kaveh,

What happens in your example is that you have "Search for Inclusions", but the call

Code: Select all

answer "Text coming from script-only stack"
in in the script-only stack that is included in the Copy Files. The standalone builder only checks the main stack for possible inclusions - not the stacks included in the Copy Files. Since the main stack has no call to the "answer" command, it does not add the "Answer Dialog" inclusion to the standalone.

You have to choose "Select Inclusions" and check the "Answer Dialog".

Hope this helps.

Kind regards,
Panos
--
kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 539
Joined: Sun Dec 18, 2011 7:23 pm
Contact:

Re: Standalone not working with script only stack

Post by kaveh1000 »

Thank you so much Panos. I think it was not that obvious and I don't feel too silly. I would not have thought of that. Yup, it works. :-)

Kaveh
Kaveh
kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 539
Joined: Sun Dec 18, 2011 7:23 pm
Contact:

Re: Standalone not working with script only stack

Post by kaveh1000 »

OK, I now have a working minimal stack, using a Script-only stack. I have modified the stack script, according to Jacqueline's recipe, namely

Code: Select all

on preopenstack
   put specialFolderPath("resources") into tLibraryPath
   put tLibraryPath & "/" & "ScriptOnlyStack.livecodescript" into tPath
   open stack tPath
   start using stack tPath
end preopenstack

on standaloneSaved 
   set the scriptonly of stack "ScriptOnlyStack.livecodescript" to false
   set the mainstack of stack "ScriptOnlyStack.livecodescript" to "Testing encryption"
   set the password of stack "Testing encryption" to "hi"
end standaloneSaved
The Standalone is created, but I can still see the unencrypted SoS in the Package Contents in the mac version. Any ideas please?

Kaveh
Attachments
encryption.zip
(2.14 KiB) Downloaded 675 times
Kaveh
LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 870
Joined: Fri Feb 06, 2015 4:03 pm

Re: Standalone not working with script only stack

Post by LiveCode_Panos »

Hello Kaveh,

You probably have to do these changes (i.e. the encryption) in the "savingStandalone" handler, and revert them in the "standaloneSaved" handler.

The "savingStandalone" message is sent just before the standalone creation begins, and the "standaloneSaved" is sent when the standalone is ready.

Kind regards,
Panos
--
kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 539
Joined: Sun Dec 18, 2011 7:23 pm
Contact:

Re: Standalone not working with script only stack

Post by kaveh1000 »

Oops. Silly error. Let me try and report back. Thanks again Panos and great to see you on the forum. :-)
Kaveh
kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 539
Joined: Sun Dec 18, 2011 7:23 pm
Contact:

Re: Standalone not working with script only stack

Post by kaveh1000 »

OK, I had actually done this correctly before. Please see updated stack with

Code: Select all

standaloneSaved
changed to

Code: Select all

savingStandalone
but with the same result, namely SoS viewable unencrypted.
Attachments
encryption.zip
(2.18 KiB) Downloaded 673 times
Kaveh
hrcap
Posts: 141
Joined: Mon Jan 14, 2019 5:20 pm

Re: Standalone not working with script only stack

Post by hrcap »

Evening Kaveh

did you have any luck with encrypting the SOS's?


Many Thanks
kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 539
Joined: Sun Dec 18, 2011 7:23 pm
Contact:

Re: Standalone not working with script only stack

Post by kaveh1000 »

No. Thanks for asking. Really need a solution to this. Any help or hints appreciated.

Kaveh
Kaveh
kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 539
Joined: Sun Dec 18, 2011 7:23 pm
Contact:

Re: Standalone not working with script only stack

Post by kaveh1000 »

Hi all

I tried to run this stack again, in order to get an encrypted stack. I am uploading the latest version. The stack script of the main file is:

Code: Select all

on preopenstack
   put specialFolderPath("resources") into tLibraryPath
   put tLibraryPath & "/" & "ScriptOnlyStack.livecodescript" into tPath
   open stack tPath
   start using stack tPath
end preopenstack

on savingStandalone 
   set the scriptonly of stack "ScriptOnlyStack.livecodescript" to false
   set the mainstack of stack "ScriptOnlyStack.livecodescript" to "Testing encryption"
   set the password of stack "Testing encryption" to "hi"
   answer the password of stack "Testing encryption"
end savingStandalone
When I step through the savingStandalone handler, the script does not perform the first line, i.e.

Code: Select all

   set the scriptonly of stack "ScriptOnlyStack.livecodescript" to false
and jumps to the end statement. I cannot work out why. Any ideas please?

Kaveh
Attachments
Testing encryption.zip
(2.22 KiB) Downloaded 645 times
Kaveh
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7423
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Standalone not working with script only stack

Post by jacque »

I just noticed that the dictionary entry for scriptonly has an example of how to password protect a scriptonly stack. I'd guess that that you wouldn't need to decrypt it when using it either.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 539
Joined: Sun Dec 18, 2011 7:23 pm
Contact:

Re: Standalone not working with script only stack

Post by kaveh1000 »

Thanks. I tried that, i.e. without your suggestion of removing the standalone property, but still not encrypted...
Kaveh
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7423
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Standalone not working with script only stack

Post by jacque »

There's the old-fashioned way I suppose. When you're ready to build, encrypt the text file yourself with the "encrypt" command and save it to disk. Include it in the standalone. When you want to use it, decrypt it and save the file to the user's temporary folder using tempname to get the right file path. Open it from there and immediately delete the temporary file as soon as the stack is in memory.

The temp file will only be on disk for milliseconds, in an obscure location usually not ever seen by users.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Standalone not working with script only stack

Post by bogs »

Some times the old ways work best eh :D
Image
Bernard
Posts: 351
Joined: Sat Apr 08, 2006 10:14 pm

Re: Standalone not working with script only stack

Post by Bernard »

kaveh1000 wrote: Fri Apr 10, 2020 6:25 pm When I step through the savingStandalone handler, the script does not perform the first line, i.e.

Code: Select all

   set the scriptonly of stack "ScriptOnlyStack.livecodescript" to false
and jumps to the end statement. I cannot work out why. Any ideas please?

Kaveh
Isn't the problem here that the file extension should not be included as part of the stack name?

i.e.
set the scriptonly of stack "ScriptOnlyStack" to false
not
set the scriptonly of stack "ScriptOnlyStack.livecodescript" to false
Post Reply