PxPlus User Forum

Twitter Twitter Twitter

Author Topic: Applying Temporary installation keys  (Read 1492 times)

PxPlus

  • Administrator
  • Diamond Member
  • *****
  • Posts: 1091
    • View Profile
Applying Temporary installation keys
« on: May 31, 2018, 10:37:39 AM »
If you want to simplify the process for your users to install and register your software, the following program can be used to allow them the highlight and copy their registration keys into the clipboard and have the system apply them.

0010 PRINT 'DIALOGUE'(0,0,40,11,"Registration Utililty",'B?',OPT="^"),'SR','CS','OPTION'("CenterWdw"),
0020 CLIP_BOARD WRITE ""
0030 PRINT 'PICTURE'(20,20,120,120,"!SYS_INFO",1),
0040 PRINT ""
0050 PRINT " Please select and ",'BLUE',"COPY",'RM'," the keys"
0060 PRINT " you have been sent."
0070 PRINT
0080 PRINT " Press ESCAPE to cancel"
0090 LET CUR_STS$=""
0100 WHILE 1
0110 LET KEY1$="",KEY2$=""
0120 CLIP_BOARD READ X$
0130 LET STS$="No keys selected"
0140 LET O=MSK(X$,".....-.....-.....-.....-.....")
0150 IF O=0 THEN GOTO SHOW_STS
0160 LET STS$="Only one key selected"
0170 LET KEY1$=X$(O,29),X$=X$(O+29)
0180 LET O=MSK(X$)
0190 IF O=0 THEN GOTO SHOW_STS
0200 LET KEY2$=X$(O,29)
0210 BREAK
0220 SHOW_STS:
0230 IF CUR_STS$<>STS$ THEN PRINT 'IMAGE'(DELETE "STS"),'IMAGE'("STS"),'FONT'("*guifont",2,"BC"),'TEXT'(@X(0),@Y(7),@X(MXC(0)+1),@Y(9),STS$),; LET CUR_STS$=STS$
0240 OBTAIN (0,TIM=.5,BSY=*CONTINUE)*
0250 IF EOM=ESC OR CTL=4 OR CTL=-1999 THEN BREAK
0260 WEND
0270 IF KEY2$="" THEN STOP ! No keys
0280 !
0290 ! Keys have been copied
0300 !
0310 LET X$=ARG(0)
0320 LET X$=X$(1,POS("\/:"=X$,-1))+"pxpreg"
0330 IF POS(" "=X$) THEN LET X$=QUO+X$+QUO
0340 !
0350 ! Get name
0360 !
0370 CALL "*fl.nme",F$
0380 LET N$="Unknown name"
0390 INVOKE WAIT HIDE ENV("COMSPEC")+" /c "+X$+" -v >"+F$
0400 SELECT R$ FROM F$ WHERE POS("Registe"=R$)
0410 LET N$=STP(R$(POS(":"=R$)+1),2)
0420 BREAK
0430 NEXT RECORD
0440 ERASE F$,ERR=*NEXT
0450 PRINT 'POP',
0460 LET N$=SUB(N$,$0D$,"")
0470 !
0480 ! If a demo key we want to init the file
0490 !
0500 IF TCB(33)=799999 THEN LET INIT$=" -i" ELSE LET INIT$=""
0510 !
0520 ! Apply keys
0530 !
0540 INVOKE HIDE WAIT X$+INIT$+" -k "+KEY1$+" -n "+QUO+N$+QUO
0550 INVOKE HIDE WAIT X$+" -k "+KEY2$
0560 MSGBOX "Your registration keys have been applied."+SEP+SEP+"The registration will take effect when you run the program the next time.",N$,"INFO,TOP"
0570 END

It assumes that if the system is running a demo key the file must be re-initialized otherwise it just applies the keys.

There is limited error checking in the above but it should be able to serve as a basis for an activation utility.