#Tools – AutoHotKey + Display Changer II to quickly change screen resolutions with a hot key

Buy Me A Coffee

Hi !

A couple of weeks ago, wrote a post where I explained how we can use Display Changer II to quickly change between monitor / screens configurations. Quoting myself:

I mainly share my landscape monitor, however my default resolution in this monitor is 2560×1080. So, every time I share my screen, I found myself in Windows 10 Display Settings, to change the monitor resolution to 1920 x 1080.

My self sometime ago.
Bruno Office

I have 2 BAT files to change between ShareScreen mode and WorkMode. And, chatting with Frank Boucher (@fboucheros), he mentioned an amazing app for Windows: AutoHotKey (see references).

You can do several tasks with AutoHotKey, however the hotkey / keybindings part is important:

Define hotkeys for the mouse and keyboard, remap keys or buttons and autocorrect-like replacements. Creating simple hotkeys has never been easier; you can do it in just a few lines or less!

AutoHotKey Key Bindings

I created a AutoHotKey file with the following content:

+!s::
run, %comspec% /c "d:\Program Files\dc2\ShareScreenMode.bat",,hide
return

+!w::
run, %comspec% /c "d:\Program Files\dc2\WorkMode.bat",,hide
return

This file, will hook up to the following keys combination

  • Shift + Alt + S, change resolutions for Share Screen
  • Shift + Alt + W, change resolutions for Default Work Screen

I may mention that I’m using the command

run, %comspec% /c "d:\Program Files\dc2\WorkMode.bat",,hide

to run the command without displaying any window. Another option is to run the following command, where you will see the command prompt for a couple of seconds.

RunWait "d:\Program Files\dc2\ShareScreenMode.bat"

And, my next step will be to hide the clock in the system tray when I’m in share screen mode. This is work in progress

; Simulate Press Windows Key
Send, {Ctrl down}{Escape down}
; type on the search
Send, turn system icons on or off
; hit return
Send, {Return}
; activate and wait for Settings windows
WinActivate, Settings 
WinWaitActive, Settings
; crappy sleep code
Sleep, 2000
; enable / disable the 1st item, time
SendInput, {Space}
; crappy sleep code 
Sleep, 2000

Happy coding!

Greetings

El Bruno

Resources