Skip to content

Instantly share code, notes, and snippets.

@OskarKlintrot
Last active March 8, 2018 09:43
Show Gist options
  • Save OskarKlintrot/a5ec34d37e3513098bfdf8d827c903b7 to your computer and use it in GitHub Desktop.
Save OskarKlintrot/a5ec34d37e3513098bfdf8d827c903b7 to your computer and use it in GitHub Desktop.
My Auto Hotkey Script
; Create Task
;RunWait, %A_WinDir%\System32\schtasks.exe /create /TN AHK /TR C:\Users\oskkli\Documents\AutoHotkey\AutoHotkeyScript.ahk /RL HIGHEST /SC ONLOGON
#SingleInstance, force ; Always replaces the old instance automatically
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetCapsLockState, AlwaysOff ; Turn off Caps Lock
SetNumLockState, AlwaysOn ; Set state to On and then disable NumLock
SetScrollLockState, AlwaysOff ; Set state to On and then disable NumLock
; Both win + shift and AltGr (for two and one hand)
#+PgUp::Send {Volume_Up}
#+PgDn::Send {Volume_Down}
#+Del::Send {Media_Prev}
#+End::Send {Media_Next}
#+Ins::Send {Media_Play_Pause}
#+Home::Send {Volume_Mute}
<^>!PgUp::Send {Volume_Up}
<^>!PgDn::Send {Volume_Down}
<^>!Del::Send {Media_Prev}
<^>!End::Send {Media_Next}
<^>!Ins::Send {Media_Play_Pause}
<^>!Home::Send {Volume_Mute}
; Show current song playing on Spotify
ScrollLock::
#+Up::
{
DetectHiddenWindows, On
SetTitleMatchMode 2
WinGetTitle, now_playing, ahk_class SpotifyMainWindow
playing := now_playing == "Spotify" ? "Paused" : now_playing
TrayTip, Now playing:, %playing%, 10 , 16
DetectHiddenWindows, Off
return
}
; Why not...
#s::SendInput ¯\_(ツ)_/¯
; Run calc
#c::
Run, Calc
return
; Run notepad
#n::
Run, Notepad
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment