Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 148
  • Last Modified:

Windows Scripting, determing the screen area settings with vbscript.

How do I determine the screen area settings using vbscript. I want copy a shortcut from a central location based on the screen area.
0
mdavisba
Asked:
mdavisba
  • 2
  • 2
1 Solution
 
ColosseoCommented:
Hi

to get the screen width and height you could use

Set oWMIService = GetObject( "winmgmts://./root/cimv2" )
Set oItems = oWMIService.ExecQuery( "Select * from Win32_DisplayConfiguration", , 48 )

  ' Get width and height
  For Each oItem in oItems
      str_Width = oItem.PelsWidth
      str_Height = oItem.PelsHeight
  Next

  ' Display width and height
  Msgbox "Width: " & str_Width & " height: " & str_Height

' Tidyup
Set oItems = Nothing
Set oWMIService = Nothing

HTH

Regards

Scott
0
 
mdavisbaAuthor Commented:
Thanks Scott,

I worked out a less reliable method, this way works a lot faster.

I am trying copy a shortcut to the desktop, however, the script does not have enough permissions. Any Ideas?
0
 
ColosseoCommented:
Hi Mdavisba

Sorry its been a while I must have missed you comment.

Are you still having problems creating the shortcut?

Cheers

Scott
0
 
mdavisbaAuthor Commented:
In the end I did not need to create the shortcut, all I needed to do is the script to determine the screen size and then run an application with appropriate switches.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now