AHK GUI disappears although the script is running

Ask gaming related questions
Posts: 11
Joined: 05 Nov 2020, 03:12

AHK GUI disappears although the script is running

Post by aaart777 » 23 Jan 2021, 11:13


I'm a poker player playing on PokerStars. Recently, due to gambling regulations, PokerStars has introduced a so called "panic button" that bans you on-click for a period of 24 hours. The button is a one-click to activate and unfortunately the ban can't be reversed so if you accidently click it, you'll just have to wait out the 24 hrs.

Anyway, I decided a couple of weeks ago to write an AHK script that blocks the button as to avoid misclicks, here's the code:

Code: Select all

Win_Hwnd := WinExist("ahk_exe PokerStars.exe ahk_class #32770")
OX := 200 ; x offset. change as needed
OY := 58 ; y offset. change as needed

; Gui Create
Gui, Color, Black
Gui, Font, s12 cRed, Bold Verdana
Gui, Add, Text,, BLOCKED
Gui, +LastFound +ToolWindow +AlwaysOnTop -Caption -Border

SetTimer, MoveWindow, 0,1

	WinGetPos, WX, WY,,, ahk_id %Win_Hwnd%
	Gui, Show, % "w238 h50 x" . (WX + OX) . " y" (WY + OY) " NoActivate"
It works well generally, however cover-button that the script creates, disappears from time to time. If I play for an extended period, I can be sure that the overlay has disappeared but I don't understand what's causing this. Could this be anything from my script or could this be caused by the PokerStars software?

Any help would be really appreciated!
User avatar
Posts: 5436
Joined: 09 Sep 2014, 18:38

Re: AHK GUI disappears although the script is running

Post by mikeyww » 23 Jan 2021, 11:44

If that particular window disappears, then x and y will be null. Your routine provides no error checks.

One way to understand more is to log the key actions to a file, and then examine it.

You probably do not need a timer interval of 0 to achieve the effect that you want. For example, 100 would probably work.
Post Reply

Return to “Gaming”