Jump to content
EduGeek EdSec 2026 is Go! 27th Oct in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

Recommended Posts

Posted

I am trying to get the screen resolution for a script I am working on;

 

I can get this to output Video Resoultion: xxxx X xxxx X Number of colours. I want to store the output of objitem.videomodedescription as a variable so I can remove the colours to use in my script later on, the line Resoultion= objItem.VideoModeDescription does not work or at least when I call the variable it does show anything, any ideas.

 

Thanks

 

strComputer = "."
dim Resoultion
Set objWMIService = GetObject(_
   "winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery(_
   "Select * from Win32_VideoController")
For Each objItem in colItems
   Wscript.Echo "Video Resoultion: " _
       & objItem.VideoModeDescription
	Resoultion= objItem.VideoModeDescription
Next

Posted

This works for me.

 

ScreenRes = funcScreenResolution() 

Function funcScreenResolution() 
   Set objIE = CreateObject("InternetExplorer.Application") 
   objIE.Navigate("about:blank") 
   Do Until objIE.readyState = 4: Loop 
       width = objIE.document.ParentWindow.screen.width 
       height = objIE.document.ParentWindow.screen.height 
   objIE.Quit 
   funcScreenResolution = array(width,height) 
End Function 

wscript.Echo ScreenRes(0) & " x " & ScreenRes(1)

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...