Change display resolution and scaling
Posted: 02 Jul 2019, 07:38
Hi everyone. I'm using the script below to quickly switch my Surface Book 2 display's resolution from 3240x2160 to 1620x1080 and back, with Win+Alt+PgDn and Win+Alt+PgUp. Can you please help me to also switch from 200% scaling to 100% with this?
I have almost zero experience with scripts and coding in general: I just found this script online and replaced the hotkeys.
I've added the custom 1620x1080 resolution with CRU (Custom Resolution Utility) tool.
The main reason I'm using this is gaming: I'm using full resolution when working, but I switch to half resolution when gaming to increase performance. This script saves me a lot of clicks through Display settings.
What I want the script to do:
- Press Win+Alt+PgDn to set main display resolution to 1620x1080 and scaling to 100%.
- Press Win+Alt+PgUp to set main display resolution to 3240x2160 and scaling to 200%.
System info: MS Surface Book 2 15, Windows 10. I'm not using any external monitors.
Thank you!
I have almost zero experience with scripts and coding in general: I just found this script online and replaced the hotkeys.
I've added the custom 1620x1080 resolution with CRU (Custom Resolution Utility) tool.
The main reason I'm using this is gaming: I'm using full resolution when working, but I switch to half resolution when gaming to increase performance. This script saves me a lot of clicks through Display settings.
What I want the script to do:
- Press Win+Alt+PgDn to set main display resolution to 1620x1080 and scaling to 100%.
- Press Win+Alt+PgUp to set main display resolution to 3240x2160 and scaling to 200%.
System info: MS Surface Book 2 15, Windows 10. I'm not using any external monitors.
Thank you!
Code: Select all
!#PgDn::
ChangeResolution(1620, 1080)
Return
!#PgUp::
ChangeResolution(3240, 2160)
Return
ChangeResolution(Screen_Width := 3240, Screen_Height := 2160, Color_Depth := 32)
{
VarSetCapacity(Device_Mode,156,0)
NumPut(156,Device_Mode,36)
DllCall( "EnumDisplaySettingsA", UInt,0, UInt,-1, UInt,&Device_Mode )
NumPut(0x5c0000,Device_Mode,40)
NumPut(Color_Depth,Device_Mode,104)
NumPut(Screen_Width,Device_Mode,108)
NumPut(Screen_Height,Device_Mode,112)
Return DllCall( "ChangeDisplaySettingsA", UInt,&Device_Mode, UInt,0 )
}
Return