Open Side Menu Go to the Top
Register
GGPoker AHK Script  Mouse Hotkey and check/fold - CLOSED GGPoker AHK Script  Mouse Hotkey and check/fold - CLOSED

02-11-2023 , 09:29 PM
Ahk this file, when making EXE files, tips can not copy the basic files to the target, how to solve?
02-11-2023 , 09:29 PM
Quote:
Originally Posted by _dave_
Nice work
Ahk this file, when making EXE files, tips can not copy the basic files to the target, how to solve
02-15-2023 , 11:59 AM
I do not understand the question? I compile mine to an exe and it works fine. Run with admin rights!!!
02-15-2023 , 05:44 PM
Ahk2Exe Error
Error: Unable to copy Base file to destination.
Specifically:
*CA\Users(ADMINI~1.XLXAppData\LocaNTemp\~Ahk2Exe~A M~
exe~25893783849.tmp Do not know how to solve, please send the code again, thank you
02-15-2023 , 06:43 PM
If you have installed AHK. Version 1.
Right click and pick compile. If this doesn't work I have no clue, sry you have to find out via AHK forum.

Otherwise try this already compiled script: https://file.io/peMihp5nEzJj


02-16-2023 , 06:37 PM
I ahk made the exe file in the same way as you did. I don't know why
02-16-2023 , 06:40 PM
Maybe there's something wrong with the code?
02-16-2023 , 07:24 PM
The code is fine. The ahk file work fine with run as admin mode, also I can compile the file to an exe.
So i would guess something is wrong on your backend. Deinstall autohotkey and reinstall:

https://www.autohotkey.com/download/ahk-install.exe

This is the newest code available for this script:

Code:
;***************************************************************************************
; BET POT - GGPoker
; By Annuit20
; Feb 2022
;v1.4
; Thanks to Sheetah, Dave, Juk, probably some other 2+2 coders and Autohotkey forums folks
;***************************************************************************************

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
CoordMode, Pixel, Relative

; ******************************* PARAMETERS *****************************************
; If you want something to edit/fine tune this is where you should look.
; All coordintaes are 'percentage' coords based on client (not ahk native window)

MouseOverPop := true ; if true => table will be put to front if mouse over
xRB := 0.80
yRB := 0.92
xTB := 0.817 ;0.818
yTB := 0.931 ;0.927

;***************************************************************************************
;******************************* GLOBAL VARIABLES **********************************

w_client := 0
h_client := 0


if(MouseOverPop == true)
	SetTimer, WatchCursor, 100


; ******************************* HOTKEYS **************************************

$RButton::
	MouseGetPos,,,hwnd
		if(ValidateTable(hwnd) != true)
			Send, {RButton}
		else
			if(ValidateTableAction(hwnd) == true)
				ClientClick(hwnd,xRB,yRB)
				;msgbox, checkfold
					else
				;msgbox, seF1
				Send, {F1}
	return
	
	
~MButton::
	MouseGetPos,,,hwnd
	if(ValidateTable(hwnd) == true)
	Send, {F3}
	return
	
	
~XButton1::
	MouseGetPos,,,hwnd
	if(ValidateTable(hwnd) == true)
	Send, {F2}
	return
	
	
~XButton2::
	MouseGetPos,,,hwnd
	if(ValidateTable(hwnd) == true)
	Send, {F4}
	return
	
	
; ****************************** FUNCTIONS ***************************************

ClientClick(hwnd,x,y){
	global w_client,h_client
	xc := Round(x*w_client)
	yc := Round(y*h_client)
	PostLeftClick(xc,yc,hwnd) 
}


ValidateTable(hwnd){
	WinGetClass,wclass,ahk_id%hwnd%
	WinGetTitle,wtitle,ahk_id%hwnd%
		;if wtitle not contains NLH,PLO,Table,Hold'em,Spin,SD,Battle
			;return false
		if(wclass = "ApolloRuntimeContentWindow")
			return true
		else
			return false	
}


ValidateTableAction(hwnd){
	global w_client,h_client,xTB,yTB
	GetClientSize(hwnd,w_client,h_client)
	ClientToWin(hwnd,xpi,ypi)
		xpi := (xTB*w_client)
		ypi := (yTB*h_client)
		;MouseMove, xpi, ypi
		PixelGetColor,color,xpi,ypi
		RGB(color,r,g,b)
			If(b > 150 and g > 150)
				return true
			else
				return false
}


RGB(colour, byRef r, byRef g, byRef b)
{
    r := colour >> 16 
    g := (colour >> 8) & 0xFF
    b := colour & 0xFF 
    return
}


WatchCursor:
    OnMM()
return


OnMM()
{
	MouseGetPos,,,hwnd
	if(ValidateTable(hwnd) != false)
	WinActivate,ahk_id%hwnd%
}


; *********************** RANDOM USEFUL FUNCTIONS **************

PostLeftClick(x, y, table_id, activate=1) {
; ### JUK: Send the down left click, then the mouse-up messages.
; NOTE: This is relative to the top left of the client area and NOT the top left of the
;       window (ie: It *doesn't* include the title-bar like AHK's MouseClick does!!!).
If activate
 WinActivate, ahk_id%table_id%
PostMessage, 0x201, 0x0001, ((y<<16)^x), , ahk_id%table_id%
PostMessage, 0x202 , 0, ((y<<16)^x), , ahk_id%table_id%
}

GetClientSize(hwnd, ByRef w, ByRef h)
{
    VarSetCapacity(rc, 16)
    DllCall("GetClientRect", "uint", hwnd, "uint", &rc)
    w := NumGet(rc, 8, "int")
    h := NumGet(rc, 12, "int")
}

WinToClient(hwnd, ByRef x, ByRef y)
{
    WinGetPos, wx, wy,,, ahk_id %hwnd%
    VarSetCapacity(pt, 8)
    NumPut(x + wx, pt, 0)
    NumPut(y + wy, pt, 4)
    DllCall("ScreenToClient", "uint", hwnd, "uint", &pt)
    x := NumGet(pt, 0, "int")
    y := NumGet(pt, 4, "int")
}

ClientToWin(hwnd, ByRef x, ByRef y)
{
    VarSetCapacity(pt, 8)
    NumPut(x, pt, 0)
    NumPut(y, pt, 4)
    DllCall("ClientToScreen", "uint", hwnd, "uint", &pt)
    WinGetPos, wx, wy,,, ahk_id %hwnd%
    x := NumGet(pt, 0, "int") - wx
    y := NumGet(pt, 4, "int") - wy
}

GetClientRect(hwnd,ByRef X2, ByRef Y2)
{
	VarSetCapacity(rc,16)
	DllCall("GetClientRect", "Uint", hwnd, "Uint", &rc)
	X2:=NumGet(rc,8,"Int")
	Y2:=NumGet(rc,12,"Int")
	
}
02-17-2023 , 06:16 PM
You need to install mpress. EXE software can only be this compressed, I did not find this compressed file installed
07-17-2023 , 07:17 PM
WPN added (beta):
I use red buttons and gray background!

Code:
;***************************************************************************************
; BET POT - GG WPN Combo
; By Annuit20
; Mar 2023
;v1.0
; Thanks to Sheetah, Dave, Juk, probably some other 2+2 coders and Autohotkey forums folks
;***************************************************************************************

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
CoordMode, Pixel, Relative

; ******************************* PARAMETERS *****************************************
; If you want something to edit/fine tune this is where you should look.
; All coordintaes are 'percentage' coords based on client (not ahk native window)

MouseOverPop := true ; if true => table will be put to front if mouse over
xRBGG := 0.80
yRBGG := 0.92
xTBGG := 0.817
yTBGG := 0.931
xRBWPN := 0.75
yRBWPN := 0.94
xTBWPN := 0.47
yTBWPN := 0.94
xMBWPN := 0.90
yMBWPN := 0.94
xXBWPN := 0.72
yXBWPN := 0.94

;***************************************************************************************
;******************************* GLOBAL VARIABLES **********************************

w_client := 0
h_client := 0


if(MouseOverPop == true)
	SetTimer, WatchCursor, 500


; ******************************* HOTKEYS **************************************

$RButton::
	MouseGetPos,,,hwnd
		if(ValidateTableGG(hwnd) != true) And (ValidateTableWPN(hwnd) != true)
			Send, {RButton}
		else
			if(ValidateTableActionGG(hwnd) == true)
				ClientClickGG(hwnd,xRBGG,yRBGG)
					else if (ValidateTableGG(hwnd) == true)
				Send, {F1}
			else if (ValidateTableActionWPN(hwnd) == true)
				ClientClickWPN(hwnd,xTBWPN,yTBWPN)
					else
						ClientClickWPN(hwnd,xRBWPN,yRBWPN)
	return
	
	
~MButton::
	MouseGetPos,,,hwnd
	if(ValidateTableGG(hwnd) == true)
	Send, {F3}
	Else if (ValidateTableWPN(hwnd) == true)
	Send, {F3}
	return
	
~XButton1::
	MouseGetPos,,,hwnd
	if(ValidateTableGG(hwnd) == true)
	Send, {F2}
	Else if (ValidateTableWPN(hwnd) == true)
	Send, {F2}
	return
	
~XButton2::
	MouseGetPos,,,hwnd
	if(ValidateTableGG(hwnd) == true)
	Send, {F4}
	Else if(ValidateTableWPN(hwnd) == true)
			Send, {F4}
			sleep,300
			Send, {F3}	
	return

; ****************************** FUNCTIONS ***************************************

ClientClickGG(hwnd,x,y){
	global w_client,h_client
	xc := Round(x*w_client)
	yc := Round(y*h_client)
	PostLeftClick(xc,yc,hwnd) 
}

ClientClickWPN(hwnd,x,y){
	global w_client,h_client
	xc := Round(x*w_client)
	yc := Round(y*h_client)
	PostLeftClick(xc,yc,hwnd) 
}
ValidateTableGG(hwnd){
	WinGetClass,wclass,ahk_id%hwnd%
	WinGetTitle,wtitle,ahk_id%hwnd%
		if(wclass = "ApolloRuntimeContentWindow")
			return true
		else
			return false	
}

ValidateTableActionGG(hwnd){
	global w_client,h_client,xTBGG,yTBGG
	GetClientSize(hwnd,w_client,h_client)
	ClientToWin(hwnd,xpi,ypi)
		xpi := (xTBGG*w_client)
		ypi := (yTBGG*h_client)
		PixelGetColor,color,xpi,ypi
		RGB(color,r,g,b)
			If(b > 150 and g > 150)
				return true
			else
				return false
}

ValidateTableWPN(hwnd){
	WinGetClass,wclass,ahk_id%hwnd%
	WinGetTitle,wtitle,ahk_id%hwnd%
		if(wclass = "Chrome_WidgetWin_1")
			return true
		else
			return false
}
			
ValidateTableActionWPN(hwnd){
	global w_client,h_client,xTBWPN,yTBWPN
	GetClientSize(hwnd,w_client,h_client)
	ClientToWin(hwnd,xpi,ypi)
		xpi := (xTBWPN*w_client)
		ypi := (yTBWPN*h_client)
		PixelGetColor,color,xpi,ypi
		RGB(color,r,g,b)
			If(b > 200 and g > 200 and r > 200)
				return false
			else
				return true
}				

RGB(colour, byRef r, byRef g, byRef b)
{
    r := colour >> 16 
    g := (colour >> 8) & 0xFF
    b := colour & 0xFF 
    return
}


WatchCursor:
    OnMM()
return


OnMM()
{
	MouseGetPos,,,hwnd
	if(ValidateTableGG(hwnd) == true) or (ValidateTableWPN(hwnd) == true)
	WinActivate,ahk_id%hwnd%
}


; *********************** RANDOM USEFUL FUNCTIONS **************

PostLeftClick(x, y, table_id, activate=1) {
; ### JUK: Send the down left click, then the mouse-up messages.
; NOTE: This is relative to the top left of the client area and NOT the top left of the
;       window (ie: It *doesn't* include the title-bar like AHK's MouseClick does!!!).
If activate
 WinActivate, ahk_id%table_id%
PostMessage, 0x201, 0x0001, ((y<<16)^x), , ahk_id%table_id%
PostMessage, 0x202 , 0, ((y<<16)^x), , ahk_id%table_id%
}

GetClientSize(hwnd, ByRef w, ByRef h)
{
    VarSetCapacity(rc, 16)
    DllCall("GetClientRect", "uint", hwnd, "uint", &rc)
    w := NumGet(rc, 8, "int")
    h := NumGet(rc, 12, "int")
}

WinToClient(hwnd, ByRef x, ByRef y)
{
    WinGetPos, wx, wy,,, ahk_id %hwnd%
    VarSetCapacity(pt, 8)
    NumPut(x + wx, pt, 0)
    NumPut(y + wy, pt, 4)
    DllCall("ScreenToClient", "uint", hwnd, "uint", &pt)
    x := NumGet(pt, 0, "int")
    y := NumGet(pt, 4, "int")
}

ClientToWin(hwnd, ByRef x, ByRef y)
{
    VarSetCapacity(pt, 8)
    NumPut(x, pt, 0)
    NumPut(y, pt, 4)
    DllCall("ClientToScreen", "uint", hwnd, "uint", &pt)
    WinGetPos, wx, wy,,, ahk_id %hwnd%
    x := NumGet(pt, 0, "int") - wx
    y := NumGet(pt, 4, "int") - wy
}

GetClientRect(hwnd,ByRef X2, ByRef Y2)
{
	VarSetCapacity(rc,16)
	DllCall("GetClientRect", "Uint", hwnd, "Uint", &rc)
	X2:=NumGet(rc,8,"Int")
	Y2:=NumGet(rc,12,"Int")
	
}
07-17-2023 , 07:19 PM
btw if anyone can help with an table highlighter (put color frame on Hero's turn) for GG and WPN or even more that would be super great!
07-25-2023 , 04:58 PM
Error in upper code. WPN works with aspect ratio like 640:472, otherwise script has to be adjusted.

Code:
;***************************************************************************************
; BET POT - GG WPN Combo
; By Annuit20
; Jul 2023
;v1.1
; Thanks to Sheetah, Dave, Juk, probably some other 2+2 coders and Autohotkey forums folks
;***************************************************************************************

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
CoordMode, Pixel, Relative

; ******************************* PARAMETERS *****************************************
; If you want something to edit/fine tune this is where you should look.
; All coordintaes are 'percentage' coords based on client (not ahk native window)

MouseOverPop := true ; if true => table will be put to front if mouse over
xRBGG := 0.80
yRBGG := 0.92
xTBGG := 0.817
yTBGG := 0.931
xRBWPN := 0.54
yRBWPN := 0.94
xTBWPN := 0.703
yTBWPN := 0.961
xMBWPN := 0.90
yMBWPN := 0.94
xXBWPN := 0.72
yXBWPN := 0.94

;***************************************************************************************
;******************************* GLOBAL VARIABLES **********************************

w_client := 0
h_client := 0


if(MouseOverPop == true)
	SetTimer, WatchCursor, 500


; ******************************* HOTKEYS **************************************

$RButton::
	MouseGetPos,,,hwnd
		if(ValidateTableGG(hwnd) != true) And (ValidateTableWPN(hwnd) != true)
			Send, {RButton}
		else
			if(ValidateTableActionGG(hwnd) == true)
				ClientClickGG(hwnd,xRBGG,yRBGG)
					else if (ValidateTableGG(hwnd) == true)
				Send, {F1}
		else if (ValidateTableActionWPN(hwnd) == true)
				ClientClickWPN(hwnd,xTBWPN,yTBWPN)
				;msgbox, True
					else if (ValidateTableWPN(hwnd) == true)
				ClientClickWPN(hwnd,xRBWPN,yRBWPN)
				;msgbox, false
	return
	
	
~MButton::
	MouseGetPos,,,hwnd
	if(ValidateTableGG(hwnd) == true)
	Send, {F3}
	Else if (ValidateTableWPN(hwnd) == true)
	Send, {F3}
	return
	
~XButton1::
	MouseGetPos,,,hwnd
	if(ValidateTableGG(hwnd) == true)
	Send, {F2}
	Else if (ValidateTableWPN(hwnd) == true)
	Send, {F2}
	return
	
~XButton2::
	MouseGetPos,,,hwnd
	if(ValidateTableGG(hwnd) == true)
	Send, {F4}
	Else if(ValidateTableWPN(hwnd) == true)
			Send, {F4}
			sleep,300
			Send, {F3}	
	return

; ****************************** FUNCTIONS ***************************************

ClientClickGG(hwnd,x,y){
	global w_client,h_client
	xc := Round(x*w_client)
	yc := Round(y*h_client)
	PostLeftClick(xc,yc,hwnd) 
}

ClientClickWPN(hwnd,x,y){
	global w_client,h_client
	xc := Round(x*w_client)
	yc := Round(y*h_client)
	PostLeftClick(xc,yc,hwnd)
}
ValidateTableGG(hwnd){
	WinGetClass,wclass,ahk_id%hwnd%
	WinGetTitle,wtitle,ahk_id%hwnd%
		if(wclass = "ApolloRuntimeContentWindow")
			return true
		else
			return false	
}

ValidateTableActionGG(hwnd){
	global w_client,h_client,xTBGG,yTBGG
	GetClientSize(hwnd,w_client,h_client)
	ClientToWin(hwnd,xpi,ypi)
		xpi := (xTBGG*w_client)
		ypi := (yTBGG*h_client)
		PixelGetColor,color,xpi,ypi
		RGB(color,r,g,b)
			If(b > 150 and g > 150)
				return true
			else
				return false
}

ValidateTableWPN(hwnd){
	WinGetClass,wclass,ahk_id%hwnd%
	WinGetTitle,wtitle,ahk_id%hwnd%
		if(wclass = "Chrome_WidgetWin_1")
			return true
		else
			return false
}
			
ValidateTableActionWPN(hwnd){
	global w_client,h_client,xTBWPN,yTBWPN
	GetClientSize(hwnd,w_client,h_client)
	ClientToWin(hwnd,xpiwpn,ypiqpn)
		xpiwpn := (xTBWPN*w_client)
		ypiwpn := (yTBWPN*h_client)
		;MouseMove, xpiwpn, ypiwpn
		PixelGetColor,color,xpiwpn,ypiwpn
		RGB(color,r,g,b)
			If(b > 50 and g > 50)
				return true
			else
				return false
}				

RGB(colour, byRef r, byRef g, byRef b)
{
    r := colour >> 16 
    g := (colour >> 8) & 0xFF
    b := colour & 0xFF 
    return
}


WatchCursor:
    OnMM()
return


OnMM()
{
	MouseGetPos,,,hwnd
	if(ValidateTableGG(hwnd) == true) or (ValidateTableWPN(hwnd) == true)
	WinActivate,ahk_id%hwnd%
}


; *********************** RANDOM USEFUL FUNCTIONS **************

PostLeftClick(x, y, table_id, activate=1) {
; ### JUK: Send the down left click, then the mouse-up messages.
; NOTE: This is relative to the top left of the client area and NOT the top left of the
;       window (ie: It *doesn't* include the title-bar like AHK's MouseClick does!!!).
If activate
 WinActivate, ahk_id%table_id%
PostMessage, 0x201, 0x0001, ((y<<16)^x), , ahk_id%table_id%
PostMessage, 0x202 , 0, ((y<<16)^x), , ahk_id%table_id%
}

GetClientSize(hwnd, ByRef w, ByRef h)
{
    VarSetCapacity(rc, 16)
    DllCall("GetClientRect", "uint", hwnd, "uint", &rc)
    w := NumGet(rc, 8, "int")
    h := NumGet(rc, 12, "int")
}

WinToClient(hwnd, ByRef x, ByRef y)
{
    WinGetPos, wx, wy,,, ahk_id %hwnd%
    VarSetCapacity(pt, 8)
    NumPut(x + wx, pt, 0)
    NumPut(y + wy, pt, 4)
    DllCall("ScreenToClient", "uint", hwnd, "uint", &pt)
    x := NumGet(pt, 0, "int")
    y := NumGet(pt, 4, "int")
}

ClientToWin(hwnd, ByRef x, ByRef y)
{
    VarSetCapacity(pt, 8)
    NumPut(x, pt, 0)
    NumPut(y, pt, 4)
    DllCall("ClientToScreen", "uint", hwnd, "uint", &pt)
    WinGetPos, wx, wy,,, ahk_id %hwnd%
    x := NumGet(pt, 0, "int") - wx
    y := NumGet(pt, 4, "int") - wy
}

GetClientRect(hwnd,ByRef X2, ByRef Y2)
{
	VarSetCapacity(rc,16)
	DllCall("GetClientRect", "Uint", hwnd, "Uint", &rc)
	X2:=NumGet(rc,8,"Int")
	Y2:=NumGet(rc,12,"Int")
	
}
08-24-2023 , 06:09 PM
Hello I am using the script mainly to FOLD with right click only and I have one problem. I play spins 10 tables and when I move fast through tables to fold, it missclicks and does call sometimes. I think it is because as I move fast the cursor the script isn't able to read where the cursor is. When I go more slow between tables to use the fold button it works correct. I haven't edited anything.
If you need any more info let me know to try to solve or help. I know some about coding and I've been reading the code of the script but have not idea on how to correct it.

Really thanks for the script is a great job and been using it for some days and it's great.
08-24-2023 , 07:57 PM
Hello,

the script make the table under mouse cursor active. If you move to fast you cursor is already there but the table is not active.

Set a smaller number in this code section. Start with 300 (its ms) and go down to 100, try on micro stacks

if(MouseOverPop == true)
SetTimer, WatchCursor, 500
08-26-2023 , 06:27 PM
the WPN auto fold is also active on my winamax tables, how can i edit it so its just for ACR?
08-26-2023 , 06:33 PM
its because of the window class: Chrome_WidgetWin_1
I guess its the same.

ValidateTableWPN(hwnd){
WinGetClass,wclass,ahk_id%hwnd%
WinGetTitle,wtitle,ahk_id%hwnd%
if(wclass = "Chrome_WidgetWin_1")
return true
else
return false
08-26-2023 , 06:34 PM
So find something this winamax table makes special and say only if this is untrue.
08-29-2023 , 07:22 AM
Ah so it a bit more complicated than i hoped. I have no idea whats im doing, so ill leave it. Thanks for the script
08-29-2023 , 08:39 AM
If you can send an screen shot of the window spy of an winamx table I can try to implement it for you.

Right click the green H in the Taskbar to open window spy and hover over the table.
08-30-2023 , 07:31 AM
[pic removed as per request as is showing balance]

Thanks

Last edited by _dave_; 08-30-2023 at 05:32 PM. Reason: pic removed as per request as is showing balance
08-30-2023 , 08:06 AM
Your window spy ist kind of empty.
Maybe click in the top tight corner follow mouse and be sure you left click one time the table. ach_class etc should have an text.
08-30-2023 , 08:12 AM
Quote:
Originally Posted by Annuit20
Your window spy ist kind of empty.
Maybe click in the top tight corner follow mouse and be sure you left click one time the table. ach_class etc should have an text.


sorry i had clicked off the table, hope this is better
08-30-2023 , 01:25 PM
Quote:
Originally Posted by Big_Mick00


sorry i had clicked off the table, hope this is better
Please test, at my ACR tables the script works. Normally Winamax shouldn't work now.


Code:
;***************************************************************************************
; BET POT - GG WPN Combo
; By Annuit20
; Aug 2023
;v1.4
; Thanks to Sheetah, Dave, Juk, probably some other 2+2 coders and Autohotkey forums folks
;***************************************************************************************

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
CoordMode, Pixel, Relative

; ******************************* PARAMETERS *****************************************
; If you want something to edit/fine tune this is where you should look.
; All coordintaes are 'percentage' coords based on client (not ahk native window)

MouseOverPop := True ; if true => table will be put to front if mouse over
xRBGG := 0.80
yRBGG := 0.92
xTBGG := 0.817
yTBGG := 0.931
xRBWPN := 0.54
yRBWPN := 0.94
xTBWPN := 0.703
yTBWPN := 0.961
xMBWPN := 0.90
yMBWPN := 0.94
xXBWPN := 0.72
yXBWPN := 0.94

;***************************************************************************************
;******************************* GLOBAL VARIABLES **********************************

w_client := 0
h_client := 0


if(MouseOverPop == true)
	SetTimer, WatchCursor, 300


; ******************************* HOTKEYS **************************************

$RButton::
	MouseGetPos,,,hwnd
		if(ValidateTableGG(hwnd) != true) And (ValidateTableWPN(hwnd) != true)
			Send, {RButton}
		else
			if(ValidateTableActionGG(hwnd) == true)
				ClientClickGG(hwnd,xRBGG,yRBGG)
					else if (ValidateTableGG(hwnd) == true)
				Send, {F1}
		else if (ValidateTableActionWPN(hwnd) == true)
				ClientClickWPN(hwnd,xTBWPN,yTBWPN)
				;msgbox, True
					else if (ValidateTableWPN(hwnd) == true)
				ClientClickWPN(hwnd,xRBWPN,yRBWPN)
				;msgbox, false
	return
	
	
~MButton::
	MouseGetPos,,,hwnd
	if(ValidateTableGG(hwnd) == true)
	Send, {F3}
	Else if (ValidateTableWPN(hwnd) == true)
	Send, {F3}
	return
	
~XButton1::
	MouseGetPos,,,hwnd
	if(ValidateTableGG(hwnd) == true)
	Send, {F2}
	Else if (ValidateTableWPN(hwnd) == true)
	Send, {F2}
	return
	
~XButton2::
	MouseGetPos,,,hwnd
	if(ValidateTableGG(hwnd) == true)
	Send, {F4}
	Else if(ValidateTableWPN(hwnd) == true)
			Send, {F4}
			sleep,300
			Send, {F3}	
	return

; ****************************** FUNCTIONS ***************************************

ClientClickGG(hwnd,x,y){
	global w_client,h_client
	xc := Round(x*w_client)
	yc := Round(y*h_client)
	PostLeftClick(xc,yc,hwnd) 
}

ClientClickWPN(hwnd,x,y){
	global w_client,h_client
	xc := Round(x*w_client)
	yc := Round(y*h_client)
	PostLeftClick(xc,yc,hwnd)
}
ValidateTableGG(hwnd){
	WinGetClass,wclass,ahk_id%hwnd%
	WinGetTitle,wtitle,ahk_id%hwnd%
		if(wclass = "ApolloRuntimeContentWindow")
			return true
		else
			return false	
}

ValidateTableActionGG(hwnd){
	global w_client,h_client,xTBGG,yTBGG
	GetClientSize(hwnd,w_client,h_client)
	ClientToWin(hwnd,xpi,ypi)
		xpi := (xTBGG*w_client)
		ypi := (yTBGG*h_client)
		PixelGetColor,color,xpi,ypi
		RGB(color,r,g,b)
			If(b > 150 and g > 150)
				return true
			else
				return false
}

ValidateTableWPN(hwnd){
    WinGetClass, wclass, ahk_id %hwnd%
    WinGetTitle, wtitle, ahk_id %hwnd%
    WinGet, ahx_exe, ProcessName, ahk_id %hwnd%
    if (wclass = "Chrome_WidgetWin_1" && ahx_exe = "ACRPoker.exe")
        return true
    else
        return false
}
			
ValidateTableActionWPN(hwnd){
	global w_client,h_client,xTBWPN,yTBWPN
	GetClientSize(hwnd,w_client,h_client)
	ClientToWin(hwnd,xpiwpn,ypiqpn)
		xpiwpn := (xTBWPN*w_client)
		ypiwpn := (yTBWPN*h_client)
		;MouseMove, xpiwpn, ypiwpn
		PixelGetColor,color,xpiwpn,ypiwpn
		RGB(color,r,g,b)
			If(b > 150 and g > 150)
				return true
			else
				return false
}				

RGB(colour, byRef r, byRef g, byRef b)
{
    r := colour >> 16 
    g := (colour >> 8) & 0xFF
    b := colour & 0xFF 
    return
}


WatchCursor:
    OnMM()
return


OnMM()
{
	MouseGetPos,,,hwnd
	if(ValidateTableGG(hwnd) == true) or (ValidateTableWPN(hwnd) == true)
	WinActivate,ahk_id%hwnd%
}


; *********************** RANDOM USEFUL FUNCTIONS **************

PostLeftClick(x, y, table_id, activate=1) {
; ### JUK: Send the down left click, then the mouse-up messages.
; NOTE: This is relative to the top left of the client area and NOT the top left of the
;       window (ie: It *doesn't* include the title-bar like AHK's MouseClick does!!!).
If activate
 WinActivate, ahk_id%table_id%
PostMessage, 0x201, 0x0001, ((y<<16)^x), , ahk_id%table_id%
PostMessage, 0x202 , 0, ((y<<16)^x), , ahk_id%table_id%
}

GetClientSize(hwnd, ByRef w, ByRef h)
{
    VarSetCapacity(rc, 16)
    DllCall("GetClientRect", "uint", hwnd, "uint", &rc)
    w := NumGet(rc, 8, "int")
    h := NumGet(rc, 12, "int")
}

WinToClient(hwnd, ByRef x, ByRef y)
{
    WinGetPos, wx, wy,,, ahk_id %hwnd%
    VarSetCapacity(pt, 8)
    NumPut(x + wx, pt, 0)
    NumPut(y + wy, pt, 4)
    DllCall("ScreenToClient", "uint", hwnd, "uint", &pt)
    x := NumGet(pt, 0, "int")
    y := NumGet(pt, 4, "int")
}

ClientToWin(hwnd, ByRef x, ByRef y)
{
    VarSetCapacity(pt, 8)
    NumPut(x, pt, 0)
    NumPut(y, pt, 4)
    DllCall("ClientToScreen", "uint", hwnd, "uint", &pt)
    WinGetPos, wx, wy,,, ahk_id %hwnd%
    x := NumGet(pt, 0, "int") - wx
    y := NumGet(pt, 4, "int") - wy
}

GetClientRect(hwnd,ByRef X2, ByRef Y2)
{
	VarSetCapacity(rc,16)
	DllCall("GetClientRect", "Uint", hwnd, "Uint", &rc)
	X2:=NumGet(rc,8,"Int")
	Y2:=NumGet(rc,12,"Int")
	
}
08-30-2023 , 03:35 PM
It works, thank you
08-30-2023 , 08:34 PM
the right button just checks but wont check/fold

Last edited by iluvbubees; 08-30-2023 at 08:58 PM.
Closed Thread Subscribe
...

      
m