Code: Select all
f11:: ; Win + A
MouseGetPos,,, Hwnd
WinGet, PN, ProcessName, % "ahk_id " Hwnd
If (PN = "WINWORD.EXE") ; Specify the window title here.
WinActivate, Word.png
If (PN = "Chrome.exe")
WinActivate, Chrome.png
If (PN = "Firefox.exe")
WinActivate, Firefox.png
If (PN = "Vivaldi.exe")
WinActivate, Vivaldi.png
If (PN = "shareX.exe")
WinActivate, shareX.exe.png
Return
GuiClose:
ExitApp
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
F1::
Keywait, F1, T1
If Errorlevel != 0
{
MouseGetPos,,, win
PostMessage, 0x112, 0xF020,,, ahk_id %win%
KeyWait,F1
}
Else
Send ^!{Tab}
Return
#If !WinActive("ahk_class CabinetWClass ahk_exe explorer.exe")
F2:: ; press ctrl+o, which toggles Musicbee playback
Send, {alt down}{o}{alt up}
Return
F5::
Keywait, F5, T1
If Errorlevel != 0
{
MouseGetPos,,, win
PostMessage, 0x112, 0xF020,,, ahk_id %win%
KeyWait,F5
}
Else
MouseGetPos,,, win
WinClose, ahk_id %win%
Return
F6::
MouseGetPos,,, win
WinMinimize, ahk_id %win%
Return
F9::Send, #d
Return
F10::Send, ^#c
Return
LControl & RAlt::WinSet, AlwaysOnTop, Toggle,A
Return