Skip to content

Instantly share code, notes, and snippets.

@moshen
Last active April 14, 2022 13:18
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moshen/4f1dd74229f27f07ab3290c483c96501 to your computer and use it in GitHub Desktop.
Save moshen/4f1dd74229f27f07ab3290c483c96501 to your computer and use it in GitHub Desktop.
Multi Monitor switch
; Used to change the monitor source
; Requires ControlMyMonitor from https://www.nirsoft.net/utils/control_my_monitor.html
setMonitorInputSource(monitor, inputSelectCode, source)
{
cmd := "ControlMyMonitor.exe /SetValue " . monitor . " " . inputSelectCode . " " . source
Run %cmd%
}
; Map monitor switch to same keys as synergy keyboard switch
$^![::
setMonitorInputSource("\\.\DISPLAY1\Monitor0", 60, 15)
Send ^!{[}
return
$^!]::
setMonitorInputSource("\\.\DISPLAY1\Monitor0", 60, 3)
Send ^!{]}
return
; Multiple monitors?
; Used to change the monitor source
; Requires ControlMyMonitor from https://www.nirsoft.net/utils/control_my_monitor.html
setMonitorInputSource(monitor, inputSelectCode, source)
{
cmd := "ControlMyMonitor.exe /SetValue " . monitor . " " . inputSelectCode . " " . source
Run %cmd%
}
; Map monitor switch to same keys as synergy keyboard switch
$^![::
setMonitorInputSource("\\.\DISPLAY1\Monitor0", 60, 15)
setMonitorInputSource("\\.\DISPLAY2\Monitor0", 60, 15)
Send ^!{[}
return
$^!]::
setMonitorInputSource("\\.\DISPLAY1\Monitor0", 60, 3)
setMonitorInputSource("\\.\DISPLAY2\Monitor0", 60, 3)
Send ^!{]}
return
@moshen
Copy link
Author

moshen commented Mar 5, 2019

This script requires ControlMyMonitor.exe ( https://www.nirsoft.net/utils/control_my_monitor.html ) to be in the same folder as the monitorswitch autohotkey script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment