Code: Select all
#a:: ; Win + A
MouseGetPos,,, Hwnd
WinGet, PN, ProcessName, % "ahk_id " Hwnd
Msgbox % "Process name: " PN
If (PN = "WINWORD.EXE") ; Specify the window title here.
{
Gui, +AlwaysOnTop
Gui, Add, Pic, xm ym, C:\Users\user\OneDrive\Pictures\Hotkeys\Keyboard Hotkeys\Word.png
Gui, Show
}
WinActivate % "ahk_id " Hwnd
Return
GuiClose:
ExitApp