Skip to content

Instantly share code, notes, and snippets.

@imniko
Created February 2, 2023 14:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imniko/0314e4d357a30b1bf84fe8e4fbf36703 to your computer and use it in GitHub Desktop.
Save imniko/0314e4d357a30b1bf84fe8e4fbf36703 to your computer and use it in GitHub Desktop.
Sample AHK script to change windows display scaling using https://github.com/imniko/SetDPI, compatible with AHK version 2.x
#Requires AutoHotkey v2.0
current_scale := 100 ; scale value you are currently in
next_scale := 125 ; scale value you want to switch to next
is_scaled := 0
; Ctrl + Win + F1 toggles main monitor between 2 scale values
^#F1::
{
global is_scaled
global next_scale
global current_scale
if(is_scaled == 0)
{
Run "SetDpi.exe " next_scale
}
else
{
Run "SetDpi.exe " current_scale
}
is_scaled := !is_scaled
}
; Ctrl + Win + F2 sets 2nd monitor to a scale of 150
^#F2::
{
Run "SetDpi.exe 150 2"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment