Simple serial numbering for standalones

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
dalkin
Posts: 100
Joined: Wed Jul 04, 2007 2:32 am
Location: Blackheath, Australia
Contact:

Simple serial numbering for standalones

Post by dalkin » Thu Mar 26, 2020 1:15 am

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.
Last edited by dalkin on Thu Mar 26, 2020 5:08 am, edited 1 time in total.
If you're skating on thin ice you might as well dance.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7647
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Simple serial numbering for standalones

Post by FourthWorld » Thu Mar 26, 2020 1:27 am

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.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

dalkin
Posts: 100
Joined: Wed Jul 04, 2007 2:32 am
Location: Blackheath, Australia
Contact:

Re: Simple serial numbering for standalones

Post by dalkin » Thu Mar 26, 2020 3:19 am

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.
If you're skating on thin ice you might as well dance.

dalkin
Posts: 100
Joined: Wed Jul 04, 2007 2:32 am
Location: Blackheath, Australia
Contact:

Re: Simple serial numbering for standalones

Post by dalkin » Thu Mar 26, 2020 6:52 am

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
If you're skating on thin ice you might as well dance.

deadparrotsoftware
Posts: 41
Joined: Thu Mar 24, 2016 6:56 pm
Location: Orlando FL
Contact:

Re: Simple serial numbering for standalones

Post by deadparrotsoftware » Thu Mar 26, 2020 9:43 pm

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
http://AppBuzzinga.com - App Making Software, Source Code, & Information
Win, MAC, Android, Apple, WordPress

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5344
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Simple serial numbering for standalones

Post by jacque » Fri Mar 27, 2020 11:06 pm

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
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”