Last active
September 17, 2023 10:14
-
-
Save LM1LC3N7/a1b36df48e8c7484e0a6627698f59f6f to your computer and use it in GitHub Desktop.
Add some multimedia keys and bind Windows 10's desktop management keys to a mouse (without return and forward buttons) using AutoHotKey. Use a .bat script to launch those 2 AutoHotKey scripts.
This file contains hidden or 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
; | |
; This is an AutoHotKey script that bind "CTRL + SHIFT + MOUSE SCROLL" to: | |
; - Volume Up (Scroll up) | |
; - Volume Down (Scroll down) | |
; - Volume Mute (Scroll Middle click) | |
; | |
; And also mouse wheel left and right to: | |
; - Back | |
; - Forward | |
; | |
; | |
; Documentation: | |
; | |
; - List of keys and mouse | |
; https://www.autohotkey.com/docs/KeyList.htm | |
; - AutoHotkey Beginner Tutorial | |
; https://autohotkey.com/docs/Tutorial.htm | |
; - Download | |
; https://www.autohotkey.com/download/ | |
; | |
; Recommended for performance and compatibility with future AutoHotkey releases. | |
#NoEnv | |
; Enable warnings to assist with detecting common errors. | |
; #Warn | |
; Recommended for new scripts due to its superior speed and reliability. | |
SendMode Input | |
; Ensures a consistent starting directory. | |
SetWorkingDir %A_ScriptDir% | |
; | |
; SHORTCUT : CTRL + SHIFT + SCROLL (UP / DOWN / MIDDLE) | |
; | |
^+WheelDown::Send {Volume_Down} | |
^+WheelUp::Send {Volume_Up} | |
^+MButton::Send {Volume_Mute} | |
; | |
; SHORTCUT : SCROLL CLICK LEFT / RIGHT | |
; | |
WheelLeft::Send {Browser_Back} | |
WheelRight::Send {Browser_Forward} | |
Return |
This file contains hidden or 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
:: Add this script to: | |
:: - C:\Users\<user name>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup | |
:: - OR %userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup | |
:: in order to auto start it at windows startup | |
:: Or the easy way : "WIN + X" to open the "Execute" window, then type "shell:startup" and copy the script | |
:: do not show the actions done here in the window | |
@echo off | |
:: ================================== Config section ================================== | |
:: adjust these values | |
:: the path to the AutoHotkey.exe to be used: | |
@set AHK_PATH=%PROGRAMFILES%\AutoHotkey\AutoHotkey.exe | |
:: the (relative or absolute) path to the AutoHotKey scripts to be launched: | |
@set MULTIMEDIA_KEYS=C:\PATH\TO\AutoHotkey_scripts\MultimediaKeys.ahk | |
@set SWITCH_DESKTOP=C:\PATH\TO\AutoHotkey_scripts\SwitchDesktop.ahk | |
:: ================================== End of section ================================== | |
echo "Starting AutoHotkey scripts" | |
tasklist | findstr 2>NUL AutoHotkey.exe | |
if errorlevel 1 ( | |
echo " -> Launch AutoHotkey scripts" | |
) else ( | |
echo " -> Stopping previous AutoHotkey scripts then launching them" | |
taskkill /IM AutoHotkey.exe /F | |
) | |
start "" "%AHK_PATH%" "%MULTIMEDIA_KEYS%" | |
start "" "%AHK_PATH%" "%SWITCH_DESKTOP%" | |
exit 0 |
This file contains hidden or 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
; | |
; This is an AutoHotKey script that bind "CTRL + SHIFT + ALT + MOUSE (SCROLL UP / DOWN, CLICK LEFT / RIGHT)" to: | |
; - Desktop on right (Right Mouse Button) | |
; - Desktop on left (Left Mouse Button) | |
; - Close Desktop (Scroll Down) | |
; - New Desktop (Scroll Up) | |
; | |
; | |
; Documentation: | |
; | |
; - List of keys and mouse | |
; https://www.autohotkey.com/docs/KeyList.htm | |
; - AutoHotkey Beginner Tutorial | |
; https://autohotkey.com/docs/Tutorial.htm | |
; - Download | |
; https://www.autohotkey.com/download/ | |
; | |
; Recommended for performance and compatibility with future AutoHotkey releases. | |
#NoEnv | |
; Enable warnings to assist with detecting common errors. | |
; #Warn | |
; Recommended for new scripts due to its superior speed and reliability. | |
SendMode Input | |
; Ensures a consistent starting directory. | |
SetWorkingDir %A_ScriptDir% | |
; | |
; SHORTCUT : CTRL + SHIFT + ALT + Mouse | |
; | |
; Left Mouse boutton : Switch to desktop on the left | |
^+!LButton:: send {LWin down}{LCtrl down}{Left}{LCtrl up}{LWin up} | |
; Right Mouse boutton : Switch to desktop on the right | |
^+!RButton:: send {LWin down}{LCtrl down}{Right}{LCtrl up}{LWin up} | |
; Wheel Down : Close current desktop | |
^+!WheelDown:: send {LWin down}{LCtrl down}{F4}{LCtrl up}{LWin up} | |
; Wheel Up : Create new desktop | |
^+!WheelUp:: send {LWin down}{LCtrl down}{d down}{LCtrl up}{LWin up}{d up} | |
Return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment