Lt Dan's legs Posted February 13, 2012 Posted February 13, 2012 This will seem silly but, how can you find out how many monitors a user has without looking over your cubicle wall? We do a lot of things in excel as well as autocad. I'm just trying to combine the two. Quote
Jack_O'neill Posted February 13, 2012 Posted February 13, 2012 This will seem silly but' date=' how can you find out how many monitors a user has without looking over your cubicle wall? We do a lot of things in excel as well as autocad. I'm just trying to combine the two.[/quote'] Send out a group email and ask? Quote
Lt Dan's legs Posted February 13, 2012 Author Posted February 13, 2012 I'm trying to make a lisp for everyone that will work after I leave this place. I do not plan to stay at this job very long. I could just make a settings option so the user selects number of monitors.. I'd like to avoid it if I could Quote
Jack_O'neill Posted February 14, 2012 Posted February 14, 2012 If you can't ask, and you can't go around and look...I don't know what to tell you. When you say everyone, do you mean everyone in the country or just at that company? Quote
MSasu Posted February 14, 2012 Posted February 14, 2012 If I understand you right you are looking to find programmatically if a workstation has one or two displays. Here you can find a VBS code that lists the serial number of attached monitor(s) - scroll to the bottom of page. You can adapt this code to just return True of False. Regards, Mircea Quote
MSasu Posted February 17, 2012 Posted February 17, 2012 (edited) After investigating the VBA code from above link there is my attempt to translate it into AutoLISP: (defun CountMonitors( / regPath listMonitors device id theType IsMonitor displayCount ) ;registry path that store registred monitors (in use or discontinued) (setq regPath "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\DISPLAY\\") ;gather all registred "display" devices (monitors or other) (setq listMonitors (vl-registry-descendents regPath)) (setq device (car listMonitors)) (setq displayCount 0) ;parse "display" devices (foreach device listMonitors (setq id (vl-registry-descendents (strcat regPath device))) ;get product ID for this device (if id (progn (setq device (strcat regPath device "\\" (car id)) theType (vl-registry-read device "HardwareID")) ;list entries under hardware ID (if (not (listp theType)) (setq theType (list theType))) ;not sure if above key return always a list !!! (setq IsMonitor nil) (foreach val theType ;check if device is a monitor (if (and (equal (type val) 'STR) (wcmatch val "Monitor\\*")) (setq IsMonitor T) ) ) ;if device is a monitor check if is attached (should have a sub-key named "Control") (if IsMonitor (if (member "Control" (vl-registry-descendents device)) (setq displayCount (1+ displayCount)) ;count current monitor ) ) ) ) ) (if (> displayCount 0) (alert (strcat "Your workstation have " (itoa displayCount) " monitor" (if (= displayCount 1) "" "s") "!")) (alert "Unable to detect monitor on this workstation!") ) displayCount ;return number of monitors on workstation ) Unfortunately, I cannot test this on a workstation with 2 monitors until Monday. Regards, Mircea Edited February 18, 2012 by MSasu Small corrections to code 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.