+ Post New Thread
Results 1 to 2 of 2
Scripts Thread, Script to Get Screen Resolution WMI Help! in Coding and Web Development; I am trying to get the screen resolution for a script I am working on; I can get this to ...
  1. #1
    jdell's Avatar
    Join Date
    Mar 2012
    Location
    Swindon
    Posts
    90
    Thank Post
    5
    Thanked 4 Times in 3 Posts
    Rep Power
    6

    Exclamation Script to Get Screen Resolution WMI Help!

    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

    Code:
    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

  2. #2


    Join Date
    Feb 2007
    Location
    51.403651, -0.515458
    Posts
    8,895
    Thank Post
    226
    Thanked 2,674 Times in 1,971 Posts
    Rep Power
    786
    This works for me.

    Code:
    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)

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 3
    Last Post: 24th October 2011, 10:20 AM
  2. Replies: 0
    Last Post: 10th February 2011, 07:57 AM
  3. Replies: 5
    Last Post: 16th December 2007, 06:26 PM
  4. Replies: 2
    Last Post: 14th December 2007, 10:33 AM
  5. Script to get all file on a url
    By Midget in forum Scripts
    Replies: 5
    Last Post: 23rd January 2007, 01:10 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •