pkenewell Posted December 20, 2023 Share Posted December 20, 2023 3 minutes ago, mohammadreza said: I used this code but show me this @mohammadreza All you did was load the file. You have to type (get_baseboardserialnumber) with the parenthesis at the command line to RUN the function. I suggest you start learning about the basics of AutoLISP / Visual LISP and customization. Look at some tutorials on Autodesk help, YouTube or google "AutoLISP programming basics" to get you started. Also check out some of LeeMac's tutorials: http://www.lee-mac.com/tutorials.html#lisptutorials 1 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 20, 2023 Share Posted December 20, 2023 (edited) Add last line to code (princ (strcat "\nThe SerialNumber is: " SerialNumber)) ) (setq ser (GET_BASEBOARDSERIALNUMBER)) Are you looking at using the serialnumber as part of a security check ? You will need to compile to FAS at least. Edited December 20, 2023 by BIGAL Quote Link to comment Share on other sites More sharing options...
Tomislav Posted April 2 Share Posted April 2 (setq sn (dos_serialno (nth driveindex (vl-finddrive)))) this line gives me errors, sometime it's 'bad argument type: numberp: nil' and sometimes that function dos_serailno is not defined Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted April 2 Share Posted April 2 I think that (dos_serialno) needs drive letters as arguments... Your syntax is complex, or I am missing something... Look at picture from documentation : Quote Link to comment Share on other sites More sharing options...
Tomislav Posted April 2 Share Posted April 2 I didn't write this lisp, I'm nowhere that capable, just wanted to see how it works, but that line keeps returning error... Do I need that doslib library to put somewhere? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 2 Share Posted April 2 Try this ; drive type 1 is a usb 2 hard disk (defun UsbDriveSerialNumber ( / fso dr) (setq fso (vlax-create-object "Scripting.FileSystemObject")) (vlax-for d (vlax-get fso 'Drives) (if (= (Vlax-get d 'DriveType) 2) (setq dr (cons (list (vla-get-path d) (vla-get-SerialNumber d)) dr) ) ) ) (vlax-release-object fso) (reverse dr) ) (UsbDriveSerialNumber) 1 Quote Link to comment Share on other sites More sharing options...
Tomislav Posted April 3 Share Posted April 3 thank you, i've replaced that vl-findrive and driveindex part with yours code and some editing and now it works, but wondering how come there are no letters in hd serial, and even c drive has negative number? Quote Link to comment Share on other sites More sharing options...
robierzo Posted April 3 Share Posted April 3 Tomislav, the serial number can be obtained in decimal or hexadecimal format. And it can be negative. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.