I'm trying to find/write a script (existing script is a batch file, although if VBS I could always call it within batch file) that can detect if the current screen resolution is a widescreen format, so that I can copy the appropriate background image to the machine. I've only found a couple posts with the same code, and as one reply said that you can always just set the image to be stretched. But that would mean that the image could be distorted (as others have said as well).
I found the following VBScript from this post, although it only seems to work on Windows XP (although I haven't tried Windows 7 32-bit). In Windows 7 64 it just echos the asterick.
Set objWMIService = GetObject("Winmgmts:\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor where DeviceID = 'DesktopMonitor1'",,0)
For Each objItem in colItems
intHorizontal = objItem.ScreenWidth
intVertical = objItem.ScreenHeight
Next
msgbox intHorizontal & " * " & intVertical
But even if I could get this script to work, I would still have to have multiple IF's to match the Horizontal & Vertical to a list of widescreen resolutions. Unless there's a math equation that I can use (which I'm sure there is). But regardless, I need a script that will work for both XP and 7 (32 & 64), or if need be, two scripts for each OS or architecture.
Thanks in advance,
Brian