Jump to content

Expire date for a lisp function


Merve

Recommended Posts

hi,

i need to help about expire date for a lisp function. i hardly write following lisp and i want to add an expire date in it. it will be vlx file and it shuld be not valid at 01/01/2017. And it needs a warning like "this function is expired!"

 

the lisp is;

(defun c:MKAtman ()
  (command "CMDECHO" "0")(terpri)
  (prompt "Setting layers")(princ)
  (command "layer" "unlock" "*" "thaw" "*" "on" "*" "")
  (command "layer" "m" "0" "c" "7" "" "l" "Continuous" "" "")
  (if(not(tblsearch "LAYER" "000_Ahşap"))
  (command "layer" "m" "000_Ahşap" "c" "white" "" "l" "Continuous" "" "d" "Ahşap İmalatlar" "000_Ahşap" "")
  (command "layer" "m" "000_Ahşap" "c" "white" "" "l" "Continuous" "" "d" "Ahşap İmalatlar" "000_Ahşap" "y" ""))
  (if(not(tblsearch "LAYER" "000_Andezit"))
  (command "layer" "m" "000_Andezit" "c" "250" "" "l" "Continuous" "" "d" "Andezit Döşeme Kaplamaları" "000_Andezit" "")
  (command "layer" "m" "000_Andezit" "c" "250" "" "l" "Continuous" "" "d" "Andezit Döşeme Kaplamaları" "000_Andezit" "y" ""))
  (if(not(tblsearch "LAYER" "000_Antet"))
  (command "layer" "m" "000_Antet" "c" "251" "" "l" "Continuous" "" "d" "ABB Antet" "000_Antet" "")
  (command "layer" "m" "000_Antet" "c" "251" "" "l" "Continuous" "" "d" " ABB Antet" "000_Antet" "y" ""))
  (if(not(tblsearch "LAYER" "000_Beton Parke"))
  (command "layer" "m" "000_Beton Parke" "c" "250" "" "l" "Continuous" "" "d" "N/A" "000_Beton Parke" "")
  (command "layer" "m" "000_Beton Parke" "c" "250" "" "l" "Continuous" "" "d" "N/A" "000_Beton Parke" "y" ""))
  (if(not(tblsearch "LAYER" "000_Bitki"))
  (command "layer" "m" "000_Bitki" "c" "white" "" "l" "Continuous" "" "d" "N/A" "000_Bitki" "")
  (command "layer" "m" "000_Bitki" "c" "white" "" "l" "Continuous" "" "d" "N/A" "000_Bitki" "y" ""))
  (if(not(tblsearch "LAYER" "000_Bitki İz"))
  (command "layer" "m" "000_Bitki İz" "c" "white" "" "l" "Continuous" "" "d" "N/A" "000_Bitki İz" "")
  (command "layer" "m" "000_Bitki İz" "c" "white" "" "l" "Continuous" "" "d" "N/A" "000_Bitki İz" "y" ""))
  (if(not(tblsearch "LAYER" "000_Bordür"))
  (command "layer" "m" "000_Bordür" "c" "180" "" "l" "Continuous" "" "d" "N/A" "000_Bordür" "")
  (command "layer" "m" "000_Bordür" "c" "180" "" "l" "Continuous" "" "d" "N/A" "000_Bordür" "y" ""))
  (if(not(tblsearch "LAYER" "000_Çim Tarama"))
  (command "layer" "m" "000_Çim Tarama" "c" "64" "" "l" "Continuous" "" "d" "169,185,167" "000_Çim Tarama" "")
  (command "layer" "m" "000_Çim Tarama" "c" "64" "" "l" "Continuous" "" "d" "169,185,167" "000_Çim Tarama" "y" ""))
  (if(not(tblsearch "LAYER" "000_Duvar"))
  (command "layer" "m" "000_Duvar" "c" "19" "" "l" "Continuous" "" "d" "N/A" "000_Duvar" "")
  (command "layer" "m" "000_Duvar" "c" "19" "" "l" "Continuous" "" "d" "N/A" "000_Duvar" "y" ""))
  (if(not(tblsearch "LAYER" "000_EPDM"))
  (command "layer" "m" "000_EPDM" "c" "white" "" "l" "Continuous" "" "d" "142,95,87" "000_EPDM" "")
  (command "layer" "m" "000_EPDM" "c" "white" "" "l" "Continuous" "" "d" "142,95,87" "000_EPDM" "y" ""))
  (if(not(tblsearch "LAYER" "000_Eski Eğri"))
  (command "layer" "m" "000_Eski Eğri" "c" "253" "" "l" "Dashed2" "" "d" "N/A" "000_Eski Eğri" "")
  (command "layer" "m" "000_Eski Eğri" "c" "253" "" "l" "Dashed2" "" "d" "N/A" "000_Eski Eğri" "y" ""))
  (if(not(tblsearch "LAYER" "000_Havuz"))
  (command "layer" "m" "000_Havuz" "c" "132" "" "l" "Continuous" "" "d" "N/A" "000_Havuz" "")
  (command "layer" "m" "000_Havuz" "c" "132" "" "l" "Continuous" "" "d" "N/A" "000_Havuz" "y" ""))
  (if(not(tblsearch "LAYER" "000_Kauçuk"))
  (command "layer" "m" "000_Kauçuk" "c" "white" "" "l" "Continuous" "" "d" "142,95,87" "000_Kauçuk" "")
  (command "layer" "m" "000_Kauçuk" "c" "white" "" "l" "Continuous" "" "d" "142,95,87" "000_Kauçuk" "y" ""))
  (if(not(tblsearch "LAYER" "000_Kent Mobilyası"))
  (command "layer" "m" "000_Kent Mobilyası" "c" "white" "" "l" "Continuous" "" "d" "N/A" "000_Kent Mobilyası" "")
  (command "layer" "m" "000_Kent Mobilyası" "c" "white" "" "l" "Continuous" "" "d" "N/A" "000_Kent Mobilyası" "y" ""))
  (if(not(tblsearch "LAYER" "000_Koşu Yolu"))
  (command "layer" "m" "000_Koşu Yolu" "c" "34" "" "l" "Continuous" "" "d" "N/A" "000_Koşu Yolu" "")
  (command "layer" "m" "000_Koşu Yolu" "c" "34" "" "l" "Continuous" "" "d" "N/A" "000_Koşu Yolu" "y" ""))
  (if(not(tblsearch "LAYER" "000_KüpTaş"))
  (command "layer" "m" "000_KüpTaş" "c" "250" "" "l" "Continuous" "" "d" "N/A" "000_KüpTaş" "")
  (command "layer" "m" "000_KüpTaş" "c" "250" "" "l" "Continuous" "" "d" "N/A" "000_KüpTaş" "y" ""))
  (if(not(tblsearch "LAYER" "000_Mevsimlik Tarama"))
  (command "layer" "m" "000_Mevsimlik Tarama" "c" "210" "" "l" "Continuous" "" "d" "N/A" "000_Mevsimlik Tarama" "")
  (command "layer" "m" "000_Mevsimlik Tarama" "c" "210" "" "l" "Continuous" "" "d" "N/A" "000_Mevsimlik Tarama" "y" ""))
  (if(not(tblsearch "LAYER" "000_Ölçü"))
  (command "layer" "m" "000_Ölçü" "c" "217" "" "l" "Continuous" "" "d" "N/A" "000_Ölçü" "")
  (command "layer" "m" "000_Ölçü" "c" "217" "" "l" "Continuous" "" "d" "N/A" "000_Ölçü" "y" ""))
  (if(not(tblsearch "LAYER" "000_Sert Tarama"))
  (command "layer" "m" "000_Sert Tarama" "c" "white" "" "l" "Continuous" "" "d" "N/A" "000_Sert Tarama" "")
  (command "layer" "m" "000_Sert Tarama" "c" "white" "" "l" "Continuous" "" "d" "N/A" "000_Sert Tarama" "y" ""))
  (if(not(tblsearch "LAYER" "000_Sınır"))
  (command "layer" "m" "000_Sınır" "c" "20" "" "l" "Continuous" "" "d" "N/A" "000_Sınır" "")
  (command "layer" "m" "000_Sınır" "c" "20" "" "l" "Continuous" "" "d" "N/A" "000_Sınır" "y" ""))
  (if(not(tblsearch "LAYER" "000_Slopeticks"))
  (command "layer" "m" "000_Slopeticks" "c" "252" "" "l" "Continuous" "" "d" "Şev Çizgisi" "000_Slopeticks" "")
  (command "layer" "m" "000_Slopeticks" "c" "252" "" "l" "Continuous" "" "d" "Şev Çizgisi" "000_Slopeticks" "y" ""))
  (if(not(tblsearch "LAYER" "000_Tasarım"))
  (command "layer" "m" "000_Tasarım" "c" "50" "" "l" "Continuous" "" "d" "N/A" "000_Tasarım" "")
  (command "layer" "m" "000_Tasarım" "c" "50" "" "l" "Continuous" "" "d" "N/A" "000_Tasarım" "y" ""))
  (if(not(tblsearch "LAYER" "000_Terrazo Granit AG"))
  (command "layer" "m" "000_Terrazo Granit AG" "c" "250" "" "l" "Continuous" "" "d" "N/A" "000_Terrazo Granit AG" "")
  (command "layer" "m" "000_Terrazo Granit AG" "c" "250" "" "l" "Continuous" "" "d" "N/A" "000_Terrazo Granit AG" "y" ""))
  (if(not(tblsearch "LAYER" "000_Terrazo Bazalt AG"))
  (command "layer" "m" "000_Terrazo Bazalt AG" "c" "250" "" "l" "Continuous" "" "d" "N/A" "000_Terrazo Bazalt AG" "")
  (command "layer" "m" "000_Terrazo Bazalt AG" "c" "250" "" "l" "Continuous" "" "d" "N/A" "000_Terrazo Bazalt AG" "y" ""))
  (if(not(tblsearch "LAYER" "000_Terrazo Washbeton Yİ"))
  (command "layer" "m" "000_Terrazo Washbeton Yİ" "c" "250" "" "l" "Continuous" "" "d" "N/A" "000_Terrazo Washbeton Yİ" "")
  (command "layer" "m" "000_Terrazo Washbeton Yİ" "c" "250" "" "l" "Continuous" "" "d" "N/A" "000_Terrazo Washbeton Yİ" "y" ""))
  (if(not(tblsearch "LAYER" "000_Yazı"))
  (command "layer" "m" "000_Yazı" "c" "220" "" "l" "Continuous" "" "d" "N/A" "000_Yazı" "")
  (command "layer" "m" "000_Yazı" "c" "220" "" "l" "Continuous" "" "d" "N/A" "000_Yazı" "y" ""))
  (if(not(tblsearch "LAYER" "000_Yeni Eğri"))
  (command "layer" "m" "000_Yeni Eğri" "c" "20" "" "l" "Continuous" "" "d" "N/A" "000_Yeni Eğri" "")
  (command "layer" "m" "000_Yeni Eğri" "c" "20" "" "l" "Continuous" "" "d" "N/A" "000_Yeni Eğri" "y" ""))
  (command "layer" "s" "0" "")
  (command "CMDECHO" "1")
  (prompt "Tüm Layerlar Başarıyla Oluşturulmuştur.")
  (princ)
  );end defun

Link to comment
Share on other sites

Just a suggestion for next time make a LIST of your layer details (name1 col1 ltype1 name2 col2 ltype2 ........ then just get the length of the list use it with a repeat that looks at the 3 variables then do the table search. The whole lisp would only be a few lines long rather than repeating the layer command for every layer.

Link to comment
Share on other sites

There are other ways as well, like you have 50 Goes, now 49 48 ... write a number to the registery via lisp. The resetting of the date is a bit easy to fudge and keep using if you know thats what its using. Another would be to read a URL on your web site that checks their usage either a counter or the correct date. You can check a Autocad serial number stops copying to lots of machines. If the software is usefull people will try to give it away to others.

 

If you have lots of routines its easy to add a header to the lisp's that has your checking routine, this way it runs normal for you. Copy Header+Lisp1 LISP1vlx

Link to comment
Share on other sites

Here is the other code done again with a slight addition, put it at the start of your lisp. The (exit) will do just that stop running the lisp. We had multiple lisps so we added the security code at time of issue using a DOS command copy security.lsp+lisp1.lsp c:\\securtity\\lisp1.lsp then would compile into FAS. You can script your making fas as well if you have lots to do.

 

(if (< (rtos (getvar "cdate") 2 0) "20170101") ; 1st Jan 2017
(princ)
(progn
(Alert "Contact Merve for Renewal\n\nPlease call us on 12334567 to discuss continued use")
(exit)
)
)

Link to comment
Share on other sites

Here is the other code done again with a slight addition, put it at the start of your lisp. The (exit) will do just that stop running the lisp. We had multiple lisps so we added the security code at time of issue using a DOS command copy security.lsp+lisp1.lsp c:\\securtity\\lisp1.lsp then would compile into FAS. You can script your making fas as well if you have lots to do.

 

(if (< (rtos (getvar "cdate") 2 0) "20170101") ; 1st Jan 2017
(princ)
(progn
(Alert "Contact Merve for Renewal\n\nPlease call us on 12334567 to discuss continued use")
(exit)
)
)

 

it worked! thank you. this was very important for me. :beer::notworthy:

Link to comment
Share on other sites

it worked! thank you. this was very important for me. :beer::notworthy:

 

Nicely done BIGAL. :beer:

 

I am illisperate, so pardon me if this is either wrong, or too obvious to mention.

I am guessing that if a user were to open this lisp in Notepad, and delete this latest addition, and SAVE it, one could continue to use the lisp with no further disruption?

Doubtless Merve is aware of this, or should be, if I am correct. :|

Link to comment
Share on other sites

I am guessing that if a user were to open this lisp in Notepad, and delete this latest addition, and SAVE it, one could continue to use the lisp with no further disruption?

Thats why OP's intention is to convert the lsp into vlx file.

 

Anyway nice suggestion Big Al, I didn't knew that diesel functions can compare "string numbers":

_$ (> "20170102" "20170101")
T
_$ (> "20161121" "20170101")
nil
_$ 

Also if visual lisp is used, something like this might be more preferable:

(defun C:test ( / )
(and
	(> (rtos (getvar 'cdate) 2 0) "20170101") ; 1st Jan 2017
	(not (alert "This function is expired!\nPlease contact: 1234567890"))
	(vl-exit-with-value T)
)
(alert "\nThe main funciton is running.")
(princ)
) (vl-load-com)

Since (exit) / (quit) exits with error.

Link to comment
Share on other sites

Anyway nice suggestion Big Al, I didn't knew that diesel functions can compare "string numbers":

_$ (> "20170102" "20170101")
T
_$ (> "20161121" "20170101")
nil
_$ 

 

The AutoLISP ">",">=","

_$ (< "10" "2")
T

Link to comment
Share on other sites

The AutoLISP ">",">=","
_$ (< "10" "2")
T

 

I see, not sure whats exactly the logic. I suspect that it has something to do with ascii, combined with string to list conversions.

Perhaps this could be countered with:

_$ (apply '< (mapcar 'atof '("10" "2")))
nil
_$ (apply '> (mapcar 'atof '("10" "2")))
T
_$ 

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...