2

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 ?

2

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.

3
  • 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
-1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.