Author Topic: mother board , and hard disk data  (Read 9376 times)

0 Members and 1 Guest are viewing this topic.

minosdam

  • Guest
Re: mother board , and hard disk data
« Reply #15 on: August 02, 2010, 12:38:10 PM »
I just tried to retrieve the serial number from the HD .. it returned nil ... did I miss something?
; -- Function VxGetDriveInfos
; Returns information's from a drive.
; Copyright:
;   ©2001 MENZI ENGINEERING GmbH, Switzerland
; Arguments [Type]:
;   Drv = Drive character, e.g. "C" or "C:" [STR]
; Return [Type]:
;   > Drive infos '(TotalSize FreeSpace DriveType FileSystem SerialNumber
;                   ShareName VolumeName)
    ;     Explanations:
    ;     - TotalSize (kB)
[REAL]
;       Returns the total space of a drive or network share.
;     - FreeSpace (kB) [REAL]
;       Returns the amount of space available to a user on the specified drive
;       or network share.
;     - DriveType [INT]
;       0 = "Unknown"
;       1 = "Removable"
;       2 = "Fixed"
;       3 = "Network"
;       4 = "CD-ROM"
;       5 = "RAM Disk"
;     - FileSystem [STR]
;       Returns the type of file system in use for the specified drive, e.g.
;       "FAT", "NTFS", "CDFS".
;     - SerialNumber [INT]
;       Returns the serial number used to uniquely identify a disk volume.
;     - ShareName [STR]
;       Returns the network share name (UNC) for the specified drive. If it's
;       not a network drive, ShareName returns a zero-length string ("").
;     - VolumeName [STR]
;       Returns the volume name of the specified drive.
;   >  0 The drive doesn't exist.
;   > -1 The drive is not ready. For removable-media drives and CD-ROM drives,
;        VxGetDriveInfos returns -1 when the appropriate media is not inserted
;        or not ready for access.
; Notes:
;   - Requires ScrRun.dll (see also notes at top of page).
;
(defun VxGetDriveInfos (Drv / DrvObj FilSys RetVal)
 (vl-load-com)
 (setq FilSys (vlax-create-object "Scripting.FileSystemObject")
       RetVal (cond
               ((= (vlax-invoke FilSys 'DriveExists Drv) 0) 0)
               ((setq DrvObj (vlax-invoke FilSys 'GetDrive Drv))
                (cond
                 ((= (vlax-get DrvObj 'IsReady) 0) -1)
                 ((list
                   (/ (vlax-get DrvObj 'TotalSize) 1000.0)
                   (/ (vlax-get DrvObj 'FreeSpace) 1000.0)
                   (vlax-get DrvObj 'DriveType)
                   (vlax-get DrvObj 'FileSystem)
                   (vlax-get DrvObj 'SerialNumber)
                   (vlax-get DrvObj 'ShareName)
                   (vlax-get DrvObj 'VolumeName)
                  )
                 )
                )
               )
              )
 )
 (if DrvObj (vlax-release-object DrvObj))
 (vlax-release-object FilSys)
 RetVal
)

TopoWAR

  • Newt
  • Posts: 135
Re: mother board , and hard disk data
« Reply #16 on: September 09, 2013, 03:25:25 PM »
hi all, please I need your help, I used this code but now it gives me error: SWbemServicesEx: Generic error in win 8, which may be happening??? I appreciate your ideas to solve this problem!

This is the code that gives me error that may have problem?
Code: [Select]
(setq WMI (vlax-create-object "WbemScripting.SWbemLocator")
meth1 (VLAX-INVOKE WMI 'ConnectServer nil nil nil nil nil nil nil nil)
meth2 (vlax-invoke meth1 'ExecQuery "select DataWidth from Win32_Processor")
s (vlax-for item meth2 (setq serx (list (vlax-get item 'DataWidth))))
  )
« Last Edit: September 09, 2013, 03:32:49 PM by TopoWAR »
Thanks for help

ronjonp

  • Needs a day job
  • Posts: 7527
Re: mother board , and hard disk data
« Reply #17 on: September 11, 2013, 12:20:20 PM »
Works for me on Windows 8 Pro x64


Quote
_$


(64)
; 1 form loaded from #<editor "<Untitled-1> loading...">
_$

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

TopoWAR

  • Newt
  • Posts: 135
Re: mother board , and hard disk data
« Reply #18 on: September 11, 2013, 12:40:58 PM »
ronjonp , NO on all pc's this error occurs, there is something in win 8 which prevents the communication of wmi from autocad, but is it???
Thanks for help