Skip to content

Instantly share code, notes, and snippets.

@zeromancer
Last active August 7, 2022 01:50
Show Gist options
  • Save zeromancer/bd1d3872b2448235286638130c725889 to your computer and use it in GitHub Desktop.
Save zeromancer/bd1d3872b2448235286638130c725889 to your computer and use it in GitHub Desktop.
My AutoHotkey Configuration File for Windows
#SingleInstance force ; needs to be first
SetCapsLockState, alwaysoff ; needs to be second
; --------------Put File into----------
; C:\Users\[Username]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
; --------------Keyboard---------------
z::y
y::z
CapsLock & q::Send {{}
CapsLock & w::Send {}}
CapsLock & e::Send {(}
CapsLock & r::Send {)}
CapsLock & t::Send {=}
CapsLock & a::Send {[}
CapsLock & s::Send {]}
CapsLock & d::Send {<}
CapsLock & f::Send {>}
CapsLock & g::Send {;}
CapsLock & y::Send {/}
CapsLock & x::Send {\}
CapsLock & o::Reload
; --------------Mouse---------------
F7::return ; Left Side: Front Key
F7 & LButton::Send {PgDn}
F7 & MButton::Send ^{w}
F7 & RButton::Send {PgUp}
F7 & WheelUp::Send ^{PgUp}
F7 & WheelDown::Send ^{PgDn}
F7 & XButton1::Send {F5}
F8::return ; Left Side: Back Key
F8 & LButton::Send ^{c}
F8 & MButton::Send ^{x}
F8 & RButton::Send ^{v}
F8 & WheelUp::Send {Ctrl Down}{LWin Down}{Left Down}{Left Up}{LWin Up}{Ctrl Up}
F8 & WheelDown::Send {Ctrl Down}{LWin Down}{Right Down}{Right Up}{LWin Up}{Ctrl Up}
F8 & XButton1::Send !{Up}
F9::return ; Left Side: Back Key
F9 & LButton::Send ^{Insert}
F9 & MButton::Send {Volume_Mute}
F9 & RButton::Send +{Insert}
;F9 & WheelUp::Send {Volume_Up}
;F9 & WheelDown::Send {Volume_Down}}
F9 & WheelUp::ShiftAltTab
F9 & WheelDown::AltTab
F9 & XButton1::Send !{Right}
; --------------Info---------------
; + = Shift
; ^ = Control
; # = Windows/Super
; ! = Alt
; https://www.autohotkey.com/docs/Hotkeys.htm
; https://www.autohotkey.com/docs/commands/Send.htm
; --------------Misc---------------
CapsLock & F1::DllCall("LockWorkStation")
CapsLock & F2::Run C:\Windows\System32\shutdown.exe /p /f
CapsLock & F3::Run C:\Windows\System32\shutdown.exe /r /f
CapsLock & m::Send Mit freundlichen Gr{ASC 0252}{ASC 0223}en{enter}David Siewert
#!x::Run C:\Windows\System32\shutdown.exe /p /f
; --------------Programs---------------
#e:: ; Eclipse
WinGetTitle, Title, ahk_class SWT_Window0
if InStr(Title, "Eclipse")
WinActivate, ahk_class SWT_Window0
else
Run, "F:\Workspaces\eclipse\eclipse.exe"
return
#o:: ; Outlook
Process, exist, OUTLOOK.EXE
PID=%ErrorLevel%
if %PID%=0
;;run "D:\Command\NotePad++ Unicode\notepad++.exe"
Run Outlook
else
WinActivate ahk_pid %PID%
return
#s:: ; Skype
Process, exist, lync.exe
PID=%ErrorLevel%
if %PID%=0
Run Lync
else
WinActivate ahk_pid %PID%
return
#f:: ; CubicExploerer
WinGetTitle, Title, ahk_class TMainForm.UnicodeClass
if InStr(Title, "CubicExplorer")
WinActivate, ahk_class TMainForm.UnicodeClass
else
Run, CubicExploerer
return
#n:: ; Notepad++
Process, exist, Notepad++.exe
PID=%ErrorLevel%
if %PID%=0
;;run "D:\Command\NotePad++ Unicode\notepad++.exe"
Run Notepad++
else
;; WinClose ahk_pid %PID%
WinActivate ahk_pid %PID%
return
#i::
WinGetTitle, Title, A
WinGetClass, class, A
MsgBox, title: `n`n%Title% `n`nclass: `n`n%class%
return
; --------------Programs Advanced------
executeOrKill(processName, exePath){
Process, Exist, %processName%
PID=%ErrorLevel%
if (ErrorLevel <> 0) {
Process, Close, %ErrorLevel% ; doesn't work reliable enough
; Run, taskill /im %processName% /f
} else {
Run, "%exePath%"
}
}
killAll(process){
Loop
{
prev := ErrorLevel
Process, Close, %process%
Process, Exist, %process%
}
until !ErrorLevel or (prev = ErrorLevel)
}
executeOrFocus(processName, exePath){
Process, Exist, %processName%
if (ErrorLevel <> 0) {
WinActivate, ahk_pid %ErrorLevel%
} else {
Run, "%exePath%"
}
}
executeOrFocus2(windowClass, windowTitle, exePath){
; MsgBox, class: %windowClass% `n`ntitle: %windowTitle% `n`nexePath: %exePath%
WinGetTitle, Title, ahk_class %windowClass%
if InStr(Title, "%windowTitle%")
WinActivate, ahk_class %windowClass%
else
Run, "%exePath%"
return
}
; #e::executeOrFocus2("SWT_Window0","Eclipse","F:\Workspaces\eclipse\eclipse.exe") ;
; #o::executeOrFocus("OUTLOOK.EXE","Outlook") ;
; #f::executeOrFocus2("TMainForm.UnicodeClass","CubicExplorer","C:\Program Files (x86)\CubicExplorer\CubicExplorer.exe") ;
; #n::executeOrFocus("Notepad++.exe","Notepad++") ;
#t:: ; OpenTime
executeOrFocus("OpenTime.exe","P:\OpenTime\OpenTime.exe") ;
sleep 100
WinWaitActive, Anmeldung
sleep 100
SendInput, SuperSecretPasswordThatNeedsToBeChanged
sleep 200
SendInput, {enter}
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment