Skip to content

Instantly share code, notes, and snippets.

@natyusha
Last active November 28, 2017 03:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save natyusha/3df2bfbffaca3ac797b36492d4769f53 to your computer and use it in GitHub Desktop.
Save natyusha/3df2bfbffaca3ac797b36492d4769f53 to your computer and use it in GitHub Desktop.
autohotkey scripts for windows
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance force ; only allow one script instance
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
Menu, Tray, Icon, shell32.dll, 44 ; Sets the Trayicon
; Selected programs to close with Escape key [ignore ctrl+shift+esc]
GroupAdd, WinClose, ahk_class CabinetWClass
GroupAdd, WinClose, ahk_class FM
GroupAdd, WinClose, ahk_class Notepad
GroupAdd, WinClose, ahk_class PotPlayer
GroupAdd, WinClose, ahk_class FontViewWClass
#IfWinActive ahk_group WinClose
^+esc::^+esc
esc::!f4
#IfWinActive
; General Window Close
#c::!f4
; Window Spy
#i::run, AU3_Spy.exe
; Volume Mixer Toggle
; coordinates = y * 65536 + x, where x and y - signed integers
#v::
IfWinActive, ahk_class #32770
Send, !{f4}
else
run, %A_WinDir%\System32\SndVol.exe -t 91621872
Return
; Desktop Icons Toggle
^SPACE::
ControlGet, HWND, Hwnd,, SysListView321, ahk_class Progman
If HWND =
ControlGet, HWND, Hwnd,, SysListView321, ahk_class WorkerW
If DllCall("IsWindowVisible", UInt, HWND)
WinHide, ahk_id %HWND%
Else
WinShow, ahk_id %HWND%
Return
; remove from task view toggle
#t::WinSet, ExStyle, ^0x00000080, A
; Always ontop toggle
!SPACE::WinSet, AlwaysOnTop, Toggle,A
; Drag Window on Right Alt
RALT & LButton::
CoordMode, Mouse
MouseGetPos, EWD_MouseStartX, EWD_MouseStartY, EWD_MouseWin
WinGetPos, EWD_OriginalPosX, EWD_OriginalPosY,,, ahk_id %EWD_MouseWin%
WinGet, EWD_WinState, MinMax, ahk_id %EWD_MouseWin%
if EWD_WinState = 0
SetTimer, EWD_WatchMouse, 10
Return
EWD_WatchMouse:
GetKeyState, EWD_LButtonState, LButton, P
if EWD_LButtonState = U
{
SetTimer, EWD_WatchMouse, off
return
}
GetKeyState, EWD_EscapeState, Escape, P
if EWD_EscapeState = D
{
SetTimer, EWD_WatchMouse, off
WinMove, ahk_id %EWD_MouseWin%,, %EWD_OriginalPosX%, %EWD_OriginalPosY%
return
}
CoordMode, Mouse
MouseGetPos, EWD_MouseX, EWD_MouseY
WinGetPos, EWD_WinX, EWD_WinY,,, ahk_id %EWD_MouseWin%
SetWinDelay, -1
WinMove, ahk_id %EWD_MouseWin%,, EWD_WinX + EWD_MouseX - EWD_MouseStartX, EWD_WinY + EWD_MouseY - EWD_MouseStartY
EWD_MouseStartX := EWD_MouseX
EWD_MouseStartY := EWD_MouseY
Return
; Put Monitors into standby mode
^+F12::
KeyWait LCtrl
KeyWait LSHift
SendMessage, 0x112, 0xF170, 2,, Program Manager
return
; Firefox Quantum custom newtab address bar text highlight
#IfWinActive ahk_class MozillaWindowClass
~^t::
sleep 250
send ^l
return
#IfWinActive
; Disable accidental moving of ffxiv window
#IfWinActive ahk_class FFXIVGAME
#down::return
#^down::return
#+left::return
#+right::return
#IfWinActive
/*
; Bypasss Virtual Audio
~Volume_Up::
SoundSet +2, , , 4
Return
~Volume_Down::
SoundSet, -2, , , 4
Return
~Volume_Mute::
SoundSet, +1, , mute, 4
Return
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment