Q:

AHK script for sending hotkeys to specific window

i need an ahk script that sends 3 different hotkeys ( pressing f1 , sending f5 for example to the active window of a specific (poker) application ) f1 has to be f1 for other applications running parallel though
who can help ?

A:

If the title of your poker application always ends with - NLH, but you don't want to match those windows whose class is PokerStarsTableFrameClass, use the following:
F1::
WinGetTitle, Title, A
WinGetClass, Class, A
if (RegExMatch(Title, "- NLH$") AND (Class != "PokerStarsTableFrameClass"))
    SendPlay {F5}
else
    SendPlay {F1}
return

How it works

WinGet(Title|Class), (Title|Class), A reads the active (A) window's title|class and stores it in the variable Title|Class.
- NLH$ is a regular expression matching all strings that end with - NLH. ($ is the end of string)
if (RegExMatch(Title, "- NLH$") AND (Class != "PokerStarsTableFrameClass")) tests if the regular expression matches Title, but the Class is different from the exception.

If so, SendPlay {F5} sends F5 to the active window.
Otherwise, SendPlay {F1} sends a normal F1 to the active window.

