├── AltGrLayer.ahk ├── AutoHotkey.ahk ├── AutoReload.ahk ├── Launcher.ahk ├── MediaKeys.ahk ├── NewTerminal.ahk ├── PasteNoFormat.ahk ├── README.md └── Timestamp.ahk /AltGrLayer.ahk: -------------------------------------------------------------------------------- 1 | ; Special characters using right alt modifier 2 | >!;::send "æ" 3 | >!+;::send "Æ" 4 | >!'::send "ø" 5 | >!"::send "Ø" 6 | >![::send "å" 7 | >!{::send "Å" 8 | >!o::send "Ω" 9 | >!d::send "°" 10 | >!+d::send "📄" 11 | >!u::send "µ" 12 | >!1::send "☐" 13 | >!2::send "☑" 14 | >!e::send "€" 15 | >!w::send "⚠" 16 | >!b::send "🐛" 17 | >!l::send "⚡" 18 | >!t::send "👍" 19 | >!f::send "🚩" 20 | >!c::send "📅" 21 | >!i::send "💡" 22 | >!+m::send "✓" 23 | >!m::send "✔" 24 | >!n::send "❌" 25 | >!.::send "·" 26 | >!-::send "–" 27 | >!p::send "π" 28 | >!q::send "œ" 29 | >!+q::send "Œ" 30 | >!3::send "🧑" 31 | >!4::send "📦" 32 | >!5::send "⚙" 33 | >!x::send "×" 34 | >!LEFT::send "←" 35 | >!UP::send "↑" 36 | >!RIGHT::send "→" 37 | >!DOWN::send "↓" 38 | >!Numpad1::send "└" 39 | >!Numpad2::send "┴" 40 | >!Numpad3::send "┘" 41 | >!Numpad4::send "├" 42 | >!Numpad5::send "┼" 43 | >!Numpad6::send "┤" 44 | >!Numpad7::send "┌" 45 | >!Numpad8::send "┬" 46 | >!Numpad9::send "┐" 47 | >!NumpadSub::send "─" 48 | >!NumpadAdd::send "│" 49 | >!+::send "±" 50 | -------------------------------------------------------------------------------- /AutoHotkey.ahk: -------------------------------------------------------------------------------- 1 | #Requires AutoHotkey v2 2 | 3 | #SingleInstance Force 4 | 5 | #Include Launcher.ahk 6 | #Include AltGrLayer.ahk 7 | #Include NewTerminal.ahk 8 | #Include AutoReload.ahk 9 | 10 | #y::Launch("ahk_exe Discord.exe", "C:\Users\larsch\AppData\Local\Discord\Update.exe --processStart Discord.exe") 11 | #t::Launch("ahk_class TTOTAL_CMD", "D:\appl\totalcmd\TOTALCMD64.EXE") 12 | #c::Launch("ahk_exe qalculate-qt.exe", "c:\Program Files\Qalculate\qalculate-qt.exe") 13 | #+r::Reload() 14 | #SPACE::Launch("ahk_exe WindowsTerminal.exe", "C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.17.11461.0_x64__8wekyb3d8bbwe\wt.exe") 15 | #+f12::Reload 16 | -------------------------------------------------------------------------------- /AutoReload.ahk: -------------------------------------------------------------------------------- 1 | ScriptStartTime := A_Now 2 | 3 | SetTimer CheckReload, 1000 4 | 5 | CheckReload() { 6 | global ScriptStartTime 7 | OutputDebug "CheckReload" 8 | LastModified := "" 9 | Loop Files, "*.ahk" 10 | { 11 | ModificationTime := FileGetTime(A_LoopFileFullPath) 12 | if (LastModified = "" or ModificationTime > LastModified) { 13 | LastModified := ModificationTime 14 | } 15 | } 16 | If (LastModified > ScriptStartTime) { 17 | ScriptStartTime := LastModified ; prevent repeated reload on load failure 18 | Reload 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Launcher.ahk: -------------------------------------------------------------------------------- 1 | ; DWIM function for command prompts 2 | Prompt(title, path) 3 | { 4 | Launch(title, "C:\Windows\System32\cmd.exe /k title " . title . " & cd " . path) 5 | } 6 | 7 | ;;; Notification 8 | ; CleanNotification() 9 | ; { 10 | ; ; ToolTip 11 | ; Progress(off) 12 | ; } 13 | 14 | Notify(text) 15 | { 16 | ; SysGet(Area, MonitorWorkArea) 17 | ; Y := AreaBottom-128 18 | ; Progress(hide Y%Y% W1000 b zh0 cwFFFFFF FM16 CT00BB00,, %text%, AutoHotKeyProgressBar, Backlash BRK) 19 | ; WinSet(TransColor, FFFFFF 255, AutoHotKeyProgressBar) 20 | ; Progress(show) 21 | ; SetTimer(CleanNotification, -2000) 22 | } 23 | 24 | ; DWIM function to activate, launch, or minimize a window. Activates window with 25 | ; matching title if it exists or launches program if it doesn't exists and 26 | ; forces activation. Minimizes window if already active (use as toggle). 27 | Launch(title, path, WorkDir:="", DetectHidden:=False) 28 | { 29 | DetectHiddenWindows DetectHidden 30 | if WinExist(title) 31 | { 32 | If WinActive() 33 | { 34 | out := WinGetMinMax(title) 35 | If (out = -1) 36 | { 37 | Notify("Restore " . title) 38 | WinRestore ; store if minimized 39 | } 40 | Else 41 | { 42 | Notify("Minimize " . title) 43 | WinMinimize ; minimize if active 44 | } 45 | } 46 | Else 47 | { 48 | out := WinGetMinMax(title) 49 | If (out != -1) 50 | { 51 | Notify("Restore " . title) 52 | WinRestore ; restore if minimized 53 | } 54 | Notify("Activate " . title) 55 | WinActivate ; bring to front 56 | } 57 | } 58 | else 59 | { 60 | Notify("Launching " . path) 61 | WinActivate("ahk_class Shell_TrayWnd") ; workaround to prevent window to open in background 62 | Run path, WorkDir 63 | WinWait(title) 64 | WinActivate() 65 | WinWait(title) 66 | ToolTip() 67 | } 68 | DetectHiddenWindows False 69 | } 70 | 71 | ;; Examples: 72 | ;; 73 | ;; EnvGet, LocalAppData, LOCALAPPDATA 74 | ;; #t::Launch("ahk_class TTOTAL_CMD", "C:\Program Files\TOTALCMD\TOTALCMD64.EXE") 75 | ;; #o::Launch("Outlook ahk_class OlkWV2Frame ahk_exe olk.exe", "C:\Program Files\Microsoft Office\root\Office16\OUTLOOK.EXE", DetectHidden=true) 76 | ;; #y::Launch("ahk_exe Teams.exe", LocalAppData . "\Microsoft\Teams\current\Teams.exe") 77 | ;; #+k::Launch("KeePassXC", "C:\Program Files\KeePassXC\KeePassXC.exe") 78 | ;; #c::Launch("ahk_exe qalculate-qt.exe", "c:\Program Files\Qalculate\qalculate-qt.exe") 79 | -------------------------------------------------------------------------------- /MediaKeys.ahk: -------------------------------------------------------------------------------- 1 | ;; Poor man's media keys 2 | #F2::send {Media_Prev} 3 | #F3::send {Media_Play_Pause} 4 | #F4::send {Media_Next} 5 | #^Up::send {Volume_Up} 6 | #^Down::send {Volume_Down} 7 | -------------------------------------------------------------------------------- /NewTerminal.ahk: -------------------------------------------------------------------------------- 1 | ;; Open new Windows Terminal tab 2 | #ENTER:: 3 | { 4 | If WinExist("ahk_exe WindowsTerminal.exe") 5 | { 6 | WinActivate() 7 | WinWaitActive() 8 | Send "^+T" ; open new TAB with Ctrl+T instead of new-tab to ensure it opens in focused window 9 | } 10 | Else 11 | { 12 | Run(EnvGet("LOCALAPPDATA") . "\Microsoft\WindowsApps\wt.exe") 13 | WinWait("ahk_exe WindowsTerminal.exe") 14 | WinActivate 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /PasteNoFormat.ahk: -------------------------------------------------------------------------------- 1 | ;; Paste without format 2 | #v::SendInput, %ClipBoard% 3 | 4 | ;; Paste with no format, removing newlines 5 | #+v:: 6 | Lines := StrSplit(Clipboard, "`r`n", " `t") 7 | str := "" 8 | for index, param in Lines 9 | { 10 | str .= param . " " 11 | } 12 | str := SubStr(str, 1, -1) 13 | Send, %str% 14 | return 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AutoHotkeyScripts 2 | 3 | Personal AutoHotkey Scripts, that I use every day while working on Windows 4 | 5 | # License 6 | 7 | MIT License 8 | 9 | Copyright (c) Lars Christensen 10 | 11 | Permission is hereby granted, free of charge, to any person obtaining a copy 12 | of this software and associated documentation files (the "Software"), to deal 13 | in the Software without restriction, including without limitation the rights 14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | copies of the Software, and to permit persons to whom the Software is 16 | furnished to do so, subject to the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included in all 19 | copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 27 | SOFTWARE. 28 | -------------------------------------------------------------------------------- /Timestamp.ahk: -------------------------------------------------------------------------------- 1 | ;; Win+;: Input date in ISO format (2023-07-31) 2 | #;:: 3 | FormatTime, Out, , yyyy-MM-dd 4 | Send %out% 5 | return 6 | 7 | ;; Win+Shift+;: Input current date+time in ISO format 8 | #+;:: 9 | FormatTime, Out, , yyyy-MM-ddTHH:mm:ss 10 | Send %out% 11 | return 12 | 13 | ;; Win+/: Input current date+time in system format 14 | #!;:: 15 | FormatTime, Out,, 16 | Send %out% 17 | return 18 | 19 | ;; Win+/: Input current date+time in system format 20 | #^;:: 21 | FormatTime, Out,, yyyyMMdd 22 | Send %out% 23 | return 24 | 25 | ;; Input current date+time in filename friendly ISO8601 format 26 | #^+;:: 27 | FormatTime, Out,, yyyyMMddTHHmmss 28 | Send %out% 29 | return 30 | 31 | ;; Examples: 32 | ;; Win+; 2023-07-31 33 | ;; Win+Shift+; 2023-07-31T15:29:18 34 | ;; Win+Ctrl+; 20230731 35 | ;; Win+Ctrl+Shift+; 20230731T152922 36 | ;; Win+Alt+; 15:29 Monday, 31 July 2023 37 | --------------------------------------------------------------------------------