Jump to content

Date Check Handling Lisp


Clixs

Recommended Posts

Hi!

 

I am new here in the forum, and i would like to seek help from the experts.

 

I am currently working on a lisp and including there is to check the system date or the validity of the lisp file, for a trial version of my work. But, i have problems when you set the system date like for Windows XP back to an older date the lisp will definitely work.

 

Can someone make a lisp or just a simple routine that even when you backdate the System Date, the lisp will not be usable.

 

Thanks in advance,

Clixs

Link to comment
Share on other sites

Hmmm, so instead of making a date check maybe i should use a counter. I've been thinking to change the routine already after reading few threads here. So, the date checking would not be working unless you make an arx file?

 

I will try changing the routines into counter method. Thanks rkmcswain for giving me the link. But if anyone can magically create the date checking, can you please post it here.

 

Thanks again!

Link to comment
Share on other sites

I was going to say that nothing is perfect for this type of problem, but (setenv) and (getenv) in a compiled routine would be good starting points.

 

You could kludge by:

 

(if (not (getenv "MyDemo"))
   (setenv "MyDemo" "1")
   (setenv "MyDemo" (itoa (1+ (atoi (getenv "MyDemo"))))))
(if (> (atoi (getenv "MyDemo")) 10)
  (progn
    (alert "You Have Exceeding to Demo Time")
    (exit)))

 

Someone could always dig into the registry and reset the test but it would take some work. -David

Link to comment
Share on other sites

I was going to say that nothing is perfect for this type of problem, but (setenv) and (getenv) in a compiled routine would be good starting points.

 

You could kludge by:

 

(if (not (getenv "MyDemo"))
   (setenv "MyDemo" "1")
   (setenv "MyDemo" (itoa (1+ (atoi (getenv "MyDemo"))))))
(if (> (atoi (getenv "MyDemo")) 10)
  (progn
    (alert "You Have Exceeding to Demo Time")
    (exit)))

 

Someone could always dig into the registry and reset the test but it would take some work. -David

 

 

This is another type of codes, thank you, will try this also. I will post here the date checking that i made, maybe others could evaluate or improve this routines. What i did is to create a temporary file to windows system and inside the file is the date purchase and the expiration date, everytime you run a command the lisp will try to check this file. The routine is running perfect within the purchase and the expiry date, as to what i said earlier when you backdate your system clock between the purchase and the expiry date, the lisp will started to work again. I did not include here the ELSE statement coz it only calls my routines to run.

 

Wish that this routine sample could help others also. 8)

 

 

 

(DEFUN SQTY_CHECKDATE ()
   (SETQ SQTY_DD NIL)
   (SETQ temploc(GETVAR "tempprefix"))
   (IF (OR (= temploc "")(= temploc NIL))
        (SETQ tmpfile "sqty.CFG")
        (SETQ tmpfile(STRCAT temploc "sqty.CFG"))
   )
   (IF (= (FINDFILE tmpfile) NIL)
        (PROGN
       (IF (OR (= temploc "") (= temploc NIL)) (SETQ write_file(OPEN "sqty.CFG" "w")) (SETQ write_file 

(OPEN (STRCAT temploc "sqty.CFG") "w"))
       )
       (SQTY_CFG)
           (SQTY_CHECKDATE)
        )
        (PROGN
       (SETQ EXPDATE (FINDFILE tmpfile))
       (SETQ write_file (OPEN FFILE "r"))
       (READ-LINE write_file)
       (SETQ EXPDATE (SUBSTR (READ-LINE write_file)62 )
       (SETQ PCHASE (SUBSTR (READ-LINE write_file)62 )
       (CLOSE write_file)
       (SETQ SQTY_DD (STRCAT (MENUCMD "M=$(edtime,$(getvar,date),YYYYMODD)")))
       (IF (OR(<= EXPDATE SQTY_DD)(>= PCHASE SQTY_DD))
            (PROGN
           (IF (OR (= temploc "")(= temploc NIL)) (SETQ write_file (OPEN"sqty.CFG""w")) (SETQ 

write_file(OPEN(STRCAT temploc "sqty.CFG") "w"))
           )
            (SQTY_CFG)
            (MyAlert);;My Customize Alert box which says that Trial is over
            )

Link to comment
Share on other sites

To aleviate the issue of back-dating one's computer... simply add a check that compares the current date/time to that of vl-file-systime of your .CFG file.

 

... That way, the expiry window has been narrowed down to newer than the .CFG file, but older than the expiry date.

 

(and (< (vl-file-systime [color=deepskyblue]CFG_File[/color]) [color=blue]CUR_DateTime[/color])
    (> [color=blue]CUR_DateTime[/color] [color=red]EXP_DateTime[/color]))

Link to comment
Share on other sites

Your writing in plain lisp so you really need to make sure you compile your program else its just text and some smart people will undo your handy work.

 

Maybe rather than writing a file, write to the registery two date values current date of 1st time used and expiry date, theres examples here of how to read & write to the registery. file searches etc will not find anything you have to be tougher than those that will rip you of know from experience. Another good one keeps them honest but needs to be updated from time to time is bury the users autocad serial number in your code. We had a batch file that made the code changes basicly

copy serial+lisprog1.lsp C:\user\lispprog1.lsp

the + adds two files together automatically so you run without serial number during testing.

 

Just having a time in it does not mean it can not be handed out to everyone. The phone call "I can not get it to work on another machine" means I am ripping you off it happened to us.

 

found it

(setq run (getvar "_pkser"))
(if (or (= run "440-20001234")(= run "440-20001235"))
(princ "\nSecurity check passed")
(progn
(princ "\nYou have tried to run on a non authorised machine")
(princ "\nPlease contact us on 123 456 789")
(/e)
)
)

Link to comment
Share on other sites

Your writing in plain lisp so you really need to make sure you compile your program else its just text and some smart people will undo your handy work.

 

Maybe rather than writing a file, write to the registery two date values current date of 1st time used and expiry date, theres examples here of how to read & write to the registery. file searches etc will not find anything you have to be tougher than those that will rip you of know from experience. Another good one keeps them honest but needs to be updated from time to time is bury the users autocad serial number in your code. We had a batch file that made the code changes basicly

copy serial+lisprog1.lsp C:\user\lispprog1.lsp

the + adds two files together automatically so you run without serial number during testing.

 

Just having a time in it does not mean it can not be handed out to everyone. The phone call "I can not get it to work on another machine" means I am ripping you off it happened to us.

 

found it

(setq run (getvar "_pkser"))
(if (or (= run "440-20001234")(= run "440-20001235"))
(princ "\nSecurity check passed")
(progn
(princ "\nYou have tried to run on a non authorised machine")
(princ "\nPlease contact us on 123 456 789")
(/e)
)
)

 

 

@BIGAL

 

No, i only wrote the checkdate function in plain lisp, i do have Vlisp codes included within my routines and yes you were right with the compilation, i do compile all my lisp routines before beta testing even on the alpha test also.

 

Thanks for giving us the variables of the serial anyway mate! 8)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...