Skip to content

Instantly share code, notes, and snippets.

@Logerfo

Logerfo/AutoHotkey.ahk

Last active Mar 10, 2020
Embed
What would you like to do?
AutoHotkey
#MaxHotkeysPerInterval 200
#NoEnv
SendMode Input
SetWinDelay, 0
;suspend
*ScrollLock::Suspend
;macros
::lenny::( ͡° ͜ʖ ͡°)
::shrug::¯\_(ツ)_/¯
;$F2::SendInput {Del}
;$+F2::SendInput +{Del}
;$^F2::SendInput ^{Del}
;global hotkeys
$^+p::
if !winactive("ahk_exe Code.exe")
WinActivate, ahk_exe Code.exe
SendInput ^+p
return
$^'::
if !winactive("ahk_exe Code.exe") And !winactive("ahk_exe gimp-2.10.exe")
WinActivate, ahk_exe Code.exe
else
SendInput ^'
return
$^t::
if !winactive("ahk_exe Photoshop.exe") And !winactive("ahk_exe chrome.exe")
WinActivate, ahk_exe chrome.exe
SendInput ^t
return
$^+t::
if !winactive("ahk_exe Terminus.exe") And !winactive("ahk_exe Code.exe") And !winactive("ahk_exe chrome.exe")
WinActivate, ahk_exe chrome.exe
SendInput ^+t
return
$^k::
if winactive("ahk_exe Telegram.exe")
{
SendInput {ESC}
return
}
}
if winactive("ahk_exe Teams.exe")
{
SendInput ^e
return
}
if !winactive("ahk_exe Discord.exe") And !winactive("ahk_exe Code.exe")
WinActivate, ahk_exe Discord.exe
SendInput ^k
return
;disabled hotkeys
*Ins::
#D::
#Up::
#Down::
^#Down::
*NumpadIns::
*PgUp::
*PgDn::
$!Space::Return
Control & WheelDown::
if !winactive("ahk_exe devenv.exe")
SendInput ^{WheelDown}
return
Control & WheelUp::
if !winactive("ahk_exe devenv.exe")
SendInput ^{WheelUp}
return
;simplified hotkeys
#Left::^#Left
#Right::^#Right
LWIN & WheelUp::^#Left
LWIN & WheelDown::^#Right
;avoided hotkeys
^+,::SendInput ^,
^+.::SendInput ^.
;always on top
LWIN & MButton::
MouseGetPos,,, WinUMID
Winset, Alwaysontop, , ahk_id %WinUMID%
return
;titlebar visiblity
;-Caption
LWIN & LButton::
MouseGetPos,,, WinUMID
;WinSet, Style, -0x40000, A
aux := DllCall("GetMenu", ptr, ahk_id WinUMID)
if(aux != 0)
{
hMenu%WinUMID% := aux
DllCall("SetMenu", ptr, ahk_id WinUMID, ptr, 0)
}
WinGet, Style, Style, ahk_id %WinUMID%
if(Style & 0xC00000)
{
;WinGet, maximized, MinMax, ahk_id %WinUMID%
;WinRestore, ahk_id %WinUMID%
WinSet, Style, -0xC00000, ahk_id %WinUMID%
;WinSet, Style, -0x840000, A
;WinHide, A
;WinShow, A
;WinSet, Style, -0x1c00000, ;CAPTION|DLGFRAME|MAXIMIZE
;WinGetPos, X, Y, Width, Height, ahk_id %WinUMID%
;WinMove, ahk_id %WinUMID%,, X+1, Y, Width-2, Height-1
;WinMove, ahk_id %WinUMID%,, X, Y, Width, Height
}
return
;+Caption
LWIN & RButton::
MouseGetPos,,, WinUMID
;WinGetPos, X, Y, Width, Height, A
;WinSet, Style, +0x40000, A
if(hMenu%WinUMID% != 0)
DllCall("SetMenu", ptr, ahk_id WinUMID, ptr, hMenu%WinUMID%)
WinGet, Style, Style, ahk_id %WinUMID%
if(!(Style & 0xC00000))
{
WinSet, Style, +0xC00000, ahk_id %WinUMID%
;WinSet, Style, +0x840000, A
;WinHide, A
;WinShow, A
WinGet, maximized, MinMax, ahk_id %WinUMID%
if(!maximized)
WinMove, ahk_id %WinUMID%,, X+0.5, Y, Width+0.5, Height+0.5
;WinSet, Style, +0x1c00000, ;CAPTION|DLGFRAME|MAXIMIZE
}
return
;Chrome tabs
;~WheelUp::
;if winactive("ahk_class Chrome_WidgetWin_1")
;{
; MouseGetPos, xchrome, ychrome
; if (ychrome < 92)
; {
; Send, ^+{Tab}
; }
;}
;return
;~WheelDown::
;if winactive("ahk_class Chrome_WidgetWin_1")
;{
; MouseGetPos, xchrome, ychrome
; if (ychrome < 92)
; {
; Send, ^{Tab}
; }
;}
;return
;print screen
PrintScreen::
Send, #+s
;Run snippingtool
;sleep, 500
;Send, !n
return
;auto reload
~^s::
WinGetActiveTitle, Reload
If InStr(Reload, ".ahk")
Reload
Progress, Off
Return
;skype
#SingleInstance force
#IfWinActive ahk_class tSkMainForm
ConversationUp()
{
Send, {AltDown}2{AltUp}
; Sleep, 1
Send, {Up}{Enter}
return
}
ConversationDown()
{
Send, {AltDown}2{AltUp}
; Sleep, 1
Send, {Down}{Enter}
return
}
Search()
{
Send, ^+!{F5}
}
^F::Search()
;Ctrl+Down move one conversation down
^Down::ConversationDown()
;Ctrl+Up move one conversation up
^Up::ConversationUp()
;Ctrl+Tab move one conversation down
^Tab::ConversationDown()
;Ctrl+Shift+Tab move one conversation up
^+Tab::ConversationUp()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment