Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Member
4 Posts
0 Kudos
Registered: ‎11-28-2010
Post 1 of 6

PC Board Serial Number

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

Valued Contributor
50 Posts
2 Kudos
Registered: ‎12-07-2005
Post 2 of 6

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
4 Posts
0 Kudos
Registered: ‎11-28-2010
Post 3 of 6

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.

Valued Contributor
50 Posts
2 Kudos
Registered: ‎12-07-2005
Post 4 of 6

Re: PC Board Serial Number

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

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

 

 (vl-load-com)

Member
4 Posts
0 Kudos
Registered: ‎11-28-2010
Post 5 of 6

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

Valued Contributor
50 Posts
2 Kudos
Registered: ‎12-07-2005
Post 6 of 6

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.

 

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!