Code:
#InstallKeybdHook
/*
------------------------------------------
Change Log
------------------------------------------
@00:00 3/10/10:
• Changed Method to close "Are you sure you want to fold, it's free to check" dialog: was previously a loop that attempted to close and often missed the dialog. Now's it's part of the ClosePopUps Timer; for better reliability
• Changed ClosePopUps Timer to 250ms from 500ms.
• Added Auto Join Wait List Function: Automatically clicks "Take me to the table and remove my name from the waiting list" (Button3) via ClosePopUps Timer
• Added Auto Open Wait Listed Tables Function: Automatically clicks Button #### ("Join Table ######### ") via ClosePopUps Timer; Also added Hot Key to toggle on and off during game play, so tables won't keep automatically opening.
• Added Auto Close News Popup Function
• Added Auto Confirm Leave Table Function
• Removed unnecessary "HokKey, IfWinActive lines"
• Added LobbyKeeper function
• Added default values for first time run (no auto options set, Classic View = Default)
• Added functionality to restore mouse position after closing any popups (InitiateClosePopUps)
*/
#SingleInstance, Force
#NoEnv
Version = 2.0
OnExit exitSub
StringTrimRight, thisahk, A_ScriptName, 4
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode, 2
Menu, Tray, NoStandard
Menu, Tray, Add, Settings, menugui
Menu, Tray, Add, Setup Help, DisplayHelp
Menu, Tray, Add
Menu, Tray, Add, Reload, reload
Menu, Tray, Default, Settings
Menu, Tray, Add
Menu, Tray, Add, Suspend, Suspend
Menu, Tray, Add, Pause, TogglePause
Menu, Tray, Add
Menu, Tray, Add, Donate, Donation
Menu, Tray, Add, Exit, ExitSub
OnMessage(0x112,"WM_SYSCOMMAND")
WM_SYSCOMMAND(wParam)
{
if (A_Gui && wParam = 0xF020) ; SC_MINIMIZE
{
Gui, Destroy
return 0
}
}
SetBatchLines,-1
SetWinDelay,-1
SendMode Input
GroupAdd, TABLES, ahk_class DxWndClass
GroupAdd, LOBBYTABLES, ahk_class DxWndClass
GroupAdd, LOBBYTABLES, ahk_class QDPKGamesSystems
GroupAdd, PokerTables, ahk_class PokerStarsTableFrameClass ; PokerStars
GroupAdd, PokerTables, - Logged In As ahk_class QWidget,,,Full Tilt Poker - ; Full Tilt Poker
GroupAdd, PokerTables, - Logged In As ahk_class QWidget,,,Full Tilt Poker - ; Full Tilt Poker
GroupAdd, PokerTables, ahk_class DxWndClass ; Ultimate Bet
SetTimer, ClosePopUps, 250
GoSub,GetIni
if Top = 1
{
foldxa := 440
foldya := 570
CheckFoldYa = 540
potxa := 760
potya := 505
halfpotxa := 700
halfpotya := 505
}
if Classic = 1
{
foldxa := 290
foldya := 490
CheckFoldYa = ; Add Correct Value here for Classic View
potxa := 650
potya := 480
}
Return
;==========================================;
ClosePopUps:
IfWinExist, UB ahk_class #32770,, UB Browser
ControlClick, Button1
IfWinExist, Absolute Poker ahk_class #32770,, AP Browser
ControlClick, Button1
IfWinExist, Tournament Registration ahk_class #32770
ControlClick, Button1
IfWinExist, Alert ahk_class DXPopupWnd
ControlClick, Button1
IfWinExist, Waiting list ahk_class DXPopupWnd
ControlClick, Button1
IfWinExist, Tip for speeding ahk_class DXPopupWnd
ControlClick, Button1
If AutoCloseNewsPopup
IfWinExist, News ahk_class #32770, Click to see ; close News window
WinClose, News ahk_class #32770, Click to see
IfWinExist, Info ahk_class DXPopupWnd, Are you sure you want to fold ; close checking is free window
{
ControlClick, Button2, Info ahk_class DXPopupWnd, Checking is free.
}
If AutoJoinWaitList
IfWinExist, Waiting list ahk_class #32770, Join the waiting list for ; Click "join" when wait list popup appears
{
ControlClick, Button7, Waiting list ahk_class #32770, Join the waiting list for
ControlClick, OK, Waiting list ahk_class #32770, Join the waiting list for
}
If (AutoOpenWaitListTable and AutoOpenWaitListTableToggle) ; Automatically open wait listed table
IfWinExist, Waiting list ahk_class #32770, A seat has opened up at table
{
Msgbox, Msg Line:%A_LineNumber%`n`n
ControlClick, Button4, Waiting list ahk_class #32770, A seat has opened up at table ; take seat and remain on other wait lists
ControlClick, OK, Waiting list ahk_class #32770, A seat has opened up at table
}
If AutoConfirmExitTable
IfWinExist, Warning ahk_class DXPopupWnd, Are you sure you want to leave the table?
{
ControlClick, OK, Warning ahk_class DXPopupWnd, Are you sure you want to leave the table?
}
If AutoBuyIn ; Auto Buyin Close
IfWinExist, Buy chips ahk_class DXPopupWnd
{
ControlClick, Button3, Buy chips ahk_class DXPopupWnd
}
GoSub, TableActivateUnderMouse
;------------------------------------------
; Lobby Keeper
; ------------------------------------------
If !LobbyKeeper
Return
WinGet, LobbySize, MinMax, UB - Logged in as ahk_class QDPKGamesSystems ; Get UB Lobby Size
If (DesiredLobbySize = "Min")
If (LobbySize = -1)
Return ; Lobby is minimized
Else
{
WinMinimize, UB - Logged in as ahk_class QDPKGamesSystems ; Minimize Lobby
Return
}
If (LobbySize != -1) ; Desired LobbySize is Max
Return ; Lobby is not minimized (is maximized or is default size), return
WinRestore, UB - Logged in as ahk_class QDPKGamesSystems ; LobbySize is not max/restored, restore
Return
;------------------------------------------;
BuildGUI:
Menu, MenuMenu, Add, About, About
Menu, MenuMenu, Add, Donate, Donation
Menu, MenuMenu, Add, Help, Help
Menu, Menubar, Add, Menu, :MenuMenu
Gui, Menu, MenuBar
Gui, Color, White
Gui, Add, Text, x12 y30 w64 h13 , Fold/Autofold
Gui, Add, Edit, x157 y28 w70 h20 vFold, %Fold%
Gui, Add, Text, x12 y60 w53 h13 , Check/Call
Gui, Add, Edit, x157 y58 w70 h20 vCall, %Call%
Gui, Add, Text, x12 y90 w48 h13 , Bet/Raise
Gui, Add, Edit, x157 y88 w70 h20 vBet, %Bet%
Gui, Add, Text, x11 y122 w48 h13 , All In
Gui, Add, Edit, x156 y117 w70 h20 vAllIn, %AllIn%
Gui, Add, Text, x12 y150 w16 h13 , Pot
Gui, Add, Edit, x157 y148 w70 h20 vBetPot, %BetPot%
Gui, Add, Text, x12 y180 w38 h13 , Half Pot
Gui, Add, Edit, x157 y178 w70 h20 vBetHalfPot, %BetHalfPot%
Gui, Add, Text, x12 y210 w57 h13 , Stack Cycle
Gui, Add, Edit, x157 y208 w70 h20 vStackCycle, %StackCycle%
Gui, Add, Text, x12 y240 w110 h13 , Register in Tournament
Gui, Add, Edit, x157 y238 w70 h20 vRegisterTournament, %RegisterTournament%
Gui, Add, Text, x12 y280 w53 h13 , Table View
Gui, Add, Radio, x157 y280 w70 h13 Checked%Classic% vClassic, Classic
Gui, Add, Radio, x157 y300 w70 h13 Checked%Top% vTop, Top
Gui, Add, Checkbox, x15 y317 w110 h20 Checked%AutoBuyIn% vAutoBuyIn, Auto Buy In
Gui, Add, Checkbox, x15 y347 w110 h20 Checked%AutoJoinWaitList% vAutoJoinWaitList, Auto Join Wait List
Gui, Add, Checkbox, x15 y377 w150 h20 Checked%AutoCloseNewsPopup% vAutoCloseNewsPopup, Auto Close News Pop Ups
Gui, Add, Checkbox, x15 y407 w210 h20 Checked%AutoConfirmExitTable% vAutoConfirmExitTable, Auto Confirm Leave Table Confirmation
Gui, Add, GroupBox, x5 y437 w230 h80 , Automagically Open Wait Listed Tables
Gui, Add, Checkbox, x14 y455 w110 h20 Checked%AutoOpenWaitListTable% vAutoOpenWaitListTable, Auto Open Table
Gui, Add, Text, x14 y485 w120 h20 , Toggle Enable/Disable
Gui, Add, Edit, x154 y483 w70 h20 vAutoOpenWaitListTableToggle, %AutoOpenWaitListTableToggle%
Gui, Add, GroupBox, x5 y527 w230 h80 , Lobby Keeper
Gui, Add, Checkbox, x14 y547 w219 h20 Checked%LobbyKeeper% vLobbyKeeper, Enable Keep Lobby Minimized/Maximized ;Enable Keep Lobby Minimized/Maximized
Gui, Add, Text, x15 y570 w120 h27 , Toggle Minimize/Restore Lobby
Gui, Add, Edit, x155 y573 w70 h20 vLobbySizeToggle, %LobbySizeToggle%
Gui, Add, Button, x15 y617 w100 h30 gSave, Submit
Gui, Add, Button, x125 y617 w100 h30 gCancel, Cancel
Gui, Show,, % thisahk . " " . Version
Return
;------------------------------------------;
GetIni:
IfNotExist, %thisahk%.ini
GoSub, CreateIni
IniRead, Fold, %thisahk%.ini, Other, Fold, %A_Space%
IniRead, Call, %thisahk%.ini, Other, Call, %A_Space%
IniRead, Bet, %thisahk%.ini, Other, Bet, %A_Space%
IniRead, AllIn, %thisahk%.ini, Other, AllIn, %A_Space%
IniRead, BetPot, %thisahk%.ini, Other, BetPot, %A_Space%
IniRead, BetHalfPot, %thisahk%.ini, Other, BetHalfPot, %A_Space%
IniRead, StackCycle, %thisahk%.ini, Other, StackCycle, %A_Space%
IniRead, RegisterTournament, %thisahk%.ini, Other, RegisterTournament, %A_Space%
IniRead, Classic, %thisahk%.ini, Other, Classic, %A_Space%
IniRead, Top, %thisahk%.ini, Other, Top, %A_Space%
IniRead, AutoBuyIn, %thisahk%.ini, Other, AutoBuyIn, %A_Space%
IniRead, AutoJoinWaitList, %thisahk%.ini, Other, AutoJoinWaitList, %A_Space%
IniRead, AutoOpenWaitListTable, %thisahk%.ini, Other, AutoOpenWaitListTable, %A_Space%
IniRead, AutoOpenWaitListTableToggle, %thisahk%.ini, Other, AutoOpenWaitListTableToggle, %A_Space%
IniRead, AutoCloseNewsPopup, %thisahk%.ini, Other, AutoCloseNewsPopup, %A_Space%
IniRead, AutoConfirmExitTable, %thisahk%.ini, Other, AutoConfirmExitTable, %A_Space%
IniRead, AutoOpenWaitListTable, %thisahk%.ini, Other, AutoOpenWaitListTable, %A_Space%
IniRead, AutoOpenWaitListTableToggle, %thisahk%.ini, Other, AutoOpenWaitListTableToggle, %A_Space%
IniRead, LobbyKeeper, %thisahk%.ini, Other, LobbyKeeper, %A_Space%
IniRead, LobbySizeToggle, %thisahk%.ini, Other, LobbySizeToggle, %A_Space%
Hotkey, IfWinActive ; make next hotkey assignments Context insensitive
If AutoOpenWaitListTable ; If Enabled, create toggle hotkey
Hotkey, %AutoOpenWaitListTableToggle%, AutoOpenWaitListTableToggle ,
Hotkey, IfWinExist, UB - Logged in as ahk_class QDPKGamesSystems ; make next hotkey assignments Context sensitive (only when lobby exists)
If LobbyKeeper ; If Enabled, create toggle hotkey
Hotkey, %LobbySizeToggle%, LobbySizeToggle , UseErrorLevel On
Hotkey, IfWinActive, ahk_group TABLES ; Make all following Hotkeys Context Sensitive (only active when TABLES ahk_group is active)
if Fold
Hotkey, %Fold%,Fold, UseErrorLevel On
if Call
Hotkey, %Call%,Call, UseErrorLevel On
if AllIn
Hotkey, %AllIn%,AllIn, UseErrorLevel On
if Bet
Hotkey, %Bet%,Bet, UseErrorLevel On
if BetPot
Hotkey, %BetPot%,Betpot, UseErrorLevel On
if BetHalfPot
Hotkey, %BetHalfPot%,BetHalfPot, UseErrorLevel On
if StackCycle
Hotkey, %StackCycle%,StackCycle, UseErrorLevel On
Hotkey, IfWinActive, ahk_group LOBBYTABLES
if RegisterTournament
Hotkey, %RegisterTournament%,RegisterTournament, UseErrorLevel On
return
;------------------------------------------;
MakeIni:
IniWrite, %Fold%, %thisahk%.ini, Other, Fold
IniWrite, %Call%, %thisahk%.ini, Other, Call
IniWrite, %Bet%, %thisahk%.ini, Other, Bet
IniWrite, %AllIn%, %thisahk%.ini, Other, AllIn
IniWrite, %BetPot%, %thisahk%.ini, Other, BetPot
IniWrite, %BetHalfPot%, %thisahk%.ini, Other, BetHalfPot
IniWrite, %StackCycle%, %thisahk%.ini, Other, StackCycle
IniWrite, %RegisterTournament%, %thisahk%.ini, Other, RegisterTournament
IniWrite, %Top%, %thisahk%.ini, Other, Top
IniWrite, %Classic%, %thisahk%.ini, Other, Classic
IniWrite, %AutoBuyIn%, %thisahk%.ini, Other, AutoBuyIn
IniWrite, %AutoJoinWaitList%, %thisahk%.ini, Other, AutoJoinWaitList
IniWrite, %AutoOpenWaitListTable%, %thisahk%.ini, Other, AutoOpenWaitListTable
IniWrite, %AutoOpenWaitListTableToggle%, %thisahk%.ini, Other, AutoOpenWaitListTableToggle
IniWrite, %AutoCloseNewsPopup%, %thisahk%.ini, Other, AutoCloseNewsPopup
IniWrite, %AutoConfirmExitTable%, %thisahk%.ini, Other, AutoConfirmExitTable
IniWrite, %AutoOpenWaitListTable%, %thisahk%.ini, Other, AutoOpenWaitListTable
IniWrite, %AutoOpenWaitListTableToggle%, %thisahk%.ini, Other, AutoOpenWaitListTableToggle
IniWrite, %LobbyKeeper%, %thisahk%.ini, Other, LobbyKeeper
IniWrite, %LobbySizeToggle%, %thisahk%.ini, Other, LobbySizeToggle
return
;------------------------------------------;
CreateIni: ; Ini doen't exist yet
; set default values for first time run:
Classic := True
Top := False
AutoBuyIn := False
AutoJoinWaitList := False
AutoOpenWaitListTable := False
AutoCloseNewsPopup := False
AutoConfirmExitTable := False
AutoOpenWaitListTable := False
LobbyKeeper := False
Gosub, DisplayHelp
GoSub, MakeIni
GoSub, BuildGui
return
;------------------------------------------;
GuiClose:
GoSub, Cancel
return
;------------------------------------------;
MenuGui:
GoSub, GetIni
Winget,id,id, %thisahk% ahk_class AutoHotkeyGUI
if !DllCall( "IsWindowVisible", "UInt",id)
GoSub, BuildGui
Gui, Submit,NoHide
return
;------------------------------------------;
Reload:
Reload
return
;------------------------------------------;
Save:
Gui, Submit
FileDelete, %thisahk%.ini
GoSub, MakeIni
Reload
return
;------------------------------------------;
Cancel:
Gui, Destroy
Return
;------------------------------------------;
TogglePause:
Pause,Toggle
return
;------------------------------------------;
Suspend:
Suspend
return
;------------------------------------------;
Edit:
Edit
return
;------------------------------------------;
Donation:
IfWinExist , UB - Logged in as
{
WinMenuSelectItem, UB - Logged in as,, My Account, Cashier, Account Transfer...
WinWait, UB Browser ahk_class #32770, , 10
Sleep, 6000
MouseClick, left, 290, 310
Send PunchAKitten
Send {Tab}
Send Samuel
return
}
IfWinExist , Absolute Poker - Logged in as
{
WinMenuSelectItem, Absolute Poker - Logged in as,, My Account, Cashier, Account Transfer...
WinWait, Absolute Poker Browser ahk_class #32770, , 10
Sleep, 6000
MouseClick, left, 290, 310
Send PunchAKitten
Send {Tab}
Send Samuel
return
}
Else
{
MsgBox , 0, Donation, If you would like to make a donation my username is PunchAKitten first name Samuel on UB/AP or you can PM me on 2+2 for other options.
return
}
;------------------------------------------;
Help:
run http://www.autohotkey.com/docs/KeyList.html
return
;------------------------------------------;
About:
run http://forumserver.twoplustwo.com/45/software/absolute-ub-hotkeys-656662/
return
;------------------------------------------;
ExitSub:
ExitApp ; release all timers and hot keys (kill persistent)
return
;------------------------------------------;
RegisterTournament:
WinActivate, ahk_class QDPKGamesSystems
ControlClick, Button19, ahk_class QDPKGamesSystems
return
;------------------------------------------;
AutoOpenWaitListTableToggle: ; Toggle Automatically Open Wait Listed Tables Enable
AutoOpenWaitListTableToggle := !AutoOpenWaitListTableToggle
Return
;------------------------------------------;
LobbySizeToggle: ; Toggle Lobby Minimize/Restore
If !LobbyKeeper
Return
IfWinNotActive, UB - Logged in as ahk_class QDPKGamesSystems
{
DesiredLobbySize = Max
WinActivate, UB - Logged in as ahk_class QDPKGamesSystems
Return
}
If DesiredLobbySize = Min
DesiredLobbySize = Max
Else
DesiredLobbySize = Min
Return
;------------------------------------------;
Fold:
MouseGetPos,,,win
WinActivate, ahk_id %win%
MouseGetPos, xx, yy
WinGetPos,,, w, h, A
foldx:=w*(foldxa/800)
foldy:=h*(foldya/600)
MouseClick , left, foldx, foldy, 1, 0 ; click on "Fold" minibutton area
foldy:=h*(CheckFoldYa/600)
MouseClick , left, foldx, foldy, 1, 0 ; click on "Check/Fold" minibutton area
Mousemove, %xx%, %yy%, 0
return
;------------------------------------------;
Call:
MouseGetPos,,,win
WinActivate, ahk_id %win%
Send {F2}{F4}
return
;------------------------------------------;
Bet:
MouseGetPos,,,win
WinActivate, ahk_id %win%
Send {F3}{F5}
return
;------------------------------------------;
StackCycle:
MouseGetPos,,,win
WinSet, Bottom,, ahk_id %win%
return
;------------------------------------------;
BetPot:
MouseGetPos,,,win
WinActivate, ahk_id %win%
MouseGetPos, xx, yy
WinGetPos,,, w, h, A
potx:=w*(potxa/800)
poty:=h*(potya/600)
MouseClick , left, potx, poty, 1, 0
Mousemove, %xx%, %yy%, 0
return
;------------------------------------------;
AllIn:
MouseGetPos,,,win
WinActivate, ahk_id %win%
MouseGetPos, xx, yy
WinGetPos,,, w, h, A
potx:=w*(potxa/800)
poty:=h*(potya/600)
MouseClick , left, potx, poty, 1, 0
SendPlay {WheelUp 100} ;moves betslider 100 times to right.
Mousemove, %xx%, %yy%, 0
return
;------------------------------------------;
BetHalfPot:
MouseGetPos,,,win
WinActivate, ahk_id %win%
MouseGetPos, xx, yy
WinGetPos,,, w, h, A
halfpotx:=w*(halfpotxa/800)
halfpoty:=h*(halfpotya/600)
MouseClick , left, halfpotx, halfpoty, 1, 0
Mousemove, %xx%, %yy%, 0
return
;------------------------------------------;
DisplayHelp:
HelpText =
(
Important Configuration Notes
=============================
Please ensure the following options are set in the UB/Absolute Poker Software:
1) Check the "Hot Key" option.
2) Check the "Disable Pop to Front" option.
3) It is highly recommended that you check the "Disable Fold and Show" option.
(Otherwise all cards you fold will be visible to other players)
)
Msgbox, %HelpText%
Return
;------------------------------------------;
; Auto Click WaitList
; #IfWinActive, UB - Logged in as ahk_class QDPKGamesSystems
; RButton::
; Click ; Click on current Table
; ControlGet, WaitListButton, Visible, , Button112, UB - Logged in as ahk_class QDPKGamesSystems ; If Wait List Button is visable, click it
; If WaitListButton
; ControlClick, Button114, UB - Logged in as ahk_class QDPKGamesSystems ; click wait list button
; Else
; ControlClick, Button113, UB - Logged in as ahk_class QDPKGamesSystems ; click wait UnJoin
; Return
;------------------------------------------;
#IfWinActive
;==========================================;
; finds the WinId of the window that is on top of the stack at position X,Y (screen position numbers) on the screen...
; if there is a HUD on top of our table (listed on the HudClassList), then that HUD will be ignored, and we continue on to find the top table
WindowOnTopAtXY(X,Y)
{
global
local WindowIdList, WinId, WinX, WinY, WinW, WinH
; get a list of all windows on the user's computer
WinGet, WindowIdList, List
; loop thru all of these dialog boxes and see if we need to operate on any of them
Loop, %WindowIdList%
{
; get the next windows id
WinId := WindowIdList%A_index%
WinGetPos,WinX,WinY,WinW,WinH,ahk_id%WinId%
; see if our XY is in the range of this window WinId, AND the WinId is a table
;if ( (X >= WinX) AND (X <= (WinX + WinW)) AND (Y >= WinY) AND (Y <= (WinY + WinH)) AND WinExist("ahk_group Tables ahk_id" . WinId) )
if ( (X >= WinX) AND (X <= (WinX + WinW)) AND (Y >= WinY) AND (Y <= (WinY + WinH)) )
{
; check what the class is of this windows
WinGetClass, Class, ahk_id%WinId%
; kludge fix for Holdem manager class names that are unique for each user. we'll just shorten the class to 16 characters
if instr(Class,"Afx:")
StringLeft,Class,Class,16
; check if the class just identified is in our HudClassList, if so then continue on the find the next window
; we use instr here, because some of the class names in the list are abbreviated from the full class name (holdem manager creates unique class names for each user)
if instr(HudClassList,Class)
continue
return WinId
}
}
return 0
}
TableActivateUnderMouse:
; activate the table under the mouse... if the window under the mouse is not
; a poker table, then just return (0)
; returns the winID of the table,
Sleep 100
{
;local WinId, MouseX, MouseY
; get the screen mouse position
CoordMode, Mouse, Screen
MouseGetPos, MouseX, MouseY
; find the top window at this mouse location... but ignore any huds
WinId := WindowOnTopAtXY(MouseX,MouseY)
WinGetClass, WindowClass, ahk_id%WinId%
; if mouse is over a poker table
IfWinExist, ahk_id%WinId% ahk_group PokerTables
{
; if the table is not active, then activate it
ifWinNotActive,ahk_id%WinId% ahk_group PokerTables
{
WinActivate, ahk_id%WinId% ahk_group PokerTables
}
}
}
Return
This is going to auto-active Full Tilt Poker, PokerStars and Cereus Network tables
If you want to remove auto-focus on FTP table remove the folowing lines from the code
Madlion, if you want to include the code in your next release (with the option in the gui to check/uncheck the function) I don't mind