pkenewell Posted December 20, 2023 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
BIGAL Posted December 20, 2023 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
Tomislav Posted April 2, 2024 Posted April 2, 2024 (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
marko_ribar Posted April 2, 2024 Posted April 2, 2024 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
Tomislav Posted April 2, 2024 Posted April 2, 2024 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
BIGAL Posted April 2, 2024 Posted April 2, 2024 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
Tomislav Posted April 3, 2024 Posted April 3, 2024 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
robierzo Posted April 3, 2024 Posted April 3, 2024 Tomislav, the serial number can be obtained in decimal or hexadecimal format. And it can be negative. 1 Quote
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.