Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 ?

share|improve this question
up vote 2 down vote accepted

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:

WinGetTitle, Title, A
WinGetClass, Class, A
if (RegExMatch(Title, "- NLH$") AND (Class != "PokerStarsTableFrameClass"))
    SendPlay {F5}
    SendPlay {F1}

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.

share|improve this answer
thx a lot works for the app but disables hotkeys on another app even though "NLH" which i used instead of "poker" isnt in the window title, cannot use window class as another app has the same class, but is it possible to exclude a ahk_class ( "PokerStarsTableFrameClass" ) ? – Jin May 30 '12 at 11:59
I've updated my answer. – Dennis May 30 '12 at 12:52
thx again found also help in the autohotkey community chat . this works very good so far: codeSetTitleMatchMode 2 #IfWinActive NLH F1::SendPlay {F5} F2::SendPlay {F6} F3::SendPlay {F7} #IfWinActive return – Jin May 30 '12 at 13:09

You don't need an AutoHotkey script. You need to learn how to use the available API (commands) to achieve what you want. To send input directly to a window or its controls, active or not, you can use the ControlSend command.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .