Last active
June 7, 2023 09:04
-
-
Save ReinforceZwei/280ef263a4588343ae1af437e3065869 to your computer and use it in GitHub Desktop.
Custom AHK script to one-click switch monitor input source and display scaling, using Nirsoft Control My Monitor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires AutoHotkey v2.0 | |
SWITCH_INPUT := 17 | |
LAPTOP_INPUT := 15 | |
SCALE_16_9_VALUE := 20 | |
CODE_INPUT_SELECT := 60 | |
CODE_SCALING := 86 | |
CTRL_MON_EXE := "controlmymonitor.exe" | |
; Monitor short name | |
MON_NAME := "AOCB306" | |
!F11:: | |
{ | |
; Get current input source | |
returnValue := RunWait(format("{} /GetValue {} {}", CTRL_MON_EXE, MON_NAME, CODE_INPUT_SELECT)) | |
; Check if the return value is equal to 15 | |
If (returnValue = LAPTOP_INPUT) { | |
; Switch input source to "Switch" | |
RunWait(format("{} /SetValue {} {} {}", CTRL_MON_EXE, MON_NAME, CODE_INPUT_SELECT, SWITCH_INPUT)) | |
Sleep 5000 | |
; Set display scaling to 16:9 | |
RunWait(format("{} /SetValue {} {} {}", CTRL_MON_EXE, MON_NAME, CODE_SCALING, SCALE_16_9_VALUE)) | |
} Else { | |
; Switch input source to laptop | |
RunWait(format("{} /SetValue {} {} {}", CTRL_MON_EXE, MON_NAME, CODE_INPUT_SELECT, LAPTOP_INPUT)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment