Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PC Board Serial Number

5 REPLIES 5
Reply
Message 1 of 6
JTJSBJB
1767 Views, 5 Replies

PC Board Serial Number

Hi everybody,

I've been using AutoCAD since AotuCAD R12, Since then I'm writing autolisp programme for my own use. I've 1 small problem. I don't know the AutoCAD command on how to extract the 9 digit of PCB serial number. The purpose for this is to protect the program it self. I hope somebody can give me the answer. Thank you

 

Mamy.

5 REPLIES 5
Message 2 of 6
cado
in reply to: JTJSBJB

Hi..

You can use the HD serial number..

 

(defun HDSERIAL (drv / DrvObj FSO getDRV)
(setq FSO (vlax-create-object "Scripting.FileSystemObject"))
(setq getDRV (vlax-invoke FSO 'GetDrive drv))
(vlax-get getDRV 'SerialNumber)
  (vlax-release-object FSO)
  (vlax-release-object getDRV)
)

 

 

Message 3 of 6
JTJSBJB
in reply to: cado

Hi Mr. CADO,

 

Thanks a lot for your reply on my message and helping me to solve the problem.

I've tried the small lisp that posted by you. Unfortunately it's not work. Maybe my AutoCAD version is not competable with the command.

Message 4 of 6
cado
in reply to: JTJSBJB

sorry....I forgot to put...

 

 (vl-load-com)

Message 5 of 6
JTJSBJB
in reply to: JTJSBJB

Hi Mr. CADO,

 

It's give me error as below. I've tried for every line in the lisp.

 

; error: too few arguments

Message 6 of 6
cado
in reply to: JTJSBJB

ok I see...

 

you need to specify your drive.

examples..

 

(defun HDSERIAL (drv / DrvObj FSO getDRV)
(vl-load-com)
(setq FSO (vlax-create-object "Scripting.FileSystemObject"))
(setq getDRV (vlax-invoke FSO 'GetDrive drv))
(vlax-get getDRV 'SerialNumber)
  (vlax-release-object FSO)
  (vlax-release-object getDRV)
)

;|    TESTS

(HDSERIAL "c:")
(HDSERIAL "x:")
(HDSERIAL "\\\\Server1\\folderA\\FolderB")

|;

 

put the (vla-load-com) on the top.

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost