Pa Callender Posted August 18, 2006 Share Posted August 18, 2006 I wish to retrieve the state of whether the full display resolution is spanning multiple monitors or one, and if multiple monitors are used, then is it possible to detect the screen resolution of each of them? Thanks in advance. [size="4"]YOU SHALL NOT PARSE!![/size] Link to comment Share on other sites More sharing options...
lod3n Posted August 18, 2006 Share Posted August 18, 2006 This looks like a job for.... WMI! expandcollapse popup; Generated by AutoIt Scriptomatic $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output="" $Output = $Output & "Computer: " & $strComputer & @CRLF $Output = $Output & "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_DesktopMonitor", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Output = $Output & "Availability: " & $objItem.Availability & @CRLF $Output = $Output & "Bandwidth: " & $objItem.Bandwidth & @CRLF $Output = $Output & "Caption: " & $objItem.Caption & @CRLF $Output = $Output & "ConfigManagerErrorCode: " & $objItem.ConfigManagerErrorCode & @CRLF $Output = $Output & "ConfigManagerUserConfig: " & $objItem.ConfigManagerUserConfig & @CRLF $Output = $Output & "CreationClassName: " & $objItem.CreationClassName & @CRLF $Output = $Output & "Description: " & $objItem.Description & @CRLF $Output = $Output & "DeviceID: " & $objItem.DeviceID & @CRLF $Output = $Output & "DisplayType: " & $objItem.DisplayType & @CRLF $Output = $Output & "ErrorCleared: " & $objItem.ErrorCleared & @CRLF $Output = $Output & "ErrorDescription: " & $objItem.ErrorDescription & @CRLF $Output = $Output & "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF $Output = $Output & "IsLocked: " & $objItem.IsLocked & @CRLF $Output = $Output & "LastErrorCode: " & $objItem.LastErrorCode & @CRLF $Output = $Output & "MonitorManufacturer: " & $objItem.MonitorManufacturer & @CRLF $Output = $Output & "MonitorType: " & $objItem.MonitorType & @CRLF $Output = $Output & "Name: " & $objItem.Name & @CRLF $Output = $Output & "PixelsPerXLogicalInch: " & $objItem.PixelsPerXLogicalInch & @CRLF $Output = $Output & "PixelsPerYLogicalInch: " & $objItem.PixelsPerYLogicalInch & @CRLF $Output = $Output & "PNPDeviceID: " & $objItem.PNPDeviceID & @CRLF $strPowerManagementCapabilities = $objItem.PowerManagementCapabilities(0) $Output = $Output & "PowerManagementCapabilities: " & $strPowerManagementCapabilities & @CRLF $Output = $Output & "PowerManagementSupported: " & $objItem.PowerManagementSupported & @CRLF $Output = $Output & "ScreenHeight: " & $objItem.ScreenHeight & @CRLF $Output = $Output & "ScreenWidth: " & $objItem.ScreenWidth & @CRLF $Output = $Output & "Status: " & $objItem.Status & @CRLF $Output = $Output & "StatusInfo: " & $objItem.StatusInfo & @CRLF $Output = $Output & "SystemCreationClassName: " & $objItem.SystemCreationClassName & @CRLF $Output = $Output & "SystemName: " & $objItem.SystemName & @CRLF if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop $Output="" Next Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_DesktopMonitor" ) Endif Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 5, 2) & "/" & _ StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2)) EndFunc [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
lod3n Posted August 18, 2006 Share Posted August 18, 2006 Or this one: expandcollapse popup; Generated by AutoIt Scriptomatic $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output="" $Output = $Output & "Computer: " & $strComputer & @CRLF $Output = $Output & "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_VideoController", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $strAcceleratorCapabilities = $objItem.AcceleratorCapabilities(0) $Output = $Output & "AcceleratorCapabilities: " & $strAcceleratorCapabilities & @CRLF $Output = $Output & "AdapterCompatibility: " & $objItem.AdapterCompatibility & @CRLF $Output = $Output & "AdapterDACType: " & $objItem.AdapterDACType & @CRLF $Output = $Output & "AdapterRAM: " & $objItem.AdapterRAM & @CRLF $Output = $Output & "Availability: " & $objItem.Availability & @CRLF $strCapabilityDescriptions = $objItem.CapabilityDescriptions(0) $Output = $Output & "CapabilityDescriptions: " & $strCapabilityDescriptions & @CRLF $Output = $Output & "Caption: " & $objItem.Caption & @CRLF $Output = $Output & "ColorTableEntries: " & $objItem.ColorTableEntries & @CRLF $Output = $Output & "ConfigManagerErrorCode: " & $objItem.ConfigManagerErrorCode & @CRLF $Output = $Output & "ConfigManagerUserConfig: " & $objItem.ConfigManagerUserConfig & @CRLF $Output = $Output & "CreationClassName: " & $objItem.CreationClassName & @CRLF $Output = $Output & "CurrentBitsPerPixel: " & $objItem.CurrentBitsPerPixel & @CRLF $Output = $Output & "CurrentHorizontalResolution: " & $objItem.CurrentHorizontalResolution & @CRLF $Output = $Output & "CurrentNumberOfColors: " & $objItem.CurrentNumberOfColors & @CRLF $Output = $Output & "CurrentNumberOfColumns: " & $objItem.CurrentNumberOfColumns & @CRLF $Output = $Output & "CurrentNumberOfRows: " & $objItem.CurrentNumberOfRows & @CRLF $Output = $Output & "CurrentRefreshRate: " & $objItem.CurrentRefreshRate & @CRLF $Output = $Output & "CurrentScanMode: " & $objItem.CurrentScanMode & @CRLF $Output = $Output & "CurrentVerticalResolution: " & $objItem.CurrentVerticalResolution & @CRLF $Output = $Output & "Description: " & $objItem.Description & @CRLF $Output = $Output & "DeviceID: " & $objItem.DeviceID & @CRLF $Output = $Output & "DeviceSpecificPens: " & $objItem.DeviceSpecificPens & @CRLF $Output = $Output & "DitherType: " & $objItem.DitherType & @CRLF $Output = $Output & "DriverDate: " & WMIDateStringToDate($objItem.DriverDate) & @CRLF $Output = $Output & "DriverVersion: " & $objItem.DriverVersion & @CRLF $Output = $Output & "ErrorCleared: " & $objItem.ErrorCleared & @CRLF $Output = $Output & "ErrorDescription: " & $objItem.ErrorDescription & @CRLF $Output = $Output & "ICMIntent: " & $objItem.ICMIntent & @CRLF $Output = $Output & "ICMMethod: " & $objItem.ICMMethod & @CRLF $Output = $Output & "InfFilename: " & $objItem.InfFilename & @CRLF $Output = $Output & "InfSection: " & $objItem.InfSection & @CRLF $Output = $Output & "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF $Output = $Output & "InstalledDisplayDrivers: " & $objItem.InstalledDisplayDrivers & @CRLF $Output = $Output & "LastErrorCode: " & $objItem.LastErrorCode & @CRLF $Output = $Output & "MaxMemorySupported: " & $objItem.MaxMemorySupported & @CRLF $Output = $Output & "MaxNumberControlled: " & $objItem.MaxNumberControlled & @CRLF $Output = $Output & "MaxRefreshRate: " & $objItem.MaxRefreshRate & @CRLF $Output = $Output & "MinRefreshRate: " & $objItem.MinRefreshRate & @CRLF $Output = $Output & "Monochrome: " & $objItem.Monochrome & @CRLF $Output = $Output & "Name: " & $objItem.Name & @CRLF $Output = $Output & "NumberOfColorPlanes: " & $objItem.NumberOfColorPlanes & @CRLF $Output = $Output & "NumberOfVideoPages: " & $objItem.NumberOfVideoPages & @CRLF $Output = $Output & "PNPDeviceID: " & $objItem.PNPDeviceID & @CRLF $strPowerManagementCapabilities = $objItem.PowerManagementCapabilities(0) $Output = $Output & "PowerManagementCapabilities: " & $strPowerManagementCapabilities & @CRLF $Output = $Output & "PowerManagementSupported: " & $objItem.PowerManagementSupported & @CRLF $Output = $Output & "ProtocolSupported: " & $objItem.ProtocolSupported & @CRLF $Output = $Output & "ReservedSystemPaletteEntries: " & $objItem.ReservedSystemPaletteEntries & @CRLF $Output = $Output & "SpecificationVersion: " & $objItem.SpecificationVersion & @CRLF $Output = $Output & "Status: " & $objItem.Status & @CRLF $Output = $Output & "StatusInfo: " & $objItem.StatusInfo & @CRLF $Output = $Output & "SystemCreationClassName: " & $objItem.SystemCreationClassName & @CRLF $Output = $Output & "SystemName: " & $objItem.SystemName & @CRLF $Output = $Output & "SystemPaletteEntries: " & $objItem.SystemPaletteEntries & @CRLF $Output = $Output & "TimeOfLastReset: " & WMIDateStringToDate($objItem.TimeOfLastReset) & @CRLF $Output = $Output & "VideoArchitecture: " & $objItem.VideoArchitecture & @CRLF $Output = $Output & "VideoMemoryType: " & $objItem.VideoMemoryType & @CRLF $Output = $Output & "VideoMode: " & $objItem.VideoMode & @CRLF $Output = $Output & "VideoModeDescription: " & $objItem.VideoModeDescription & @CRLF $Output = $Output & "VideoProcessor: " & $objItem.VideoProcessor & @CRLF if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop $Output="" Next Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_VideoController" ) Endif Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 5, 2) & "/" & _ StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2)) EndFunc [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
Pa Callender Posted August 18, 2006 Author Share Posted August 18, 2006 Thanks - will test [size="4"]YOU SHALL NOT PARSE!![/size] Link to comment Share on other sites More sharing options...
Pa Callender Posted August 18, 2006 Author Share Posted August 18, 2006 Looks good - will morph the script to suit my needs. Many thanks. I wouldn't know directly about this because mainly I script for computers without WMI (e.g. 9x PCs), but this one will majorly be used on XP. Thanks. [size="4"]YOU SHALL NOT PARSE!![/size] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now