scriptOnly Stacks in closed source

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bhall2001
Posts: 107
Joined: Thu Oct 30, 2014 3:54 pm
Location: Manchester, NH

scriptOnly Stacks in closed source

Post by bhall2001 » Wed Sep 28, 2016 2:48 pm

I'm in need of guidance regarding the use of script only stacks in closed source applications (I have an Indy license). How do I include a closed source version of a script only stack in an standalone?

Do I need to create a standalone builder pre-processor where I loop through each of the script only stacks in the project setting the scriptOnly property to false and password protect the stack, create the standalone and package everything up? After building/packaging the stand alone, do I then need to post-process the script only stacks removing the password and setting the scriptOnly property to true so that they become script only stacks again?

Application structure (general high level), launcher.livecode is the stack that becomes the standalone for the application. My intention is to have the standalone in the same directory as launcher stack but reference the stacks of the "application" in the components and library directories.

Code: Select all

launcher.livecode
components/
   application.livecode
   about.livecode
libraries/
   mylib.livecodescript
   someOtherLib.livecodescript
   backscripts/
      applicationBackscript1.livecodescript
      applicationBackscript2.livecodescript
   frontscripts/
      applicationFrontscript1.livecodescript
      applicationFrontscript2.livecodescript
   behaviors/
      object1Behavior.livecodescript
      object2Behavior.livecodescript
      object3Behavior.livecodescript
Hope that makes sense and thanks in advance for any assistance,
Bob

mtalluto
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 125
Joined: Tue Apr 11, 2006 7:02 pm
Location: Seattle, WA
Contact:

Re: scriptOnly Stacks in closed source

Post by mtalluto » Wed Sep 28, 2016 10:10 pm

Here is some code we use to go back and forth between stack scripts and encrypted stacks. You will probably want to modify it a bit to make it work in an automated way. Should get you going in the right direction.

Code: Select all

command libraryPrivacy
     local tAction, tFilePath, tLibraryPath, tPassKey, tStackFormat
     
     --FREE OR PROTECT
     answer "Select mode:" with "Free" or "Protect" or "Cancel"
     put it into tAction
     if tAction is "cancel" then exit libraryPrivacy
     
     --SELECT FILES TO ADJUST
     answer files "Select files to adjust:"
     put it into tFilePath
     if it is empty then exit libraryPrivacy
     
     switch tAction
          case "Protect"
               put "MySuperSecurePasswordHere" into tPassKey
               if tPassKey is empty then exit to top
               
               repeat for each line xFilePath in tFilePath
                    try
                         set the scriptOnly of stack xFilePath to false
                         set the password of stack xFilePath to tPassKey
                         save stack xFilePath
                    catch tError
                    end try
               end repeat
               break
               
               
               
          case "Free"
               put "MySuperSecurePasswordHere" into tPassKey
               if tPassKey is empty then exit to top
               answer "Please choose:" with "Script Only" or "Stack File"
               put it into tStackFormat
               
               repeat for each line xFilePath in tFilePath
                    try
                         set the passkey of stack xFilePath to tPassKey
                         set the password of stack xFilePath to empty
                         save stack xFilePath
                         stop using stack xFilePath
                         delete stack xFilePath
                         lock messages
                         start using stack (tLibraryPath & xFilePath)
                         unlock messages
                         
                         if tStackFormat is "Script Only" then set the scriptOnly of stack xFilePath to true
                         save stack xFilePath
                    end try
               end repeat
               break
     end switch
end libraryPrivacy
Mark Talluto
--
Canela
design - develop - deploy: https://appli.io
Database and Cloud for LiveCode Developers: https://livecloud.io
Company: https://canelasoftware.com

Post Reply

Return to “Talking LiveCode”