Reputation: 1
This works:
wheeldown::
WinGetTitle, Title, A
WinGetClass, Class, A
if (RegExMatch(Title, "Poker"))
{coordmode, mouse, window
MouseGetPos, StartX, StartY
mouseclick, left, 325, 341
MouseMove, StartX, StartY
}
else
send {wheeldown}
return
This doesn't work
a::
WinGetTitle, Title, A
WinGetClass, Class, A
if (RegExMatch(Title, "Poker"))
{coordmode, mouse, window
MouseGetPos, StartX, StartY
mouseclick, left, 510, 342
send {Backspace}
send {Backspace}
send {Backspace}
send {Backspace}
send {Backspace}
send, 1.25
MouseMove, StartX, StartY
}
else
send {a}
return
Why it not work :(
Error message comes when I try to use "a" in a different application. Says 71 hotkeys used in 1000ms or something.
Upvotes: 0
Views: 140
Reputation: 331
three things, strictly speaking when using a hot key that has multiple lines of code the first line doesn't immediately follow the double colons. So this:
a:: WinGetTitle, Title, A
WinGetClass, Class, A
should be this:
a::
WinGetTitle, Title, A
WinGetClass, Class, A
Secondly the command that you are trying to find is called an imperative by the name of "#IfWinActive" or "#If" your regex should be used with latter of those to commands. There is a lot to that so you will need to look at those in the docs.
Lastly in the using a hotkey which sends itself you need to prefix it with "$" so that this:
a::
becomes:
$a::
Hope that helps with the question for any one looking atthis year old post.
Upvotes: 0
Reputation: 6371
Add this to the top of your script:
#MaxHotkeysPerInterval 300 ;default is 70
The error you get is common to scripts where the mousewheel is captured and used alot. Autohotkey treats the mousewheel as a hotkey and thinks that you shouldn't push a hotkey more than 70 times per second. Scrolling can call the hotkey more times then that depending on usage. This line will allow more than 70.
Upvotes: 1