Get Screen Resolution for use in VBS Login Script

I am running a login script (XP) that changes the default wallpaper to the user's custom wallpaper.  After getting it ready to deploy, I discovered that the use of high-res bitmaps on lower-res monitors looks terrible.  So, I have created a lower-res wallpaper for this purpose.  Now I need to write my login script to check the screen resolution and then set the wallpaper accordingly.

I searched the web and EE for this solution, but wasn't too successful.  I found a key that appears to store the screen resolution, but when I try to read it with .regread, it fails.  Here is the code that is failing:

wshShell.RegRead ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Hardware Profiles\0001\System\CurrentControlSet\Control\VIDEO\{19E5EBEB-9F36-42E3-86C1-E032FB21EA07}\0000"))

So, the question is:  where in the registry is the screen resolution stored, and what is the best way to retrieve it using a VBS file?
ddotsonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shane Russell2nd Line Desktop SupportCommented:
This is what I have found :

==================================

How do I change screen resolution or wallpaper?
Screen resolution cannot be changed from WSH.  Here are some workarounds, almost entirely taken from Torgeir Bakken's responses on this topic.
 
  Use Multires (which is free)
  http://www.entechtaiwan.com/multires.htm
 
  Here's a reference to doing it via Java
  http://home.istar.ca/~neutron/JDirect/DisplaySettings/ 

It should also be possible to do this using the ChangeDisplaySettings API, but you would need to write a component to access it.
 
  Win9x clients running the QuickRes powertoy can run a shell command like this:
  RunDLL deskcp16.dll,QUICKRES_RUNDLLENTRY 1280x1024x24
 
 FINDING the screen resolution is possible, albeit not "natively" - here's a quick script that will give you current screen resolution via Internet Explorer:

with createobject("internetexplorer.application")
    .navigate "about:blank"
    with .document.parentWindow.screen
      msgbox .width & " by " & .height
    end with
  end with
Wallpaper can be modified in the registry; unfortunately, changes don't take place until you refresh, either by logoff/logon or by manually refreshing the desktop.
 The relevant registry key is HKCU\Control Panel\Desktop\Wallpaper.  To see an example script of copying wallpaper and changing it, see:
 
 http://groups.google.com/groups?selm=uFMs1Zq1AHA.2092%40tkmsftngp05

===================================

I got that from this site :

http://www.mvps.org/scripting/faq/wshfaq.htm

I hope this helps some what :)

If I find anything else of use I will post back
Shane Russell2nd Line Desktop SupportCommented:
I appolgise for my last post !!

I found this :

Set WSHShell = WScript.CreateObject("WScript.Shell")
set objSysInfo = Wscript.CreateObject("SYSINFO.Sysinfo")

wscript.echo objSysInfo.WorkAreaHeight
wscript.echo objSysInfo.WorkAreaWidth

Only thing is, is that I think it returns it in twips and not pixels so I am currently trying to figure out how to convert it into pixels :)

Unless that is ok for you ?
ddotsonAuthor Commented:
Thanks for the correction.  I also found that script.  Here's the error I get:

Could not locate automation class "Sysinfo.sysinfo"
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

Shane Russell2nd Line Desktop SupportCommented:
Here is the site I got it from :

http://groups.msn.com/windowsscript/wshgeneralquestions.msnw?action=view_list&row=28&viewtype=2&sortstring=

On there it says it uses sysinfo.ocx

So maybe you need to download sysinfo.ocx and register it and try to use that vbscript again.

You can download it from here :

http://www.dynamiclink.nl/htmfiles/rframes/info_ocx/info_s/44.htm

However your best option would be to download the vb 6 runtime files because it is included in there.

http://www.microsoft.com/downloads/details.aspx?familyid=7b9ba261-7a9c-43e7-9117-f673077ffb3c&displaylang=en

I hope this helps some what.
Shane Russell2nd Line Desktop SupportCommented:
I found this way :

screen = ScreenResolution
WScript.Echo screen(0),screen(1)

Function ScreenResolution()
Set oIE = CreateObject("InternetExplorer.Application")
With oIE
.Navigate("about:blank")
Do Until .readyState = 4: wscript.sleep 100: Loop
width = .document.ParentWindow.screen.width
height = .document.ParentWindow.screen.height
End With
oIE.Quit
ScreenResolution = array(width,height)
End Function

from this site :

http://www.mvps.org/scripting/rube/

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ddotsonAuthor Commented:
This worked great.  I was worried that it wasn't a very elegant solution, but it ran very quick, and got the information I needed!  Thanks!
Shane Russell2nd Line Desktop SupportCommented:
Your welcome ! I was glad I could help you out and thanks for the grade and points.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.