Is there a way with (vl-registry-read) to determine which OS is currently being used?
Example: the below code returns 'nil'.
(vl-registry-read (strcat "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProductName"))
Solved! Go to Solution.
Not that I know of. But OS changes happen relatively infrequently, so I think a simple solution would be to prompt the user and create your own registry key when missing and silently read it when present.
Alternatively,
(getenv "OS")
Though, being an environment variable, this is still reading from the registry.
That doesn't list if the OS is XP, Vista or Windows 7. It returns 'Windows NT'. (getvar "platform") accomplishes the versions.
Hy,
You can use WMI information
Daniel OLIVES
;**************************************************************************** (defun c:info (/ item meth1 meth2 process wmi) (defun lister(val / it) (vlax-for it val (princ (strcat "\n" (vlax-get it 'name) " : ")) (if (vlax-get it 'value) (princ (vlax-get it 'value)) (princ "Nil") ) ) )
(vl-load-com) (setq WMI (vlax-create-object "WbemScripting.SWbemLocator") meth1 (vlax-invoke WMI 'ConnectServer nil nil nil nil nil nil nil nil)) (foreach process (list "BIOS" "Processor" "VideoController" "SoundDevice" "CDROMDrive" "OperatingSystem" "ComputerSystem" "PhysicalMemory" "DiskDrive") (setq meth2 (vlax-invoke meth1 'ExecQuery (strcat "Select * from Win32_" Process))) (princ (strcat "\nCaractéristiques " process " :")) (vlax-for item meth2 (lister (vlax-get item 'Properties_)) (lister (vlax-get item 'Qualifiers_)) (getkword "\nAppuyez sur entrée pour continuer...") ) ) (mapcar 'vlax-release-object (list meth1 meth2 wmi)) (LecCmdXml "TPS_02_Divers.lsp" "INFO") (princ) ) ;**************************************************************************** (defun c:osinfo (/ WMI Serv OSArch item prop) (vl-load-com) (setq WMI (vlax-create-object "WbemScripting.SWbemLocator") Serv (vlax-invoke WMI 'ConnectServer nil nil nil nil nil nil nil nil) OSArch (vlax-invoke Serv 'ExecQuery "Select OSArchitecture from Win32_OperatingSystem"))
(vlax-for item OSArch (vlax-for prop (vlax-get item 'Properties_) (princ (vlax-get prop 'Value)) (setq valos (vlax-get prop 'Value)) ) )
(mapcar 'vlax-release-object (list OSArch Serv wmi)) (LecCmdXml "TPS_02_Divers.lsp" "OSINFO") (Msgbox "Technip TPS - Contrôle 32/64 bits" 64 (strcat "Votre OS est une version : " valos)) (princ) ) ;**************************************************************************** (defun appli (qui / apps item lst meth1 meth2 WMI)
(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 * from Win32_Process")) (vlax-for item meth2 (setq lst (cons (vlax-get item 'CommandLine) lst))) (foreach item (list WMI meth1 meth2) (vlax-release-object item) ) (vl-remove-if-not '(lambda(x) (and x (vl-string-search (strcase qui) (strcase x)))) lst) ) ; (while (appli "cmd.exe") ;**************************************************************************** (defun c:pcinfo (/ item meth1 meth2 process wmi) (defun lister (val / it) (vlax-for it val (princ (strcat "\n" (vlax-get it 'name) " : ")) (if (vlax-get it 'value) (princ (vlax-get it 'value)) (princ "Nil") ) ) ) (vl-load-com) (setq WMI (vlax-create-object "WbemScripting.SWbemLocator") meth1 (vlax-invoke WMI 'ConnectServer nil nil nil nil nil nil nil nil)) (foreach process (list "BIOS" "Processor" "VideoController" "SoundDevice" "CDROMDrive" "OperatingSystem" "ComputerSystem" "PhysicalMemory" "DiskDrive") (setq meth2 (vlax-invoke meth1 'ExecQuery (strcat "Select * from Win32_" Process))) (princ (strcat "\n\t\tCaractéristiques du processus \"" process "\"")) (vlax-for item meth2 (lister (vlax-get item 'Properties_)) (lister (vlax-get item 'Qualifiers_)) (getkword (strcat "\nAppuyez sur sur entrée pour continuer..." Process)) ) ) (vlax-release-object meth1) (vlax-release-object meth2) (vlax-release-object wmi) (LecCmdXml "TPS_02_Divers.lsp" "PCINFO") (princ) )
Can't find what you're looking for? Ask the community or share your knowledge.