Solved

Windows Scripting, determing the screen area settings with vbscript.

Posted on 2004-08-19
4
124 Views
Last Modified: 2010-04-13
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
Comment
Question by:mdavisba
  • 2
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
Colosseo earned 125 total points
Comment Utility
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
 

Author Comment

by:mdavisba
Comment Utility
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
 
LVL 15

Expert Comment

by:Colosseo
Comment Utility
Hi Mdavisba

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

Are you still having problems creating the shortcut?

Cheers

Scott
0
 

Author Comment

by:mdavisba
Comment Utility
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

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Suggested Solutions

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now