A new one with a graphic user interface window.
Code: Select all
; Unfortunately the script will not work if you use custom scaling (outside the drop-down values in display settings)
;paste this in the top address bar in your registry editor (it's always a good idea to make a backup in case you make any accidental changes
;HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings
;the monitor names will be folders under "PerMonitorSettings"
Monitor1Name := "LEN83900_00_07E5_39^2D4D23CBBB78410E152B60B08CE46715"
Monitor2Name := "LEN83910_00_07E5_23^2029384D70426D1FF5953C0B5EB562BB"
Monitor3Name := "PHLC18F1097_32_07E3_40^4203C09ED432516E76A46CD977B6C28C"
Monitor4Name := "SAM0FEE16780800_01_07E3_F3^64851249ACBD1ABA606D845F0AE08F5E"
Monitor5Name := "SAM0FEF16780800_01_07E3_F3^64CB94CC5380AAB18A1AD60DA6AEB890" ; Sam TV M
DPI_100_M1 := 4294967292
DPI_150_M1 := 4294967294
DPI_175_M1 := 4294967295
DPI_200_M1 := 0
DPI_225_M1 := 1
DPI_250_M1 := 3
;DPI_300_M1 := ; Define your DPI_300_M1 value here
;DPI_125_M1 := ; Define your DPI_125_M1 value here
DPI_100_M2 := 4294967292
DPI_150_M2 := 4294967294
DPI_175_M2 := 4294967295
DPI_200_M2 := 0
DPI_225_M2 := 1
DPI_250_M2 := 2
;DPI_300_M2 := ; Define your DPI_300_M2 value here
;DPI_125_M2 := ; Define your DPI_125_M2 value here
DPI_100_M3 := 4294967294
DPI_150_M3 := 0
DPI_175_M3 := 1
DPI_200_M3 := 2
DPI_225_M3 := 3
DPI_250_M3 := 4
;DPI_300_M3 := ; Define your DPI_300_M3 value here
;DPI_125_M3 := ; Define your DPI_125_M3 value here
DPI_100_M4 := 4294967294
DPI_150_M4 := 0
DPI_175_M4 := 1
DPI_200_M4 := 2
DPI_225_M4 := 3
DPI_250_M4 := 4
;DPI_300_M4 := ; Define your DPI_300_M4 value here
;DPI_125_M4 := ; Define your DPI_125_M4 value here
;DPI_100_M5 := ; Define your DPI_100_M5 value here
DPI_150_M5 := 4294967291
DPI_175_M5 := 4294967292
DPI_200_M5 := 4294967293
DPI_225_M5 := 4294967294
DPI_250_M5 := 4294967295
DPI_300_M5 := 0
;DPI_125_M5 := ; Define your DPI_125_M5 value here
#Persistent ; Make the script run continuously
; This needs to be outside the Gui code
Return
GuiEscape:
Gui, Cancel
return
#^+D:: ; Define a hotkey to trigger the DPI scaling change
Gui, Destroy ; This needs to be on the first line to avoid the error
; Start from y70
Gui, Add, Text, x10 y70, Choose DPI scale:
Gui, Add, Button, x10 y100 w120 h30, 100
Gui, Add, Button, x140 y100 w120 h30, 125
Gui, Add, Button, x10 y130 w120 h30, 150
Gui, Add, Button, x140 y130 w120 h30, 175
Gui, Add, Button, x10 y160 w120 h30, 200
Gui, Add, Button, x140 y160 w120 h30, 225
Gui, Add, Button, x10 y190 w120 h30, 250
Gui, Add, Button, x140 y190 w120 h30, 300
Gui, Add, Text, x10 y230, Select Monitors
Gui, Add, Checkbox, x10 y260 checked vMonitor1Checked, Monitor 1 YB9
Gui, Add, Checkbox, x140 y260 checked vMonitor2Checked, Monitor 2 YB9
Gui, Add, Checkbox, x10 y290 vMonitor3Checked, Monitor 3 Philips
Gui, Add, Checkbox, x140 y290 vMonitor4Checked, Monitor 4 VGA
Gui, Add, Checkbox, x10 y320 vMonitor5Checked, Monitor 5 TV
Gui, Add, Text, x10 y360, Change Primary Monitor
Gui, Add, Button, x10 y390 w120 h30 gMakePrimaryMonitor1, Display 1
Gui, Add, Button, x140 y390 w120 h30 gMakePrimaryMonitor2, Display 2
Gui, Add, Button, x10 y420 w120 h30 gMakePrimaryMonitor3, Display 3
Gui, Add, Button, x140 y420 w120 h30 gMakePrimaryMonitor4, Display 4
RegRead, RegReadM1DpiValue, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor1Name%, DpiValue
RegRead, RegReadM2DpiValue, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor2Name%, DpiValue
RegRead, RegReadM3DpiValue, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor3Name%, DpiValue
RegRead, RegReadM4DpiValue, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor4Name%, DpiValue
RegRead, RegReadM5DpiValue, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor5Name%, DpiValue
TranslateDPIM1andM2(RegReadM1DpiValue, translatedRegReadM1DpiValue)
TranslateDPIM1andM2(RegReadM2DpiValue, translatedRegReadM2DpiValue)
TranslateDPIM3(RegReadM3DpiValue, translatedRegReadM3DpiValue)
TranslateDPIM5(RegReadM5DpiValue, translatedRegReadM5DpiValue)
Gui, Add, Text, x10 y10 h20 vDPIM1RegRead, M1 DPI: %translatedRegReadM1DpiValue%
Gui, Add, Text, x150 y10 h20 vDPIM2RegRead, M2 DPI: %translatedRegReadM2DpiValue%
Gui, Add, Text, x10 y40 h20 vDPIM3RegRead, M3 DPI: %translatedRegReadM3DpiValue%
Gui, Add, Text, x150 y40 h20 vDPIM5RegRead, M5 DPI: %translatedRegReadM5DpiValue%
Gui, Show, , DPI scale ; This is the name of the GUI Window
Gui, +AlwaysOnTop
Return
MakePrimaryMonitor1:
{
Gui, Submit, NoHide
Run, nircmd setprimarydisplay 1
Return
}
MakePrimaryMonitor2:
{
Gui, Submit, NoHide
Run, nircmd setprimarydisplay 2
Return
}
MakePrimaryMonitor3:
{
Gui, Submit, NoHide
Run, nircmd setprimarydisplay 3
Return
}
MakePrimaryMonitor4:
{
Gui, Submit, NoHide
Run, nircmd setprimarydisplay 4
Return
}
Button100:
{
Gui, Submit, NoHide
if (Monitor1Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor1Name%, DpiValue, %DPI_100_M1%
}
else if (Monitor2Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor2Name%, DpiValue, %DPI_100_M2%
}
else if (Monitor3Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor3Name%, DpiValue, %DPI_100_M3%
}
else if (Monitor4Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor4Name%, DpiValue, %DPI_100_M4%
}
else if (Monitor5Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor5Name%, DpiValue, %DPI_100_M5%
}
UpdateScale(32)
Sleep, 2000
Gui Destroy
Return
}
Button150:
{
Gui, Submit, NoHide
if (Monitor1Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor1Name%, DpiValue, %DPI_150_M1%
}
else if (Monitor2Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor2Name%, DpiValue, %DPI_150_M2%
}
else if (Monitor3Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor3Name%, DpiValue, %DPI_150_M3%
}
else if (Monitor4Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor4Name%, DpiValue, %DPI_150_M4%
}
else if (Monitor5Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor5Name%, DpiValue, %DPI_150_M5%
}
UpdateScale(32)
Sleep, 2000
Gui Destroy
Return
}
Button175:
{
Gui, Submit, NoHide
if (Monitor1Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor1Name%, DpiValue, %DPI_175_M1%
}
else if (Monitor2Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor2Name%, DpiValue, %DPI_175_M2%
}
else if (Monitor3Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor3Name%, DpiValue, %DPI_175_M3%
}
else if (Monitor4Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor4Name%, DpiValue, %DPI_175_M4%
}
else if (Monitor5Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor5Name%, DpiValue, %DPI_175_M5%
}
UpdateScale(32)
Sleep, 2000
Gui Destroy
Return
}
Button200:
{
Gui, Submit, NoHide
if (Monitor1Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor1Name%, DpiValue, %DPI_200_M1%
}
else if (Monitor2Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor2Name%, DpiValue, %DPI_200_M2%
}
else if (Monitor3Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor3Name%, DpiValue, %DPI_200_M3%
}
else if (Monitor4Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor4Name%, DpiValue, %DPI_200_M4%
}
else if (Monitor5Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor5Name%, DpiValue, %DPI_200_M5%
}
UpdateScale(32)
Sleep, 2000
Gui Destroy
Return
}
Button225:
{
Gui, Submit, NoHide
if (Monitor1Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor1Name%, DpiValue, %DPI_225_M1%
}
else if (Monitor2Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor2Name%, DpiValue, %DPI_225_M2%
}
else if (Monitor3Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor3Name%, DpiValue, %DPI_225_M3%
}
else if (Monitor4Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor4Name%, DpiValue, %DPI_225_M4%
}
else if (Monitor5Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor5Name%, DpiValue, %DPI_225_M5%
}
UpdateScale(32)
Sleep, 2000
Gui Destroy
Return
}
Button250:
{
Gui, Submit, NoHide
if (Monitor1Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor1Name%, DpiValue, %DPI_250_M1%
}
else if (Monitor2Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor2Name%, DpiValue, %DPI_250_M2%
}
else if (Monitor3Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor3Name%, DpiValue, %DPI_250_M3%
}
else if (Monitor4Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor4Name%, DpiValue, %DPI_250_M4%
}
else if (Monitor5Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor5Name%, DpiValue, %DPI_250_M5%
}
UpdateScale(32)
Sleep, 2000
Gui Destroy
Return
}
Button125:
{
Gui, Submit, NoHide
if (Monitor1Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor1Name%, DpiValue, %DPI_125_M1%
}
else if (Monitor2Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor2Name%, DpiValue, %DPI_125_M2%
}
else if (Monitor3Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor3Name%, DpiValue, %DPI_125_M3%
}
else if (Monitor4Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor4Name%, DpiValue, %DPI_125_M4%
}
else if (Monitor5Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor5Name%, DpiValue, %DPI_125_M5%
}
UpdateScale(32)
Sleep, 2000
Gui Destroy
Return
}
Button300:
{
Gui, Submit, NoHide
if (Monitor1Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor1Name%, DpiValue, %DPI_300_M1%
}
else if (Monitor2Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor2Name%, DpiValue, %DPI_300_M2%
}
else if (Monitor3Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor3Name%, DpiValue, %DPI_300_M3%
}
else if (Monitor4Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor4Name%, DpiValue, %DPI_300_M4%
}
else if (Monitor5Checked = 1)
{
RegWrite, REG_DWORD, HKEY_CURRENT_USER\Control Panel\Desktop\PerMonitorSettings\%Monitor5Name%, DpiValue, %DPI_300_M5%
}
UpdateScale(32)
Sleep, 2000
Gui Destroy
Return
}
UpdateScale(Color_Depth) {
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)
Return DllCall("ChangeDisplaySettingsA", UInt, &Device_Mode, UInt, 0)
}
Return
; Translate function to map raw DPI values to readable values
TranslateDPIM1andM2(rawDPI, ByRef translatedDPI) {
if (rawDPI = 4294967294)
translatedDPI := "150"
else if (rawDPI = 4294967295)
translatedDPI := "175"
else if (rawDPI = 0)
translatedDPI := "200"
else if (rawDPI = 1)
translatedDPI := "225"
else if (rawDPI = 2)
translatedDPI := "225"
else if (rawDPI = 3)
translatedDPI := "250"
else if (rawDPI = 4294967292)
translatedDPI := "100"
}
Return
; Translate function to map raw DPI values to readable values
TranslateDPIM3(rawDPI, ByRef translatedDPI) {
if (rawDPI = 4294967292)
translatedDPI := "100"
else if (rawDPI = 0)
translatedDPI := "150"
else if (rawDPI = 1)
translatedDPI := "175"
else if (rawDPI = 2)
translatedDPI := "200"
else if (rawDPI = 3)
translatedDPI := "225"
else if (rawDPI = 4)
translatedDPI := "250"
}
Return
; Translate function to map raw DPI values to readable values
TranslateDPIM5(rawDPI, ByRef translatedDPI) {
if (rawDPI = 4294967290)
translatedDPI := "100"
else if (rawDPI = 4294967291)
translatedDPI := "150"
else if (rawDPI = 4294967292)
translatedDPI := "175"
else if (rawDPI = 4294967293)
translatedDPI := "200"
else if (rawDPI = 4294967294)
translatedDPI := "225"
else if (rawDPI = 4294967295)
translatedDPI := "250"
else if (rawDPI = 0)
translatedDPI := "300"
}
Return