Skip to content

Instantly share code, notes, and snippets.

@LM1LC3N7
Last active September 17, 2023 10:14
Show Gist options
  • Select an option

  • Save LM1LC3N7/a1b36df48e8c7484e0a6627698f59f6f to your computer and use it in GitHub Desktop.

Select an option

Save LM1LC3N7/a1b36df48e8c7484e0a6627698f59f6f to your computer and use it in GitHub Desktop.

Revisions

  1. LM1LC3N7 revised this gist Sep 10, 2018. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions startup_ahk.bat
    Original file line number Diff line number Diff line change
    @@ -20,6 +20,13 @@
    :: ================================== 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%"

  2. LM1LC3N7 revised this gist Sep 10, 2018. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion startup_ahk.bat
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,6 @@
    :: Add this script to C:\Users\<user name>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
    :: 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

  3. LM1LC3N7 revised this gist Aug 16, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions startup_ahk.bat
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    :: Add this script to C:\Users\<user name>\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
  4. LM1LC3N7 revised this gist Aug 3, 2018. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions startup_ahk.bat
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,6 @@
    :: Add this script to C:\Users\<user name>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
    :: in order to auto start it at windows startup

    :: do not show the actions done here in the window
    @echo off

  5. LM1LC3N7 created this gist Aug 3, 2018.
    45 changes: 45 additions & 0 deletions MultimediaKeys.ahk
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,45 @@
    ;
    ; 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
    41 changes: 41 additions & 0 deletions SwitchDesktop.ahk
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    ;
    ; 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
    20 changes: 20 additions & 0 deletions startup_ahk.bat
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    :: 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"
    start "" "%AHK_PATH%" "%MULTIMEDIA_KEYS%"
    start "" "%AHK_PATH%" "%SWITCH_DESKTOP%"

    exit 0