One hotkey/hotstring for multiple window sensitive outputs.
Posted: 24 Nov 2021, 16:29
Hi! This is a very basic script for sending different outputs depending on what window is active. I guess there's a bunch of these around here, but I couldn't find one that only required typing the hotstring/hotkey once. The reason I wanted it is to be able to have the same command for similar outputs across different languages. One example would be if I wanted a vector [ , ] in one language, it might be \begin{bmatrix} \\ \end{bmatrix} in another. With this script I can just let "Altgr + V" give me different output in every program that results in a vector.
I am not that good at AHK, so there might be a lot of improvement that can be made, but at least it hasn't failed me yet
I am not that good at AHK, so there might be a lot of improvement that can be made, but at least it hasn't failed me yet
Code: Select all
#NoEnv
#Warn
SendMode Input
SetWorkingDir %A_ScriptDir%
#SingleInstance,Force
#Hotstring EndChars ; Only Space triggers hotstrings
; Finding ahk_class - Have at least one script running, right click the green H icon in system tray and click on Window Spy.
; ahk_class is found in the top box. (Hex of color under mouse pointer is found in the Mouse Position box)
::stop::
IfWinActive, ahk_class Notepad
send in the name of love.
Else IfWinActive, ahk_class SciTEWindow
send Hammertime{!}
Else IfWinActive, ahk_class Qt5152QWindowIcon
send {raw} \command{}
Else IfWinActive, ahk_class SunAwtFrame
MsgBox You are typing jibberish while Pycharm is active.
Else
send stop{Space}
return