Page 1 of 1

Simple serial numbering for standalones

Posted: Thu Mar 26, 2020 1:15 am
by dalkin
I've worked out a simple way to serialize standalones based on setting the 'visible' of key objects used in operating the software. See
serial.jpg
The code attached to the serial number box:

Code: Select all

on returnInField
   put field "Serial1" into tNumber
   if tNumber >= 1000 and tNumber <= 2000
   then set the visible of button "New Project" to true
   if tNumber >= 1000 and tNumber <= 2000
  then set the visible of field "Index" to true
  put tNumber into field "Serial1"
  set the opaque of field "Register1" to false
  set the opaque of field "Serial1" to false
  disable field "Register1"
  disable field "Serial1"
end returnInField
as you can see, entering a number between 1000 and 2000 sets the visible of the 2 key navigation objects 'New Project' and 'Index' to true and disables the registration fields. Setting the stack to automatically save on quit retains the serial information and the key field remain visible. In the example, any number between 1000 and 2000 will work. I still haven't worked out a way to send a unique serial number to someone downloading the zip file through a Wordpress sales site but for small volumes of sales it shouldn't be too hard to set the serial sequence in small batches. It doesn't stop anyone from distributing serialized software but it will sure slow them down.

Re: Simple serial numbering for standalones

Posted: Thu Mar 26, 2020 1:27 am
by FourthWorld
dalkin wrote:
Thu Mar 26, 2020 1:15 am
Setting the stack to automatically save on quit...
Is the stack file being saved part of the standalone?

OSes do not allow executables to modify themselves.

You can easily separate that stack into a separate stack file, though.

Re: Simple serial numbering for standalones

Posted: Thu Mar 26, 2020 3:19 am
by dalkin
Yes, that's what I have done. I simply have a launcher stack with all the standalone requirements built in. I then build that as an app with the appropriate handler and it references the "engine" stack which saves on quit. Interestingly, the bells and whistles of the App are working by simply adding the raw, uncompiled LC stack into the package contents. I don't know if this is the 'proper' way to do it but it's working fine in testing.
screen.jpg
The 1st appearing LHS Lyricist.livecode is the launcher and the one in package contents is the engine.

Re: Simple serial numbering for standalones

Posted: Thu Mar 26, 2020 6:52 am
by dalkin
Just a small change to allow for incorrect entry of the serial"

Code: Select all

on returnInField
   put field "Serial1" into tNumber
   if tNumber <= 856087687673 or tNumber >= 856087687683 
   then answer "Not a valid serial number. Please try again"
   if tNumber <= 856087687673 or tNumber >= 856087687683 then exit to top
   if tNumber >= 856087687673 and tNumber <= 856087687683
   then set the visible of button "New Project" to true
   if tNumber >= 856087687673 and tNumber <= 856087687683
   then set the visible of field "Index" to true
   put tNumber into field "Serial1"
   set the opaque of field "Register1" to false
   set the opaque of field "Serial1" to false
   disable field "Register1"
   disable field "Serial1"
end returnInField

Re: Simple serial numbering for standalones

Posted: Thu Mar 26, 2020 9:43 pm
by deadparrotsoftware
We took a somewhat different approach :)

For serialization, we use an external txt file that is created by a php program on our server at product delivery time.
uses numbers from a valid list, and user-provided Name.
The file is encoded - only the App can read it. The App has an internal list of valid serials. If the serial number
decoded isn't valid, and match, or the serial file is missing, App exits.
The php program zip's serial file and everything else together for download.

I didn't actually set up the system myself, but that is the general idea. :)

Sid

Re: Simple serial numbering for standalones

Posted: Fri Mar 27, 2020 11:06 pm
by jacque
Just a formatting suggestion that avoids duplicate comparisons and combines actions into related sections:

Code: Select all

on returnInField
  put field "Serial1" into tNumber
  put (tNumber >= 856087687673 and tNumber <= 856087687683) into tIsValid
  if not tIsValid then
    answer "Not a valid serial number. Please try again"
  else -- valid
    set the visible of button "New Project" to true
    set the visible of field "Index" to true
    --    put tNumber into field "Serial1" -- don't need this, it's already there and hasn't changed
    set the opaque of field "Register1" to false
    set the opaque of field "Serial1" to false
    disable field "Register1"
    disable field "Serial1"
  end if
end returnInField