Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Member
JTJSBJB
Posts: 4
Registered: ‎11-28-2010
Message 1 of 6 (1,027 Views)

PC Board Serial Number

1027 Views, 5 Replies
11-28-2010 02:09 AM

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.

Active Contributor
cado
Posts: 49
Registered: ‎12-07-2005
Message 2 of 6 (998 Views)

Re: PC Board Serial Number

11-29-2010 09:13 AM 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)
)

 

 

Member
JTJSBJB
Posts: 4
Registered: ‎11-28-2010
Message 3 of 6 (963 Views)

Re: PC Board Serial Number

11-30-2010 07:27 AM 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.

Active Contributor
cado
Posts: 49
Registered: ‎12-07-2005
Message 4 of 6 (959 Views)

Re: PC Board Serial Number

11-30-2010 07:30 AM in reply to: JTJSBJB

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

 

 (vl-load-com)

Member
JTJSBJB
Posts: 4
Registered: ‎11-28-2010
Message 5 of 6 (931 Views)

Re: PC Board Serial Number

12-02-2010 05:20 AM 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

Active Contributor
cado
Posts: 49
Registered: ‎12-07-2005
Message 6 of 6 (925 Views)

Re: PC Board Serial Number

12-02-2010 06:19 AM 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.

 

 

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.