See the top rated post in this thread. Click here

Results 1 to 3 of 3

Thread: Code help

  1. #1
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    406
    Login to Give a bone
    0

    Default Code help

    Hi everyone,

    I am in need of code that will limit the time a program will work. For example, have the program check the date each time it runs till it reaches a date that I have entered for the code not to run anymore.

    Thanks,

    Cadd4la

  2. #2
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    1

    Default Re: Code help

    Assuming you're going to compile the LISP code to a FAS or VLX file you could just add this to the beginning of the LSP:
    Code:
    (setq lastday 20080508.0) ;Change to the date you wanted
    (print "Checking date ... ")
    (if (> (getvar "CDATE") lastday)
      (progn
        (princ "This program has expired.")
        (quit)
      )
      (progn
        (princ (strcat "You've still got " (itoa (fix (- lastday (getvar "CDATE")))) " day(s) to run this program ... "))
      )
    )
    (princ "Program loaded.")
    
    ;; Continue with the rest of the code
    Of course, it won't be very difficult for anyone to change the date on their PC in order to run your code as if it's still a year ago!

  3. #3
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    406
    Login to Give a bone
    0

    Smile Re: Code help

    irneb,

    Thanks, thats what I was looking for.

    Cadd4la

Similar Threads

  1. Allow Other Code Compilers for ARX Code
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 2
    Last Post: 2013-02-10, 08:06 AM
  2. Insert vbscript code has not code
    By buzz in forum AMEP General
    Replies: 3
    Last Post: 2008-02-09, 03:08 AM
  3. Please help on this code
    By jitesh789 in forum AutoLISP
    Replies: 6
    Last Post: 2007-12-11, 05:55 PM
  4. Convert VBA code to VB code
    By Robert Platt in forum VBA/COM Interop
    Replies: 20
    Last Post: 2007-08-15, 10:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •