Visual LISP, AutoLISP and General Customization

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

PC Board Serial Number

595 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
Posts: 49
Registered: ‎12-07-2005
Message 2 of 6 (566 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 (531 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
Posts: 49
Registered: ‎12-07-2005
Message 4 of 6 (527 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 (499 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
Posts: 49
Registered: ‎12-07-2005
Message 6 of 6 (493 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.

 

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you interested in helping shape the Autodesk Community?
We’re looking at a few different ways to improve the “All Forums” landing page and need your feedback! If interested, please take a few minutes to fill out the following Usability Study. Thank you for your time!

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community