Shortcut to change Screen Resolution

  • Thread starter Thread starter Eustace
  • Start date Start date
E

Eustace

I would like to be able to toggle between Screen Resolution 1280x800 and
800x600 be clicking a shortcut. I suppose I need another VBScript Jon,
right?
 
Thanks, but it is not exactly what I need... First of all it does not
have the 1280x800 resolution that I normally use (while it contains
640x480 that is not available), so I would have to restore it through
the normal procedure. Also, its 800x600 resolution shows things much
larger then when I apply it the normal way. Besides, though it saves a
couple of clicks, a shortcut to toggle between the 2 specific
resolutions would simplify things a lot...
 
Hi Eustace

This toggle script makes use of an external program QRes.exe (freeware) to
do the actual screen resolution changing. It needs to be placed in the same
folder as the script, or alternatively, somewhere in your 'path' eg
c:\windows.

You can currently download QRes.exe from here
http://www.snapfiles.com/get/qres.html

Change lines 2 & 3 of the script accordingly, to put in the resolutions, of
your choosing - in the same format as the ones shown eg "800 x 600". I
haven't tested it with the particular resolutions you suggested.
NB Be very careful which particular resolutions you choose, ie ones that
your monitor / graphics card can definitely handle - otherwise you'll end up
doing a safe mode system restore [or putting a link to a modified script in
your startup folder to get things back to normal (as I did just now when
experimenting :-) )]

Again watch out for wordwrap. Let me know if it works ok.

Jon

'***************************************************************
'Toggles resolutions between the following settings
res1= "800 x 600"
res2= "1024 x 768"


'Initialization
set WshShell = WScript.CreateObject("WScript.Shell")

'Process the resolutions
res1=trim(lcase(res1))
res2=trim(lcase(res2))

xres1=trim(left(res1,instrrev(res1,"x")-1))
yres1=trim(mid(res1,instrrev(res1,"x")+1))
xres2=trim(left(res2,instrrev(res2,"x")-1))
yres2=trim(mid(res2,instrrev(res2,"x")+1))


'Get current resolution
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * From Win32_DisplayConfiguration")

For Each objItem in colItems

currentXRes = trim(objItem.PelsWidth)
currentYRes = trim(objItem.PelsHeight)
Next


'Decide which resolution to set
if (currentXRes = xres1) and (currentYRes = yres1) then
xres = xres2 : yres = yres2
else
xres = xres1 : yres = yres1
end if

'Run the command to set the resolution
runstring = "cmd /c " & chr(34) & "qres.exe /x:" & xres & " /y:" & yres &
chr(34)
wshshell.run runstring,0
'**********************************************************************
 
Attached script in case of word wrap

Jon

Jon said:
Hi Eustace

This toggle script makes use of an external program QRes.exe (freeware) to
do the actual screen resolution changing. It needs to be placed in the
same folder as the script, or alternatively, somewhere in your 'path' eg
c:\windows.

You can currently download QRes.exe from here
http://www.snapfiles.com/get/qres.html

Change lines 2 & 3 of the script accordingly, to put in the resolutions,
of your choosing - in the same format as the ones shown eg "800 x 600". I
haven't tested it with the particular resolutions you suggested.
NB Be very careful which particular resolutions you choose, ie ones that
your monitor / graphics card can definitely handle - otherwise you'll end
up doing a safe mode system restore [or putting a link to a modified
script in your startup folder to get things back to normal (as I did just
now when experimenting :-) )]

Again watch out for wordwrap. Let me know if it works ok.

Jon

'***************************************************************
'Toggles resolutions between the following settings
res1= "800 x 600"
res2= "1024 x 768"


'Initialization
set WshShell = WScript.CreateObject("WScript.Shell")

'Process the resolutions
res1=trim(lcase(res1))
res2=trim(lcase(res2))

xres1=trim(left(res1,instrrev(res1,"x")-1))
yres1=trim(mid(res1,instrrev(res1,"x")+1))
xres2=trim(left(res2,instrrev(res2,"x")-1))
yres2=trim(mid(res2,instrrev(res2,"x")+1))


'Get current resolution
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * From Win32_DisplayConfiguration")

For Each objItem in colItems

currentXRes = trim(objItem.PelsWidth)
currentYRes = trim(objItem.PelsHeight)
Next


'Decide which resolution to set
if (currentXRes = xres1) and (currentYRes = yres1) then
xres = xres2 : yres = yres2
else
xres = xres1 : yres = yres1
end if

'Run the command to set the resolution
runstring = "cmd /c " & chr(34) & "qres.exe /x:" & xres & " /y:" & yres &
chr(34)
wshshell.run runstring,0
'**********************************************************************


Eustace said:
Thanks, but it is not exactly what I need... First of all it does not
have the 1280x800 resolution that I normally use (while it contains
640x480 that is not available), so I would have to restore it through the
normal procedure. Also, its 800x600 resolution shows things much larger
then when I apply it the normal way. Besides, though it saves a couple of
clicks, a shortcut to toggle between the 2 specific resolutions would
simplify things a lot...
 
NB "Chr(34)" [ second from last line] should be on the same line as the
"runstring =...." line

Jon


Jon said:
Hi Eustace

This toggle script makes use of an external program QRes.exe (freeware) to
do the actual screen resolution changing. It needs to be placed in the
same folder as the script, or alternatively, somewhere in your 'path' eg
c:\windows.

You can currently download QRes.exe from here
http://www.snapfiles.com/get/qres.html

Change lines 2 & 3 of the script accordingly, to put in the resolutions,
of your choosing - in the same format as the ones shown eg "800 x 600". I
haven't tested it with the particular resolutions you suggested.
NB Be very careful which particular resolutions you choose, ie ones that
your monitor / graphics card can definitely handle - otherwise you'll end
up doing a safe mode system restore [or putting a link to a modified
script in your startup folder to get things back to normal (as I did just
now when experimenting :-) )]

Again watch out for wordwrap. Let me know if it works ok.

Jon

'***************************************************************
'Toggles resolutions between the following settings
res1= "800 x 600"
res2= "1024 x 768"


'Initialization
set WshShell = WScript.CreateObject("WScript.Shell")

'Process the resolutions
res1=trim(lcase(res1))
res2=trim(lcase(res2))

xres1=trim(left(res1,instrrev(res1,"x")-1))
yres1=trim(mid(res1,instrrev(res1,"x")+1))
xres2=trim(left(res2,instrrev(res2,"x")-1))
yres2=trim(mid(res2,instrrev(res2,"x")+1))


'Get current resolution
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * From Win32_DisplayConfiguration")

For Each objItem in colItems

currentXRes = trim(objItem.PelsWidth)
currentYRes = trim(objItem.PelsHeight)
Next


'Decide which resolution to set
if (currentXRes = xres1) and (currentYRes = yres1) then
xres = xres2 : yres = yres2
else
xres = xres1 : yres = yres1
end if

'Run the command to set the resolution
runstring = "cmd /c " & chr(34) & "qres.exe /x:" & xres & " /y:" & yres &
chr(34)
wshshell.run runstring,0
'**********************************************************************


Eustace said:
Thanks, but it is not exactly what I need... First of all it does not
have the 1280x800 resolution that I normally use (while it contains
640x480 that is not available), so I would have to restore it through the
normal procedure. Also, its 800x600 resolution shows things much larger
then when I apply it the normal way. Besides, though it saves a couple of
clicks, a shortcut to toggle between the 2 specific resolutions would
simplify things a lot...
 
Back
Top