New AHK: StarsAssistant - Easier multitableing at PokerStars
the problem i see with move mouse is clicking on a seat when it opens up and clicking post/wait for bb. you have to fight to get the mouse where you want it.
it also seems that table highlighter steals focus if you are typing something online?
if u have no overlap is active urgent table pointless?
it also seems that table highlighter steals focus if you are typing something online?
if u have no overlap is active urgent table pointless?
new stars update ****'d the registration up?
since todays stars update, auto take seat doesnt work anymore
can someone help me with that?
can someone help me with that?
bump
+1
BUMP!
Anyone?
Replace old takeseat procedure with this:
Code:
TakeSeat(pid) { IfWinExist, PokerStars ahk_class #32770 ahk_pid%pid% { WinGet, list, list, Seat Available ahk_class #32770 ahk_pid%pid% Loop, %list% { This_id := list%A_Index% ControlFocus, Button2, ahk_id%this_id% Sleep, -1 ControlSend, Button2, {SPACE}, ahk_id%this_id% winactivate, ahk_id%this_id% } } }
Replace this procedure for sng registration:
And this for timebank clicker:
And here is the whole script:
Code:
RegSNGexec(id) { ControlGet, v, Visible, , PokerStarsButtonClass6, ahk_id%id% if !v { ControlGet, v, Visible, , PokerStarsButtonClass8, ahk_id%id% if v { ControlClick, PokerStarsButtonClass8, ahk_id%id% WinWait, Tournament Registration ahk_class #32770, , 10 { WinGet, regid, id ControlFocus, Button3, ahk_id%regid% Sleep, -1 ControlSend, Button3, {SPACE}, ahk_id%regid% } WinWait, Tournament Registration ahk_class #32770, , 10 { WinGet, regid, id ControlGetText, ctext, Button1, ahk_id%regid% if ( cText = "OK" ) { ControlFocus, Button1, ahk_id%regid% Sleep, -1 ControlSend, Button1, {SPACE}, ahk_id%regid% } } } } }
Code:
relStarsClientPoint(id, ByRef x, ByRef y) { SysGet, xbord, 32 SysGet, ybord, 33 SysGet, cap, 4 rw :=0.6582 rh :=0.7729 WinGetPos, , , w, h, ahk_id%id% w := w - (2*xbord) h := h - (2*ybord) - cap Transform, X, Round, W*rw Transform, Y, Round, H*rh x := x + xbord y := y + ybord + cap }
Code:
; #### StarsAssistant #### ; AHK version: 1.0.46.05 ; date: January 05,2008 version := "0.88" ; author: Chris228 @ 2p2 forums ; thx to _dave_, JBOPoker, Roland, JukofYork & pusteblume ; based on ; #### StarsUrgentTable #### ; AHK version: 1.0.46.03 ; date: May 24,2007 ; version: 0.75a ; author: _dave_ @ 2p2 forums ; revised by: JBOPoker @ earthlink.net ; thx to Roland & JukofYork for some of the functions ;===================================================================== ;=================== Settings ======================================== ;===================================================================== ; Hotkeys see below ; Border of the "Highlighter" border_colour := "ff0000" border_size := 5 trans := 255 ; Timings for the "Time Bank Clicker" [fast/turbo 8/17; normal 20/35; both 8/35] timebank_min := 8 timebank_max := 35 ; Beep on urgent table beep := 0 ; Position of the mouse in perc of the table window x_mouse := 0.75 y_mouse := 0.75 ; Don't edit below unless you know what you do (except Hotkeys) ; Gui Settings settings() { global ini:="StarsAssistant.ini" iniRead, AutoOn, %ini%, Prefs, AutoOn, 1 iniRead, Highlight, %ini%, Prefs, Highlight, 1 iniRead, MoveMouse, %ini%, Prefs, MoveMouse, 1 iniRead, TimeBankClicker, %ini%, Prefs, TimeBankClicker, 1 iniRead, AlternateDetection, %ini%, Prefs, AlternateDetection, 0 iniRead, ActivateUrgent, %ini%, Prefs, ActivateUrgent, 0 iniRead, KillPopups, %ini%, Prefs, KillPopups, 0 iniRead, SafeReg, %ini%, Prefs, SafeReg, 1 iniRead, AutoTakeSeat, %ini%, Prefs, AutoTakeSeat, 0 } ; Intervalls for sub execution RefreshQueue_timer := 333 RefreshLobby_timer := 1000 PopUpWatcher_timer := 200 TableColor_timer := 500 ;===================================================================== ;=================== Autoexec ======================================== ;===================================================================== #NoEnv #SingleInstance, Force #Include %a_scriptDir% SendMode Input SetTitleMatchMode, 2 SetWorkingDir %a_scriptDir% OnExit exitSub settings() TrayMenu() BuildGui() Suspend, On SysGet, border, 32 SysGet, caption, 4 if ( AutoOn = 1 ) { Gosub, ButtonOn } return ;===================================================================== ;=================== Hotkeys ========================================= ;===================================================================== ^a:: ToggleCheckbox("MoveMouse") return ^w:: ToggleCheckbox("AlternateDetection") return ^s:: MaxMinLobby(LobbyID) return ^d:: MinMaxStarsAssistant() return ^r:: RegSNG(LobbyID) OpenJoinUnJoinTable(LobbyID) return ^e:: CloseTournamentLobby(LobbyID, LobbyPID) return ;===================================================================== ;=================== Gui ============================================= ;===================================================================== trayMenu() { global Menu, Tray, noStandard Menu, Tray, Add, &Show, Show Menu, Tray, default, &Show Menu, Tray, Add Menu, Tray, Add, &About, About Menu, Tray, Add, &Help, Help Menu, Tray, Add Menu, Tray, Add, E&xit, Exit Menu, Tray, Tip, StarsAssistant v%version% } buildGui() { global Gui 1:Default Gui, +toolwindow +AlwaysOnTop Gui, Margin, 5, 5 Gui, Font,, Verdena Gui, Add, Button, vOn section w56 h20 center, &On Gui, Add, Button, vOff disabled w56 h20 ys xs+56 center, &Off Gui, Add, Checkbox, checked%AutoOn% vAutoOn gSubmit xs+2, &Auto on Gui, Add, Text, section x7 0x1000 w110 h2 Gui, Add, Checkbox, checked%Highlight% vHighlight gSubmit xs, &Highlight table Gui, Add, Checkbox, checked%MoveMouse% vMoveMouse gSubmit xs, &Move mouse Gui, Add, Checkbox, checked%TimeBankClicker% vTimeBankClicker gSubmit xs, &Click time bank Gui, Add, Checkbox, checked%AlternateDetection% vAlternateDetection gSubmit xs, &Detect All-in/Fixed l. Gui, Add, Checkbox, checked%ActivateUrgent% vActivateUrgent gSubmit xs, &Activate urgent table Gui, Add, Checkbox, checked%KillPopups% vKillPopups gSubmit xs, &Kill popups Gui, Add, Checkbox, checked%SafeReg% vSafeReg gSubmit xs, &Safe SNG regist. Gui, Add, Checkbox, checked%AutoTakeSeat% vAutoTakeSeat gSubmit xs, &Auto take seat IniRead, x, % ini, Gui, x, center IniRead, y, % ini, Gui, y, center Gui, Show, x%x% y%y% w124, StarsAssistant } Show: Gui, 1:Show return About: Msgbox,, StarsAssistant, StarsAssistant v%version% `nAuthor: Chris228 @ 2+2 formus`nE-Mail: chris228@gmx.de`nSee file for further credits`n`nIf you like my program I would be happy about a donation.`nMy screenname on PokerStars is 'mr.cray'.`nThank you! return Help: Run % web() "http://overcards.com/wiki/moin.cgi/StarsAssistant" return web() { ; by Titan, modified by Roland regRead, p, HKCR, HTTP\shell\open\command return SubStr(p, 1, InStr(p, ".exe")+4) } Exit: exitApp GuiClose: Gui 1:Cancel return Submit: Gui, 1:Submit, NoHide return exitSub: Gui 1:Default Gui, Submit Gui +lastfound WinGetPos, x, y IniWrite, % x, % ini, Gui, x IniWrite, % y, % ini, Gui, y IniWrite, % AutoOn, % ini, Prefs, AutoOn IniWrite, % Highlight, % ini, Prefs, Highlight IniWrite, % MoveMouse, % ini, Prefs, MoveMouse IniWrite, % TimeBankClicker, % ini, Prefs, TimeBankClicker IniWrite, % AlternateDetection, % ini, Prefs, AlternateDetection IniWrite, % ActivateUrgent, % ini, Prefs, ActivateUrgent IniWrite, % KillPopups, % ini, Prefs, KillPopups IniWrite, % SafeReg, % ini, Prefs, SafeReg IniWrite, % AutoTakeSeat, % ini, Prefs, AutoTakeSeat exitApp MinMaxStarsAssistant() { WinGetActiveTitle, title If ( title = "StarsAssistant" ) Gui 1:Cancel else Gui, 1:Show } ToggleCheckbox(box) { Gui 1:Default GuiControlGet, state, , %box% if ( state = 1 ) GuiControl, , %box%, 0 if ( state = 0 ) GuiControl, , %box%, 1 Gui, 1:Submit, NoHide } ;===================================================================== ;=================== Buttons ========================================= ;===================================================================== ButtonOn: tablecolor:= "" last_table_id := "" tablequeue := "" most_urgent_table := "" GoSub, RefreshLobby GoSub, TableColor SetTimer, RefreshQueue, %RefreshQueue_timer% SetTimer, PopUpWatcher, %PopUpWatcher_timer% SetTimer, RefreshLobby, %RefreshLobby_timer% Suspend, Off GuiControl, 1:Disable, On GuiControl, 1:Enable, Off return ButtonOff: SetTimer, RefreshQueue, Off SetTimer, PopUpWatcher, Off SetTimer, RefreshLobby, Off SetTimer, TableColor, Off Gui, 2: Cancel Gui, 3: Cancel Gui, 4: Cancel Gui, 5: Cancel tablecolor:="" Suspend, On GuiControl, 1:Disable, Off GuiControl, 1:Enable, On return ;===================================================================== ;=================== Urgent Table Functions ========================== ;===================================================================== RefreshQueue: ids := TableIDListStars(LobbyPID) Loop, Parse, tablequeue, `, { StringTrimLeft, this_id, A_LoopField, InStr(A_LoopField, "_") if (!InStr(ids, this_id)) { StringReplace, tablequeue, tablequeue, %A_LoopField%, , All } } Loop, Parse, ids, `, { ControlGet, v, Visible, , PokerStarsSliderEditorClass1, ahk_id%A_LoopField% if ( v = 1 ) { if (!InStr(tablequeue, A_LoopField)) { DllCall("QueryPerformanceCounter", "Int64 *", CurrentQPC) tablequeue := tablequeue . "," . CurrentQPC . "-" . A_TickCount . "_" . A_LoopField } } else { if ( AlternateDetection = 1 ) { color:=TableColor(A_LoopField) if ( color != tablecolor && tablecolor != "" ) { if (!InStr(tablequeue, A_LoopField)) { DllCall("QueryPerformanceCounter", "Int64 *", CurrentQPC) tablequeue := tablequeue . "," . CurrentQPC . "-" . A_TickCount . "_" . A_LoopField } } else { if (InStr(tablequeue, A_LoopField)) { StringReplace, tablequeue, tablequeue, %A_LoopField%, , All } } } else { if (InStr(tablequeue, A_LoopField)) { StringReplace, tablequeue, tablequeue, %A_LoopField%, , All } } } } tmp := "" Loop, Parse, tablequeue, `, { if (InStr(A_LoopField, "0x")) { tmp := tmp . "," . A_LoopField } } Sort, tmp, N D`, tablequeue := CleanList(tmp) most_urgent_table := "" Loop, Parse, tablequeue, `, { StringTrimLeft, most_urgent_table, A_LoopField, InStr(A_LoopField, "_") break } if ( TimeBankClicker = 1 ) { tc := A_TickCount Loop, Parse, tablequeue, `, { StringTrimLeft, waiting_time, A_LoopField, InStr(A_LoopField, "-") StringTrimRight, waiting_time, waiting_time, ( StrLen(waiting_time) - (InStr(waiting_time, "_")-1) ) waiting_time := (tc - waiting_time) / 1000 if (waiting_time > timebank_min && waiting_time < timebank_max) { StringTrimLeft, waiting_table, A_LoopField, InStr(A_LoopField, "_") timebank_x := 560 ; lastmax 565 timebank_y := 430 ; lastmax 430 +/-10 too much relStarsClientPoint(waiting_table, timebank_x, timebank_y) PostLeftClick(timebank_x, timebank_y, waiting_table, 0) } } } if ( ActivateUrgent = 1 ) { WinActivate, ahk_id%most_urgent_table% if ( AlternateDetection = 1 ) { color:=TableColor(most_urgent_table) if ( color != tablecolor ) { if ( Highlight = 1 || MoveMouse = 1) makegui(most_urgent_table, Highlight, MoveMouse, beep, x_mouse, y_mouse) } } else { if ( Highlight = 1 || MoveMouse = 1) makegui(most_urgent_table, Highlight, MoveMouse, beep, x_mouse, y_mouse) } } else { if ( Highlight = 1 || MoveMouse = 1) makegui(most_urgent_table, Highlight, MoveMouse, beep, x_mouse, y_mouse) } return makegui(id="", Highlight=1, MoveMouse=1, beep=0, x_mouse=0.75, y_mouse=0.75 ) { global last_table_id global border_colour global border_size global trans if (id != last_table_id) { last_table_id := id if(!id) { Gui, 2: Cancel Gui, 3: Cancel Gui, 4: Cancel Gui, 5: Cancel return } WinGetPos, x, y, w, h, ahk_id%id% global border global caption x := x + border y := y + border + caption w := w - (2*border) h := h - (2*border) - caption ;Makes Border around urgent table if ( Highlight = 1 ) { ;top guinum := 2 Gui, %guinum%: +Alwaysontop +Lastfound +Owner Gui, %guinum%: Color, %border_colour% WinSet, Transparent, %trans% Gui, %guinum%: -Caption Gui, %guinum%: Show, w%w% h%border_size% x%x% y%y% NoActivate ;left guinum++ Gui, %guinum%: +Alwaysontop +Lastfound +Owner Gui, %guinum%: Color, %border_colour% WinSet, Transparent, %trans% Gui, %guinum%: -Caption Gui, %guinum%: Show, w%border_size% h%h% x%x% y%y% NoActivate ;bottom guinum++ Gui, %guinum%: +Alwaysontop +Lastfound +Owner Gui, %guinum%: Color, %border_colour% WinSet, Transparent, %trans% Gui, %guinum%: -Caption y2 := y + h - border_size Gui, %guinum%: Show, w%w% h%border_size% x%x% y%y2% NoActivate ;right guinum++ Gui, %guinum%: +Alwaysontop +Lastfound +Owner Gui, %guinum%: Color, %border_colour% WinSet, Transparent, %trans% Gui, %guinum%: -Caption x2 := x + w - border_size Gui, %guinum%: Show, w%border_size% h%h% x%x2% y%y% NoActivate } ;Puts mouse pointer nearer the bet buttons if ( MoveMouse = 1) { x3 := x + (w * x_mouse) y3 := y + (h * y_mouse) Coordmode, Mouse, Screen MouseMove, x3, y3, 0 } ;Beeps on urgent table if ( beep = 1 ) SoundBeep, 750, 100 } } ;removes empty items (and trailing delimiters) CleanList(list, del="") { del := del="" ? "," : del Loop { StringReplace, list, list, %del%%del%, %del%, UseErrorLevel If ! ErrorLevel break } If InStr(list, del) = 1 StringTrimLeft, list, list, 1 If InStr(list, del,0,0) = StrLen(list) StringTrimRight, list, list, 1 return list } PostLeftClick(x, y, table_id, activate=1, control_class="") { ; ### 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), %control_class%, ahk_id%table_id% PostMessage, 0x202 , 0, ((y<<16)^x), %control_class%, ahk_id%table_id% } relStarsClientPoint(id, ByRef x, ByRef y) { SysGet, xbord, 32 SysGet, ybord, 33 SysGet, cap, 4 rw :=0.6582 rh :=0.7729 WinGetPos, , , w, h, ahk_id%id% w := w - (2*xbord) h := h - (2*ybord) - cap Transform, X, Round, W*rw Transform, Y, Round, H*rh x := x + xbord y := y + ybord + cap } TableColor(id) { CoordMode, Pixel, Screen WinGetPos, x, y, w, h, ahk_id%id% rw := 800 rh := 578 x := x+475 y := y+555 x := Floor( (x / rw ) * w ) y := Floor( (y / rh) * h ) PixelGetColor, color, %x%, %y%, RGB return color } TableColor: tableids := TableIDListStars(LobbyPID) Loop, Parse, tableids, `, { ControlGet, v, Visible, , PokerStarsSliderEditorClass1, ahk_id%A_LoopField% if ( v != 1 ) { WinActivate, ahk_id%a_loopfield% sleep, 500 tablecolor:=TableColor(a_loopfield) break } } if ( tablecolor != "" ) SetTimer, TableColor, Off else SetTimer, TableColor, %TableColor_timer% return ;===================================================================== ;=================== SNG Registration Functions ====================== ;===================================================================== RegSNG(id) { if ( SafeReg = 1 ) { IfWinActive, ahk_id%id% RegSNGexec(id) } else { RegSNGexec(id) } } RegSNGexec(id) { ControlGet, v, Visible, , PokerStarsButtonClass6, ahk_id%id% if !v { ControlGet, v, Visible, , PokerStarsButtonClass8, ahk_id%id% if v { ControlClick, PokerStarsButtonClass8, ahk_id%id% WinWait, Tournament Registration ahk_class #32770, , 10 { WinGet, regid, id ControlFocus, Button3, ahk_id%regid% Sleep, -1 ControlSend, Button3, {SPACE}, ahk_id%regid% } WinWait, Tournament Registration ahk_class #32770, , 10 { WinGet, regid, id ControlGetText, ctext, Button1, ahk_id%regid% if ( cText = "OK" ) { ControlFocus, Button1, ahk_id%regid% Sleep, -1 ControlSend, Button1, {SPACE}, ahk_id%regid% } } } } } CloseTournamentLobby(id, pid) { Loop { IfWinExist, Lobby ahk_pid%pid%,, PokerStars Lobby WinClose else break } Sleep, 100 WinGet, state, MinMax, ahk_id%id% if ( state = 1 || state = 0 ) WinMinimize, ahk_id%id% } ;===================================================================== ;=================== Join Cashgame Functions ========================= ;===================================================================== OpenJoinUnJoinTable(id) { ControlGet, v, Visible, , PokerStarsButtonClass4, ahk_id%id% if ( v = 1 ) { ControlClick, PokerStarsButtonClass4, ahk_id%id% ;WinWait, Waiting List ahk_class #32770, , 10 { WinGet, joinid, id ControlFocus, Button1, ahk_id%joinid% Sleep, -1 ControlSend, Button1, {SPACE}, ahk_id%joinid% } } else { ControlGet, v, Visible, , PokerStarsButtonClass3, ahk_id%id% if ( v = 1 ) { ControlClick, PokerStarsButtonClass3, ahk_id%id% } else { ControlGet, v, Visible, , PokerStarsButtonClass8, ahk_id%id% if ( v = 1 ) { ControlClick, PokerStarsButtonClass8, ahk_id%id% } } } } ;===================================================================== ;=================== Popup Functions ================================= ;===================================================================== PopUpWatcher: If ( KillPopups = 1 ) KillPopUps(LobbyPID) if ( AutoTakeSeat = 1 ) TakeSeat(LobbyPID) return KillPopUps(pid) { IfWinExist, PokerStars ahk_class #32770 ahk_pid%pid% { WinGet, list1, list, PokerStars ahk_class #32770 ahk_pid%pid%, , Lobby Loop, %list1% { This_id := list1%A_Index% WinGet, list2, ControlList, ahk_id%this_id% if (InStr(list2, "Button2")) { continue } else { Loop, 20 { ControlFocus, Button1, ahk_id%this_id% Sleep, -1 ControlSend, Button1, {SPACE}, ahk_id%this_id% Sleep, 100 IfWinNotExist, ahk_id%this_id% { break } } } } } } TakeSeat(pid) { IfWinExist, PokerStars ahk_class #32770 ahk_pid%pid% { WinGet, list, list, Seat Available ahk_class #32770 ahk_pid%pid% Loop, %list% { This_id := list%A_Index% ControlFocus, Button2, ahk_id%this_id% Sleep, -1 ControlSend, Button2, {SPACE}, ahk_id%this_id% winactivate, ahk_id%this_id% } } } ;===================================================================== ;=================== Lobby & Tables Functions ======================== ;===================================================================== RefreshLobby: WinGet, LobbyID, id, PokerStars Lobby WinGet, LobbyPID, PID, ahk_id%LobbyID% return MaxMinLobby(id) { WinGetActiveTitle, title IfInString, title, PokerStars Lobby { WinMinimize,ahk_id%id% } else { WinActivate, ahk_id%id% } } TableIDListStars(pid) { WinGet, list, list, / ahk_pid%pid%, , Lobby Loop %list% { this_id := list%a_index% If (this_id != id) { ids = %ids%,%this_id% } } StringTrimLeft, ids, ids, 1 return ids }
Thanks man, really really really really appreciated.
Can you help with another issue? I notice that starsassistant can detect an all in without looking at the slider. I using starshotkeys which doesn't use this feature and every time there's an all in I have to use a mouse which is really time consuming when you re using a gamepad. Can you transfer this feature from one script to another?
If yes, please post your Stars SN so we can send a donation.
Can you help with another issue? I notice that starsassistant can detect an all in without looking at the slider. I using starshotkeys which doesn't use this feature and every time there's an all in I have to use a mouse which is really time consuming when you re using a gamepad. Can you transfer this feature from one script to another?
If yes, please post your Stars SN so we can send a donation.
It's easy to do, but i was thinking of even improving starsassistant "urgent table" detection, just need to check it out. If you want to send donation, pokerstars nickname is Max1mums.
Thanks, babe!
Ok, here it is with new version of "urgent table" procedure and some minor fixes. This procedure should detect "urgent table" 100% correctly. It's somewhat untested so feel free to wright about any issues or suggestions.
Code:
; #### StarsAssistant #### ; AHK version: 1.0.46.05 ; date: november 17,2009 version := "0.88a" ; author: Chris228 @ 2p2 forums ; thx to _dave_, JBOPoker, Roland, JukofYork & pusteblume ; based on ; #### StarsUrgentTable #### ; AHK version: 1.0.46.03 ; date: May 24,2007 ; version: 0.75a ; author: _dave_ @ 2p2 forums ; revised by: JBOPoker @ earthlink.net ; thx to Roland & JukofYork for some of the functions ;===================================================================== ;=================== Settings ======================================== ;===================================================================== ; Hotkeys see below ; Border of the "Highlighter" border_colour := "ff0000" border_size := 5 trans := 255 ; Timings for the "Time Bank Clicker" [fast/turbo 8/17; normal 20/35; both 8/35] timebank_min := 8 timebank_max := 35 ; Beep on urgent table beep := 0 ; Position of the mouse in perc of the table window x_mouse := 0.75 y_mouse := 0.75 foldx:=0.5575 foldy:=0.9826 ; Don't edit below unless you know what you do (except Hotkeys) ; Gui Settings settings() { global ini:="StarsAssistant.ini" iniRead, AutoOn, %ini%, Prefs, AutoOn, 1 iniRead, Highlight, %ini%, Prefs, Highlight, 1 iniRead, MoveMouse, %ini%, Prefs, MoveMouse, 1 iniRead, TimeBankClicker, %ini%, Prefs, TimeBankClicker, 1 iniRead, AlternateDetection, %ini%, Prefs, AlternateDetection, 0 iniRead, ActivateUrgent, %ini%, Prefs, ActivateUrgent, 0 iniRead, KillPopups, %ini%, Prefs, KillPopups, 0 iniRead, SafeReg, %ini%, Prefs, SafeReg, 1 iniRead, AutoTakeSeat, %ini%, Prefs, AutoTakeSeat, 0 IniRead, fold, %ini%, Prefs, fold, 0 } ; Intervalls for sub execution RefreshQueue_timer := 333 RefreshLobby_timer := 1000 PopUpWatcher_timer := 200 TableColor_timer := 500 ;===================================================================== ;=================== Autoexec ======================================== ;===================================================================== #NoEnv #SingleInstance, Force #Include %a_scriptDir% SendMode Input SetTitleMatchMode, 2 SetWorkingDir %a_scriptDir% OnExit exitSub settings() TrayMenu() BuildGui() Gui, 10: Show, hide, x1 y1 h1 w1, PokerWindow WinGet PokerWindowID, id, PokerWindow Suspend, On SysGet, border, 32 SysGet, caption, 4 if ( AutoOn = 1 ) { Gosub, ButtonOn } return ;===================================================================== ;=================== Hotkeys ========================================= ;===================================================================== ^a:: ToggleCheckbox("MoveMouse") return ;^w:: ; ToggleCheckbox("AlternateDetection") ;return ^s:: MaxMinLobby(LobbyID) return ^d:: MinMaxStarsAssistant() return ^r:: RegSNG(LobbyID) OpenJoinUnJoinTable(LobbyID) return ^e:: CloseTournamentLobby(LobbyID, LobbyPID) return ^u::ClickImBack() return ;===================================================================== ;=================== Gui ============================================= ;===================================================================== trayMenu() { global Menu, Tray, noStandard Menu, Tray, Add, &Show, Show Menu, Tray, default, &Show Menu, Tray, Add Menu, Tray, Add, &About, About Menu, Tray, Add, &Help, Help Menu, Tray, Add Menu, Tray, Add, E&xit, Exit Menu, Tray, Tip, StarsAssistant v%version% } buildGui() { global Gui 1:Default Gui, +toolwindow +AlwaysOnTop Gui, Margin, 5, 5 Gui, Font,, Verdena Gui, Add, Button, vOn section w56 h20 center, &On Gui, Add, Button, vOff disabled w56 h20 ys xs+56 center, &Off Gui, Add, Checkbox, checked%AutoOn% vAutoOn gSubmit xs+2, &Auto on Gui, Add, Text, section x7 0x1000 w110 h2 Gui, Add, Checkbox, checked%Highlight% vHighlight gSubmit xs, &Highlight table Gui, Add, Checkbox, checked%MoveMouse% vMoveMouse gSubmit xs, &Move mouse (Ctrl+a) Gui, Add, Checkbox, checked%TimeBankClicker% vTimeBankClicker gSubmit xs, &Click time bank Gui, Add, Checkbox, checked%AlternateDetection% vAlternateDetection gSubmit xs, &Detect All-in/Fixed l. Gui, Add, Checkbox, checked%ActivateUrgent% vActivateUrgent gSubmit xs, &Activate urgent table Gui, Add, Checkbox, checked%KillPopups% vKillPopups gSubmit xs, &Kill popups Gui, Add, Checkbox, checked%SafeReg% vSafeReg gSubmit xs, &Safe SNG regist. (Ctrl+r) Gui, Add, Checkbox, checked%AutoTakeSeat% vAutoTakeSeat gSubmit xs, &Auto take seat Gui, Add, Text, w270 h12 xs, &Remove sitout from all tables (Ctrl+u) Gui, Add, Button, ggetcolfold w40 h20 xs, &Save if (fold=0) or (fold="") or (fold=not defined) { Gui, Add, Text, w270 h13 cRed xs, &Warning! Gui, Add, Text, w270 h12 cRed xs, &Color has not been saved Gui, Add, Text, w270 h12 xs, &Open any Pokerstars table Gui, Add, Text, w270 h12 xs, &with "fold" button NOT visible Gui, Add, Text, w270 h12 xs, &and press save } else { Gui, Add, Text, w270 h12 xs, ¤t "fold" color : Gui, Add, Text, w270 h12 xs, &"%fold%" } IniRead, x, % ini, Gui, x, center IniRead, y, % ini, Gui, y, center Gui, Show, x%x% y%y% w194, StarsAssistant } Show: Gui, 1:Show return About: Msgbox,, StarsAssistant, StarsAssistant v%version% `nAuthor: Chris228 @ 2+2 formus`nE-Mail: chris228@gmx.de`nSee file for further credits`n`nIf you like my program I would be happy about a donation.`nMy screenname on PokerStars is 'mr.cray'.`nThank you! return Help: Run % web() "http://overcards.com/wiki/moin.cgi/StarsAssistant" return web() { ; by Titan, modified by Roland regRead, p, HKCR, HTTP\shell\open\command return SubStr(p, 1, InStr(p, ".exe")+4) } Exit: exitApp GuiClose: Gui 1:Cancel return Submit: Gui, 1:Submit, NoHide return exitSub: Gui 1:Default Gui, Submit Gui +lastfound WinGetPos, x, y IniWrite, % x, % ini, Gui, x IniWrite, % y, % ini, Gui, y IniWrite, % AutoOn, % ini, Prefs, AutoOn IniWrite, % Highlight, % ini, Prefs, Highlight IniWrite, % MoveMouse, % ini, Prefs, MoveMouse IniWrite, % TimeBankClicker, % ini, Prefs, TimeBankClicker IniWrite, % AlternateDetection, % ini, Prefs, AlternateDetection IniWrite, % ActivateUrgent, % ini, Prefs, ActivateUrgent IniWrite, % KillPopups, % ini, Prefs, KillPopups IniWrite, % SafeReg, % ini, Prefs, SafeReg IniWrite, % AutoTakeSeat, % ini, Prefs, AutoTakeSeat IniWrite, %fold%, %ini%, Prefs,fold exitApp MinMaxStarsAssistant() { WinGetActiveTitle, title If ( title = "StarsAssistant" ) Gui 1:Cancel else Gui, 1:Show } ToggleCheckbox(box) { Gui 1:Default GuiControlGet, state, , %box% if ( state = 1 ) GuiControl, , %box%, 0 if ( state = 0 ) GuiControl, , %box%, 1 Gui, 1:Submit, NoHide } ;===================================================================== ;=================== Buttons ========================================= ;===================================================================== ButtonOn: tablecolor:= "" last_table_id := "" tablequeue := "" most_urgent_table := "" GoSub, RefreshLobby GoSub, TableColor SetTimer, RefreshQueue, %RefreshQueue_timer% SetTimer, PopUpWatcher, %PopUpWatcher_timer% SetTimer, RefreshLobby, %RefreshLobby_timer% Suspend, Off GuiControl, 1:Disable, On GuiControl, 1:Enable, Off return ButtonOff: SetTimer, RefreshQueue, Off SetTimer, PopUpWatcher, Off SetTimer, RefreshLobby, Off SetTimer, TableColor, Off Gui, 2: Cancel Gui, 3: Cancel Gui, 4: Cancel Gui, 5: Cancel tablecolor:="" Suspend, On GuiControl, 1:Disable, Off GuiControl, 1:Enable, On return ;===================================================================== ;=================== Urgent Table Functions ========================== ;===================================================================== RefreshQueue: null:=false ids := TableIDListStars(LobbyPID) Loop, Parse, tablequeue, `, { StringTrimLeft, this_id, A_LoopField, InStr(A_LoopField, "_") if (!InStr(ids, this_id)) { StringReplace, tablequeue, tablequeue, %A_LoopField%, , All } } Loop, Parse, ids, `, { ifwinactive, ahk_id%A_LoopField% if PixelColor(foldx,foldy)!=fold { if (!InStr(tablequeue, A_LoopField)) { DllCall("QueryPerformanceCounter", "Int64 *", CurrentQPC) tablequeue := tablequeue . "," . CurrentQPC . "-" . A_TickCount . "_" . A_LoopField } null:=true } ControlGet, v, Visible, , PokerStarsSliderEditorClass1, ahk_id%A_LoopField% if ( v = 1 ) { if (!InStr(tablequeue, A_LoopField)) { DllCall("QueryPerformanceCounter", "Int64 *", CurrentQPC) tablequeue := tablequeue . "," . CurrentQPC . "-" . A_TickCount . "_" . A_LoopField } } else { col:=PixelcolorA(foldx,foldy,A_LoopField) if col!=%fold% { if (!InStr(tablequeue, A_LoopField)) { DllCall("QueryPerformanceCounter", "Int64 *", CurrentQPC) tablequeue := tablequeue . "," . CurrentQPC . "-" . A_TickCount . "_" . A_LoopField } } else if (InStr(tablequeue, A_LoopField)) { StringReplace, tablequeue, tablequeue, %A_LoopField%, , All } } } tmp := "" Loop, Parse, tablequeue, `, { if (InStr(A_LoopField, "0x")) { tmp := tmp . "," . A_LoopField } } Sort, tmp, N D`, tablequeue := CleanList(tmp) most_urgent_table := "" Loop, Parse, tablequeue, `, { StringTrimLeft, most_urgent_table, A_LoopField, InStr(A_LoopField, "_") break } if ( TimeBankClicker = 1 ) { tc := A_TickCount Loop, Parse, tablequeue, `, { StringTrimLeft, waiting_time, A_LoopField, InStr(A_LoopField, "-") StringTrimRight, waiting_time, waiting_time, ( StrLen(waiting_time) - (InStr(waiting_time, "_")-1) ) waiting_time := (tc - waiting_time) / 1000 if (waiting_time > timebank_min && waiting_time < timebank_max) { StringTrimLeft, waiting_table, A_LoopField, InStr(A_LoopField, "_") ;timebank_x := 560 ; lastmax 565 ;timebank_y := 430 ; lastmax 430 +/-10 too much timebank_x :=0.6582 timebank_y :=0.7729 relStarsClientPoint(waiting_table, timebank_x, timebank_y) PostLeftClick(timebank_x, timebank_y, waiting_table, 0) } } } if ( ActivateUrgent = 1 ) if !null { WinActivate, ahk_id%most_urgent_table% if ( AlternateDetection = 1 ) { color:=TableColor(most_urgent_table) if ( color != tablecolor ) { if ( Highlight = 1 || MoveMouse = 1) makegui(most_urgent_table, Highlight, MoveMouse, beep, x_mouse, y_mouse) } } else { if ( Highlight = 1 || MoveMouse = 1) makegui(most_urgent_table, Highlight, MoveMouse, beep, x_mouse, y_mouse) } } else { if ( Highlight = 1 || MoveMouse = 1) makegui(most_urgent_table, Highlight, MoveMouse, beep, x_mouse, y_mouse) } return makegui(id="", Highlight=1, MoveMouse=1, beep=0, x_mouse=0.75, y_mouse=0.75 ) { global last_table_id global border_colour global border_size global trans if (id != last_table_id) { last_table_id := id if(!id) { Gui, 2: Cancel Gui, 3: Cancel Gui, 4: Cancel Gui, 5: Cancel return } WinGetPos, x, y, w, h, ahk_id%id% global border global caption x := x + border y := y + border + caption w := w - (2*border) h := h - (2*border) - caption ;Makes Border around urgent table if ( Highlight = 1 ) { ;top guinum := 2 Gui, %guinum%: +Alwaysontop +Lastfound +Owner Gui, %guinum%: Color, %border_colour% WinSet, Transparent, %trans% Gui, %guinum%: -Caption Gui, %guinum%: Show, w%w% h%border_size% x%x% y%y% NoActivate ;left guinum++ Gui, %guinum%: +Alwaysontop +Lastfound +Owner Gui, %guinum%: Color, %border_colour% WinSet, Transparent, %trans% Gui, %guinum%: -Caption Gui, %guinum%: Show, w%border_size% h%h% x%x% y%y% NoActivate ;bottom guinum++ Gui, %guinum%: +Alwaysontop +Lastfound +Owner Gui, %guinum%: Color, %border_colour% WinSet, Transparent, %trans% Gui, %guinum%: -Caption y2 := y + h - border_size Gui, %guinum%: Show, w%w% h%border_size% x%x% y%y2% NoActivate ;right guinum++ Gui, %guinum%: +Alwaysontop +Lastfound +Owner Gui, %guinum%: Color, %border_colour% WinSet, Transparent, %trans% Gui, %guinum%: -Caption x2 := x + w - border_size Gui, %guinum%: Show, w%border_size% h%h% x%x2% y%y% NoActivate } ;Puts mouse pointer nearer the bet buttons if ( MoveMouse = 1) { x3 := x + (w * x_mouse) y3 := y + (h * y_mouse) Coordmode, Mouse, Screen MouseMove, x3, y3, 0 } ;Beeps on urgent table if ( beep = 1 ) SoundBeep, 750, 100 } } ;removes empty items (and trailing delimiters) CleanList(list, del="") { del := del="" ? "," : del Loop { StringReplace, list, list, %del%%del%, %del%, UseErrorLevel If ! ErrorLevel break } If InStr(list, del) = 1 StringTrimLeft, list, list, 1 If InStr(list, del,0,0) = StrLen(list) StringTrimRight, list, list, 1 return list } PostLeftClick(x, y, table_id, activate=1, control_class="") { ; ### 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), %control_class%, ahk_id%table_id% PostMessage, 0x202 , 0, ((y<<16)^x), %control_class%, ahk_id%table_id% } relStarsClientPoint(id, ByRef x, ByRef y) { SysGet, xbord, 32 SysGet, ybord, 33 SysGet, cap, 4 WinGetPos, , , w, h, ahk_id%id% w := w - (2*xbord) h := h - (2*ybord) - cap Transform, X, Round, W*x Transform, Y, Round, H*y } TableColor(id) { CoordMode, Pixel, Screen WinGetPos, x, y, w, h, ahk_id%id% rw := 800 rh := 578 x := x+475 y := y+555 x := Floor( (x / rw ) * w ) y := Floor( (y / rh) * h ) PixelGetColor, color, %x%, %y%, RGB return color } TableColor: tableids := TableIDListStars(LobbyPID) Loop, Parse, tableids, `, { ControlGet, v, Visible, , PokerStarsSliderEditorClass1, ahk_id%A_LoopField% if ( v != 1 ) { WinActivate, ahk_id%a_loopfield% sleep, 500 tablecolor:=TableColor(a_loopfield) break } } if ( tablecolor != "" ) SetTimer, TableColor, Off else SetTimer, TableColor, %TableColor_timer% return ;===================================================================== ;=================== SNG Registration Functions ====================== ;===================================================================== RegSNG(id) { if ( SafeReg = 1 ) { IfWinActive, ahk_id%id% RegSNGexec(id) } else { RegSNGexec(id) } } RegSNGexec(id) { ControlGet, v, Visible, , PokerStarsButtonClass8, ahk_id%id% if v { ControlClick, PokerStarsButtonClass8, ahk_id%id% WinWait, Tournament Registration ahk_class #32770, , 10 { WinGet, regid, id ControlFocus, Button3, ahk_id%regid% Sleep, -1 ControlSend, Button3, {SPACE}, ahk_id%regid% } WinWait, Tournament Registration ahk_class #32770, , 10 { WinGet, regid, id ControlGetText, ctext, Button1, ahk_id%regid% if ( cText = "OK" ) { ControlFocus, Button1, ahk_id%regid% Sleep, -1 ControlSend, Button1, {SPACE}, ahk_id%regid% } } } else { ControlGet, v, Visible, , PokerStarsButtonClass6, ahk_id%id% if v { ControlClick, PokerStarsButtonClass6, ahk_id%id% WinWait, Tournament Registration ahk_class #32770, , 10 { WinGet, regid, id ControlGetText, ctext, Button1, ahk_id%regid% if ( cText = "OK" ) { ControlFocus, Button1, ahk_id%regid% Sleep, -1 ControlSend, Button1, {SPACE}, ahk_id%regid% } } } } } CloseTournamentLobby(id, pid) { Loop { IfWinExist, Lobby ahk_pid%pid%,, PokerStars Lobby WinClose else break } Sleep, 100 WinGet, state, MinMax, ahk_id%id% if ( state = 1 || state = 0 ) WinMinimize, ahk_id%id% } ;===================================================================== ;=================== Join Cashgame Functions ========================= ;===================================================================== OpenJoinUnJoinTable(id) { ControlGet, v, Visible, , PokerStarsButtonClass4, ahk_id%id% if ( v = 1 ) { ControlClick, PokerStarsButtonClass4, ahk_id%id% ;WinWait, Waiting List ahk_class #32770, , 10 { WinGet, joinid, id ControlFocus, Button1, ahk_id%joinid% Sleep, -1 ControlSend, Button1, {SPACE}, ahk_id%joinid% } } else { ControlGet, v, Visible, , PokerStarsButtonClass3, ahk_id%id% if ( v = 1 ) { ControlClick, PokerStarsButtonClass3, ahk_id%id% } } } ;===================================================================== ;=================== Popup Functions ================================= ;===================================================================== PopUpWatcher: If ( KillPopups = 1 ) KillPopUps(LobbyPID) if ( AutoTakeSeat = 1 ) TakeSeat(LobbyPID) return KillPopUps(pid) { IfWinExist, PokerStars ahk_class #32770 ahk_pid%pid% { WinGet, list1, list, PokerStars ahk_class #32770 ahk_pid%pid%, , Lobby Loop, %list1% { This_id := list1%A_Index% WinGet, list2, ControlList, ahk_id%this_id% if (InStr(list2, "Button2")) { continue } else { Loop, 20 { ControlFocus, Button1, ahk_id%this_id% Sleep, -1 ControlSend, Button1, {SPACE}, ahk_id%this_id% Sleep, 100 IfWinNotExist, ahk_id%this_id% { break } } } } } } TakeSeat(pid) { IfWinExist, PokerStars ahk_class #32770 ahk_pid%pid% { WinGet, list, list, Seat Available ahk_class #32770 ahk_pid%pid% Loop, %list% { This_id := list%A_Index% ControlFocus, Button2, ahk_id%this_id% Sleep, -1 ControlSend, Button2, {SPACE}, ahk_id%this_id% } } } ;===================================================================== ;=================== Lobby & Tables Functions ======================== ;===================================================================== RefreshLobby: WinGet, LobbyID, id, PokerStars Lobby WinGet, LobbyPID, PID, ahk_id%LobbyID% return MaxMinLobby(id) { WinGetActiveTitle, title IfInString, title, PokerStars Lobby { WinMinimize,ahk_id%id% } else { WinActivate, ahk_id%id% } } TableIDListStars(pid) { WinGet, list, list, / ahk_pid%pid%, , Lobby Loop %list% { this_id := list%a_index% If (this_id != id) { ids = %ids%,%this_id% } } StringTrimLeft, ids, ids, 1 return ids } ;===================================================================== ;=================== Colors ======================== ;===================================================================== GetColfold: GetCol("fold",foldx,foldy) return ;----------------------------------------------------------------------------------------------------- GetCol(var,xc,yc) { global Gui, +toolwindow -AlwaysOnTop winactivate, ahk_class PokerStarsTableFrameClass IfWinActive, ahk_class PokerStarsTableFrameClass { col:=PixelColor(xc,yc) Gui, 11:Add, Text,, saving color: %col% Gui, 11:+ToolWindow Gui, 11:Show, w150 h20 Sleep, 1000 Gui, 11:Destroy IniWrite, %col%, %ini%, Prefs, %var% Gui, 11:Add, Text,, done Gui, 11:+ToolWindow Gui, 11:Show, w150 h20 Sleep, 1000 Gui, 11:Destroy if (col="") or (col=0) %var%:="not defined" else %var%:=col Gui, 1:Destroy buildgui() Gui, +toolwindow +AlwaysOnTop } } return ;----------------------------------------------------------------------------------------------------- PixelColor(colx,coly) { CoordMode, Pixel, Relative WinGetPos, X, Y, W, H, A SysGet, xbord, 32 SysGet, ybord, 33 SysGet, cap, 4 w := w - (2*xbord) h := h - (2*ybord) - cap Transform, X, Round, W*colx Transform, Y, Round, H*coly x := x + xbord y := y + ybord + cap winget, id ,id, A wingettitle, tid, A PixelGetColor, fcol, %X%, %Y% return fcol } ;----------------------------------------------------------------------------------------------------- PixelColorA(colxa,colya,id) { ; Set up a DC hdc_frame := DllCall( "GetDC", UInt, PokerWindowID ) hdc_buffer := DllCall("gdi32.dll\CreateCompatibleDC", UInt, hdc_frame) hbm_buffer := DllCall("gdi32.dll\CreateCompatibleBitmap", UInt,hdc_frame, Int,A_ScreenWidth, Int,A_ScreenHeight) DllCall( "gdi32.dll\SelectObject", UInt,hdc_buffer, UInt,hbm_buffer) DllCall( "PrintWindow", UInt , id , UInt , hdc_buffer , UInt , 0 ) Dllcall("InvalidateRect", "uint",id , "uint",0 , "uint",1) WinGetPos, X, Y, W, H, ahk_id %id% SysGet, xbord, 32 SysGet, ybord, 33 SysGet, cap, 4 w := w - (2*xbord) h := h - (2*ybord) - cap Transform, X, Round, W*colxa Transform, Y, Round, H*colya pixel_x := x + xbord pixel_y := y + ybord + cap pix := DllCall("GetPixel", UInt, hdc_buffer, Int, pixel_x , Int, pixel_y) SetFormat, IntegerFast, hex pix += 0 ; Sets Var (which previously contained 11) to be 0xb. pix .= "" ; Necessary due to the "fast" mode. SetFormat, IntegerFast, d DllCall( "gdi32.dll\DeleteObject", "uint", hbm_buffer ) DllCall( "gdi32.dll\DeleteDC" , "uint", hdc_frame ) DllCall( "gdi32.dll\DeleteDC" , "uint", hdc_buffer ) return pix } ;===================================================================== ClickImBack() { IfWinActive, ahk_class PokerStarsTableFrameClass WinGet, WinId, ID, A WinGet, list, List, ahk_class PokerStarsTableFrameClass Loop, %list% { Z:=list%A_Index% WinGetPos, X, Y, W, H, ahk_id %Z% Sittingout:=PixelColorA(0.8125,0.8621,Z) JoinWaitingList:=PixelColorA(0.8625,0.8621,Z) If (Sittingout=0x000000) OR (Sittingout=0xDFD9CE) OR (Sittingout=0xD2EBF3) OR (Sittingout=0xB3A39D) OR (Sittingout=0x9D9D9D) OR (Sittingout=0xCCCCCC) OR (Sittingout=0xDEDBCE) OR (Sittingout=0xB5A29c) OR (Sittingout=0xBDAEAD) OR (Sittingout=0xFCF8F2) If (JoinWaitingList!=0x000000) AND (JoinWaitingList!=0xDFD9CE) AND (JoinWaitingList!=0xDEDBCE) AND (JoinWaitingList!=0x0xB5A29c) AND (JoinWaitingList!=0xBDAEAD) { back_x :=0.7515 back_y :=0.8468 relStarsClientPoint(Z, back_x, back_y) PostLeftClick(back_x, back_y, Z, 0) } } winactivate, ahk_id %winid% } ;=====================================================================
Is click timebank working? I tested it on a few 10man and 9man play money tables and it's not working for me. I used the whole script code that max posted a few days ago.
I noticed that variable "tmp" which was used by script creator can store windows temp folder path what could cause wrong script work, here is fixed version with old urgent table procedure:
And here is fixed version with new urgent table procedure:
Timebank clicker should work correctly in both versions.
Code:
; #### StarsAssistant #### ; AHK version: 1.0.46.05 ; date: January 05,2008 version := "0.88" ; author: Chris228 @ 2p2 forums ; thx to _dave_, JBOPoker, Roland, JukofYork & pusteblume ; based on ; #### StarsUrgentTable #### ; AHK version: 1.0.46.03 ; date: May 24,2007 ; version: 0.75a ; author: _dave_ @ 2p2 forums ; revised by: JBOPoker @ earthlink.net ; thx to Roland & JukofYork for some of the functions ;===================================================================== ;=================== Settings ======================================== ;===================================================================== ; Hotkeys see below ; Border of the "Highlighter" border_colour := "ff0000" border_size := 5 trans := 255 ; Timings for the "Time Bank Clicker" [fast/turbo 8/17; normal 20/35; both 8/35] timebank_min := 8 timebank_max := 35 ; Beep on urgent table beep := 0 ; Position of the mouse in perc of the table window x_mouse := 0.75 y_mouse := 0.75 ; Don't edit below unless you know what you do (except Hotkeys) ; Gui Settings settings() { global ini:="StarsAssistant.ini" iniRead, AutoOn, %ini%, Prefs, AutoOn, 1 iniRead, Highlight, %ini%, Prefs, Highlight, 1 iniRead, MoveMouse, %ini%, Prefs, MoveMouse, 1 iniRead, TimeBankClicker, %ini%, Prefs, TimeBankClicker, 1 iniRead, AlternateDetection, %ini%, Prefs, AlternateDetection, 0 iniRead, ActivateUrgent, %ini%, Prefs, ActivateUrgent, 0 iniRead, KillPopups, %ini%, Prefs, KillPopups, 0 iniRead, SafeReg, %ini%, Prefs, SafeReg, 1 iniRead, AutoTakeSeat, %ini%, Prefs, AutoTakeSeat, 0 } ; Intervalls for sub execution RefreshQueue_timer := 333 RefreshLobby_timer := 1000 PopUpWatcher_timer := 200 TableColor_timer := 500 ;===================================================================== ;=================== Autoexec ======================================== ;===================================================================== #NoEnv #SingleInstance, Force #Include %a_scriptDir% SendMode Input SetTitleMatchMode, 2 SetWorkingDir %a_scriptDir% OnExit exitSub settings() TrayMenu() BuildGui() Suspend, On SysGet, border, 32 SysGet, caption, 4 if ( AutoOn = 1 ) { Gosub, ButtonOn } return ;===================================================================== ;=================== Hotkeys ========================================= ;===================================================================== ^a:: ToggleCheckbox("MoveMouse") return ^w:: ToggleCheckbox("AlternateDetection") return ^s:: MaxMinLobby(LobbyID) return ^d:: MinMaxStarsAssistant() return ^r:: RegSNG(LobbyID) OpenJoinUnJoinTable(LobbyID) return ^e:: CloseTournamentLobby(LobbyID, LobbyPID) return ;===================================================================== ;=================== Gui ============================================= ;===================================================================== trayMenu() { global Menu, Tray, noStandard Menu, Tray, Add, &Show, Show Menu, Tray, default, &Show Menu, Tray, Add Menu, Tray, Add, &About, About Menu, Tray, Add, &Help, Help Menu, Tray, Add Menu, Tray, Add, E&xit, Exit Menu, Tray, Tip, StarsAssistant v%version% } buildGui() { global Gui 1:Default Gui, +toolwindow +AlwaysOnTop Gui, Margin, 5, 5 Gui, Font,, Verdena Gui, Add, Button, vOn section w56 h20 center, &On Gui, Add, Button, vOff disabled w56 h20 ys xs+56 center, &Off Gui, Add, Checkbox, checked%AutoOn% vAutoOn gSubmit xs+2, &Auto on Gui, Add, Text, section x7 0x1000 w110 h2 Gui, Add, Checkbox, checked%Highlight% vHighlight gSubmit xs, &Highlight table Gui, Add, Checkbox, checked%MoveMouse% vMoveMouse gSubmit xs, &Move mouse Gui, Add, Checkbox, checked%TimeBankClicker% vTimeBankClicker gSubmit xs, &Click time bank Gui, Add, Checkbox, checked%AlternateDetection% vAlternateDetection gSubmit xs, &Detect All-in/Fixed l. Gui, Add, Checkbox, checked%ActivateUrgent% vActivateUrgent gSubmit xs, &Activate urgent table Gui, Add, Checkbox, checked%KillPopups% vKillPopups gSubmit xs, &Kill popups Gui, Add, Checkbox, checked%SafeReg% vSafeReg gSubmit xs, &Safe SNG regist. Gui, Add, Checkbox, checked%AutoTakeSeat% vAutoTakeSeat gSubmit xs, &Auto take seat IniRead, x, % ini, Gui, x, center IniRead, y, % ini, Gui, y, center Gui, Show, x%x% y%y% w124, StarsAssistant } Show: Gui, 1:Show return About: Msgbox,, StarsAssistant, StarsAssistant v%version% `nAuthor: Chris228 @ 2+2 formus`nE-Mail: chris228@gmx.de`nSee file for further credits`n`nIf you like my program I would be happy about a donation.`nMy screenname on PokerStars is 'mr.cray'.`nThank you! return Help: Run % web() "http://overcards.com/wiki/moin.cgi/StarsAssistant" return web() { ; by Titan, modified by Roland regRead, p, HKCR, HTTP\shell\open\command return SubStr(p, 1, InStr(p, ".exe")+4) } Exit: exitApp GuiClose: Gui 1:Cancel return Submit: Gui, 1:Submit, NoHide return exitSub: Gui 1:Default Gui, Submit Gui +lastfound WinGetPos, x, y IniWrite, % x, % ini, Gui, x IniWrite, % y, % ini, Gui, y IniWrite, % AutoOn, % ini, Prefs, AutoOn IniWrite, % Highlight, % ini, Prefs, Highlight IniWrite, % MoveMouse, % ini, Prefs, MoveMouse IniWrite, % TimeBankClicker, % ini, Prefs, TimeBankClicker IniWrite, % AlternateDetection, % ini, Prefs, AlternateDetection IniWrite, % ActivateUrgent, % ini, Prefs, ActivateUrgent IniWrite, % KillPopups, % ini, Prefs, KillPopups IniWrite, % SafeReg, % ini, Prefs, SafeReg IniWrite, % AutoTakeSeat, % ini, Prefs, AutoTakeSeat exitApp MinMaxStarsAssistant() { WinGetActiveTitle, title If ( title = "StarsAssistant" ) Gui 1:Cancel else Gui, 1:Show } ToggleCheckbox(box) { Gui 1:Default GuiControlGet, state, , %box% if ( state = 1 ) GuiControl, , %box%, 0 if ( state = 0 ) GuiControl, , %box%, 1 Gui, 1:Submit, NoHide } ;===================================================================== ;=================== Buttons ========================================= ;===================================================================== ButtonOn: tablecolor:= "" last_table_id := "" tablequeue := "" most_urgent_table := "" GoSub, RefreshLobby GoSub, TableColor SetTimer, RefreshQueue, %RefreshQueue_timer% SetTimer, PopUpWatcher, %PopUpWatcher_timer% SetTimer, RefreshLobby, %RefreshLobby_timer% Suspend, Off GuiControl, 1:Disable, On GuiControl, 1:Enable, Off return ButtonOff: SetTimer, RefreshQueue, Off SetTimer, PopUpWatcher, Off SetTimer, RefreshLobby, Off SetTimer, TableColor, Off Gui, 2: Cancel Gui, 3: Cancel Gui, 4: Cancel Gui, 5: Cancel tablecolor:="" Suspend, On GuiControl, 1:Disable, Off GuiControl, 1:Enable, On return ;===================================================================== ;=================== Urgent Table Functions ========================== ;===================================================================== RefreshQueue: ids := TableIDListStars(LobbyPID) Loop, Parse, tablequeue, `, { StringTrimLeft, this_id, A_LoopField, InStr(A_LoopField, "_") if (!InStr(ids, this_id)) { StringReplace, tablequeue, tablequeue, %A_LoopField%, , All } } Loop, Parse, ids, `, { ControlGet, v, Visible, , PokerStarsSliderEditorClass1, ahk_id%A_LoopField% if ( v = 1 ) { if (!InStr(tablequeue, A_LoopField)) { DllCall("QueryPerformanceCounter", "Int64 *", CurrentQPC) tablequeue := tablequeue . "," . CurrentQPC . "-" . A_TickCount . "_" . A_LoopField } } else { if ( AlternateDetection = 1 ) { color:=TableColor(A_LoopField) if ( color != tablecolor && tablecolor != "" ) { if (!InStr(tablequeue, A_LoopField)) { DllCall("QueryPerformanceCounter", "Int64 *", CurrentQPC) tablequeue := tablequeue . "," . CurrentQPC . "-" . A_TickCount . "_" . A_LoopField } } else { if (InStr(tablequeue, A_LoopField)) { StringReplace, tablequeue, tablequeue, %A_LoopField%, , All } } } else { if (InStr(tablequeue, A_LoopField)) { StringReplace, tablequeue, tablequeue, %A_LoopField%, , All } } } } tmpvar := "" Loop, Parse, tablequeue, `, { if (InStr(A_LoopField, "0x")) { tmpvar := tmpvar . "," . A_LoopField } } Sort, tmpvar, N D`, tablequeue := CleanList(tmpvar) most_urgent_table := "" Loop, Parse, tablequeue, `, { StringTrimLeft, most_urgent_table, A_LoopField, InStr(A_LoopField, "_") break } if ( TimeBankClicker = 1 ) { tc := A_TickCount Loop, Parse, tablequeue, `, { StringTrimLeft, waiting_time, A_LoopField, InStr(A_LoopField, "-") StringTrimRight, waiting_time, waiting_time, ( StrLen(waiting_time) - (InStr(waiting_time, "_")-1) ) waiting_time := (tc - waiting_time) / 1000 if (waiting_time > timebank_min && waiting_time < timebank_max) { StringTrimLeft, waiting_table, A_LoopField, InStr(A_LoopField, "_") ;timebank_x := 560 ; lastmax 565 ;timebank_y := 430 ; lastmax 430 +/-10 too much timebank_x :=0.6613 timebank_y :=0.7729 relStarsClientPoint(waiting_table, timebank_x, timebank_y) PostLeftClick(timebank_x, timebank_y, waiting_table, 0) } } } if ( ActivateUrgent = 1 ) { WinActivate, ahk_id%most_urgent_table% if ( AlternateDetection = 1 ) { color:=TableColor(most_urgent_table) if ( color != tablecolor ) { if ( Highlight = 1 || MoveMouse = 1) makegui(most_urgent_table, Highlight, MoveMouse, beep, x_mouse, y_mouse) } } else { if ( Highlight = 1 || MoveMouse = 1) makegui(most_urgent_table, Highlight, MoveMouse, beep, x_mouse, y_mouse) } } else { if ( Highlight = 1 || MoveMouse = 1) makegui(most_urgent_table, Highlight, MoveMouse, beep, x_mouse, y_mouse) } return makegui(id="", Highlight=1, MoveMouse=1, beep=0, x_mouse=0.75, y_mouse=0.75 ) { global last_table_id global border_colour global border_size global trans if (id != last_table_id) { last_table_id := id if(!id) { Gui, 2: Cancel Gui, 3: Cancel Gui, 4: Cancel Gui, 5: Cancel return } WinGetPos, x, y, w, h, ahk_id%id% global border global caption x := x + border y := y + border + caption w := w - (2*border) h := h - (2*border) - caption ;Makes Border around urgent table if ( Highlight = 1 ) { ;top guinum := 2 Gui, %guinum%: +Alwaysontop +Lastfound +Owner Gui, %guinum%: Color, %border_colour% WinSet, Transparent, %trans% Gui, %guinum%: -Caption Gui, %guinum%: Show, w%w% h%border_size% x%x% y%y% NoActivate ;left guinum++ Gui, %guinum%: +Alwaysontop +Lastfound +Owner Gui, %guinum%: Color, %border_colour% WinSet, Transparent, %trans% Gui, %guinum%: -Caption Gui, %guinum%: Show, w%border_size% h%h% x%x% y%y% NoActivate ;bottom guinum++ Gui, %guinum%: +Alwaysontop +Lastfound +Owner Gui, %guinum%: Color, %border_colour% WinSet, Transparent, %trans% Gui, %guinum%: -Caption y2 := y + h - border_size Gui, %guinum%: Show, w%w% h%border_size% x%x% y%y2% NoActivate ;right guinum++ Gui, %guinum%: +Alwaysontop +Lastfound +Owner Gui, %guinum%: Color, %border_colour% WinSet, Transparent, %trans% Gui, %guinum%: -Caption x2 := x + w - border_size Gui, %guinum%: Show, w%border_size% h%h% x%x2% y%y% NoActivate } ;Puts mouse pointer nearer the bet buttons if ( MoveMouse = 1) { x3 := x + (w * x_mouse) y3 := y + (h * y_mouse) Coordmode, Mouse, Screen MouseMove, x3, y3, 0 } ;Beeps on urgent table if ( beep = 1 ) SoundBeep, 750, 100 } } ;removes empty items (and trailing delimiters) CleanList(list, del="") { del := del="" ? "," : del Loop { StringReplace, list, list, %del%%del%, %del%, UseErrorLevel If ! ErrorLevel break } If InStr(list, del) = 1 StringTrimLeft, list, list, 1 If InStr(list, del,0,0) = StrLen(list) StringTrimRight, list, list, 1 return list } PostLeftClick(x, y, table_id, activate=1, control_class="") { ; ### 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), %control_class%, ahk_id%table_id% PostMessage, 0x202 , 0, ((y<<16)^x), %control_class%, ahk_id%table_id% } relStarsClientPoint(id, ByRef x, ByRef y) { SysGet, xbord, 32 SysGet, ybord, 33 SysGet, cap, 4 WinGetPos, , , w, h, ahk_id%id% w := w - (2*xbord) h := h - (2*ybord) - cap Transform, X, Round, W*x Transform, Y, Round, H*y } TableColor(id) { CoordMode, Pixel, Screen WinGetPos, x, y, w, h, ahk_id%id% rw := 800 rh := 578 x := x+475 y := y+555 x := Floor( (x / rw ) * w ) y := Floor( (y / rh) * h ) PixelGetColor, color, %x%, %y%, RGB return color } TableColor: tableids := TableIDListStars(LobbyPID) Loop, Parse, tableids, `, { ControlGet, v, Visible, , PokerStarsSliderEditorClass1, ahk_id%A_LoopField% if ( v != 1 ) { WinActivate, ahk_id%a_loopfield% sleep, 500 tablecolor:=TableColor(a_loopfield) break } } if ( tablecolor != "" ) SetTimer, TableColor, Off else SetTimer, TableColor, %TableColor_timer% return ;===================================================================== ;=================== SNG Registration Functions ====================== ;===================================================================== RegSNG(id) { if ( SafeReg = 1 ) { IfWinActive, ahk_id%id% RegSNGexec(id) } else { RegSNGexec(id) } } RegSNGexec(id) { ControlGet, v, Visible, , PokerStarsButtonClass8, ahk_id%id% if v { ControlClick, PokerStarsButtonClass8, ahk_id%id% WinWait, Tournament Registration ahk_class #32770, , 10 { WinGet, regid, id ControlFocus, Button3, ahk_id%regid% Sleep, -1 ControlSend, Button3, {SPACE}, ahk_id%regid% } WinWait, Tournament Registration ahk_class #32770, , 10 { WinGet, regid, id ControlGetText, ctext, Button1, ahk_id%regid% if ( cText = "OK" ) { ControlFocus, Button1, ahk_id%regid% Sleep, -1 ControlSend, Button1, {SPACE}, ahk_id%regid% } } } else { ControlGet, v, Visible, , PokerStarsButtonClass6, ahk_id%id% if v { ControlClick, PokerStarsButtonClass6, ahk_id%id% WinWait, Tournament Registration ahk_class #32770, , 10 { WinGet, regid, id ControlGetText, ctext, Button1, ahk_id%regid% if ( cText = "OK" ) { ControlFocus, Button1, ahk_id%regid% Sleep, -1 ControlSend, Button1, {SPACE}, ahk_id%regid% } } } } } CloseTournamentLobby(id, pid) { Loop { IfWinExist, Lobby ahk_pid%pid%,, PokerStars Lobby WinClose else break } Sleep, 100 WinGet, state, MinMax, ahk_id%id% if ( state = 1 || state = 0 ) WinMinimize, ahk_id%id% } ;===================================================================== ;=================== Join Cashgame Functions ========================= ;===================================================================== OpenJoinUnJoinTable(id) { ControlGet, v, Visible, , PokerStarsButtonClass4, ahk_id%id% if ( v = 1 ) { ControlClick, PokerStarsButtonClass4, ahk_id%id% ;WinWait, Waiting List ahk_class #32770, , 10 { WinGet, joinid, id ControlFocus, Button1, ahk_id%joinid% Sleep, -1 ControlSend, Button1, {SPACE}, ahk_id%joinid% } } else { ControlGet, v, Visible, , PokerStarsButtonClass3, ahk_id%id% if ( v = 1 ) { ControlClick, PokerStarsButtonClass3, ahk_id%id% } } } ;===================================================================== ;=================== Popup Functions ================================= ;===================================================================== PopUpWatcher: If ( KillPopups = 1 ) KillPopUps(LobbyPID) if ( AutoTakeSeat = 1 ) TakeSeat(LobbyPID) return KillPopUps(pid) { IfWinExist, PokerStars ahk_class #32770 ahk_pid%pid% { WinGet, list1, list, PokerStars ahk_class #32770 ahk_pid%pid%, , Lobby Loop, %list1% { This_id := list1%A_Index% WinGet, list2, ControlList, ahk_id%this_id% if (InStr(list2, "Button2")) { continue } else { Loop, 20 { ControlFocus, Button1, ahk_id%this_id% Sleep, -1 ControlSend, Button1, {SPACE}, ahk_id%this_id% Sleep, 100 IfWinNotExist, ahk_id%this_id% { break } } } } } } TakeSeat(pid) { IfWinExist, PokerStars ahk_class #32770 ahk_pid%pid% { WinGet, list, list, Seat Available ahk_class #32770 ahk_pid%pid% Loop, %list% { This_id := list%A_Index% ControlFocus, Button2, ahk_id%this_id% Sleep, -1 ControlSend, Button2, {SPACE}, ahk_id%this_id% } } } ;===================================================================== ;=================== Lobby & Tables Functions ======================== ;===================================================================== RefreshLobby: WinGet, LobbyID, id, PokerStars Lobby WinGet, LobbyPID, PID, ahk_id%LobbyID% return MaxMinLobby(id) { WinGetActiveTitle, title IfInString, title, PokerStars Lobby { WinMinimize,ahk_id%id% } else { WinActivate, ahk_id%id% } } TableIDListStars(pid) { WinGet, list, list, / ahk_pid%pid%, , Lobby Loop %list% { this_id := list%a_index% If (this_id != id) { ids = %ids%,%this_id% } } StringTrimLeft, ids, ids, 1 return ids }
Code:
; #### StarsAssistant #### ; AHK version: 1.0.46.05 ; date: January 05,2008 version := "0.88" ; author: Chris228 @ 2p2 forums ; thx to _dave_, JBOPoker, Roland, JukofYork & pusteblume ; based on ; #### StarsUrgentTable #### ; AHK version: 1.0.46.03 ; date: May 24,2007 ; version: 0.75a ; author: _dave_ @ 2p2 forums ; revised by: JBOPoker @ earthlink.net ; thx to Roland & JukofYork for some of the functions ;===================================================================== ;=================== Settings ======================================== ;===================================================================== ; Hotkeys see below ; Border of the "Highlighter" border_colour := "ff0000" border_size := 5 trans := 255 ; Timings for the "Time Bank Clicker" [fast/turbo 8/17; normal 20/35; both 8/35] timebank_min := 8 timebank_max := 35 ; Beep on urgent table beep := 0 ; Position of the mouse in perc of the table window x_mouse := 0.75 y_mouse := 0.75 foldx:=0.5575 foldy:=0.9826 ; Don't edit below unless you know what you do (except Hotkeys) ; Gui Settings settings() { global ini:="StarsAssistant.ini" iniRead, AutoOn, %ini%, Prefs, AutoOn, 1 iniRead, Highlight, %ini%, Prefs, Highlight, 1 iniRead, MoveMouse, %ini%, Prefs, MoveMouse, 1 iniRead, TimeBankClicker, %ini%, Prefs, TimeBankClicker, 1 iniRead, AlternateDetection, %ini%, Prefs, AlternateDetection, 0 iniRead, ActivateUrgent, %ini%, Prefs, ActivateUrgent, 0 iniRead, KillPopups, %ini%, Prefs, KillPopups, 0 iniRead, SafeReg, %ini%, Prefs, SafeReg, 1 iniRead, AutoTakeSeat, %ini%, Prefs, AutoTakeSeat, 0 IniRead, fold, %ini%, Prefs, fold, 0 } ; Intervalls for sub execution RefreshQueue_timer := 333 RefreshLobby_timer := 1000 PopUpWatcher_timer := 200 TableColor_timer := 500 ;===================================================================== ;=================== Autoexec ======================================== ;===================================================================== #NoEnv #SingleInstance, Force #Include %a_scriptDir% SendMode Input SetTitleMatchMode, 2 SetWorkingDir %a_scriptDir% OnExit exitSub settings() TrayMenu() BuildGui() Gui, 10: Show, hide, x1 y1 h1 w1, PokerWindow WinGet PokerWindowID, id, PokerWindow Suspend, On SysGet, border, 32 SysGet, caption, 4 if ( AutoOn = 1 ) { Gosub, ButtonOn } return ;===================================================================== ;=================== Hotkeys ========================================= ;===================================================================== ^a:: ToggleCheckbox("MoveMouse") return ;^w:: ; ToggleCheckbox("AlternateDetection") ;return ^s:: MaxMinLobby(LobbyID) return ^d:: MinMaxStarsAssistant() return ^r:: RegSNG(LobbyID) OpenJoinUnJoinTable(LobbyID) return ^e:: CloseTournamentLobby(LobbyID, LobbyPID) return ^u::ClickImBack() return ;===================================================================== ;=================== Gui ============================================= ;===================================================================== trayMenu() { global Menu, Tray, noStandard Menu, Tray, Add, &Show, Show Menu, Tray, default, &Show Menu, Tray, Add Menu, Tray, Add, &About, About Menu, Tray, Add, &Help, Help Menu, Tray, Add Menu, Tray, Add, E&xit, Exit Menu, Tray, Tip, StarsAssistant v%version% } buildGui() { global Gui 1:Default Gui, +toolwindow +AlwaysOnTop Gui, Margin, 5, 5 Gui, Font,, Verdena Gui, Add, Button, vOn section w56 h20 center, &On Gui, Add, Button, vOff disabled w56 h20 ys xs+56 center, &Off Gui, Add, Checkbox, checked%AutoOn% vAutoOn gSubmit xs+2, &Auto on Gui, Add, Text, section x7 0x1000 w110 h2 Gui, Add, Checkbox, checked%Highlight% vHighlight gSubmit xs, &Highlight table Gui, Add, Checkbox, checked%MoveMouse% vMoveMouse gSubmit xs, &Move mouse (Ctrl+a) Gui, Add, Checkbox, checked%TimeBankClicker% vTimeBankClicker gSubmit xs, &Click time bank Gui, Add, Checkbox, checked%AlternateDetection% vAlternateDetection gSubmit xs, &Detect All-in/Fixed l. Gui, Add, Checkbox, checked%ActivateUrgent% vActivateUrgent gSubmit xs, &Activate urgent table Gui, Add, Checkbox, checked%KillPopups% vKillPopups gSubmit xs, &Kill popups Gui, Add, Checkbox, checked%SafeReg% vSafeReg gSubmit xs, &Safe SNG regist. (Ctrl+r) Gui, Add, Checkbox, checked%AutoTakeSeat% vAutoTakeSeat gSubmit xs, &Auto take seat Gui, Add, Text, w270 h12 xs, &Remove sitout from all tables (Ctrl+u) Gui, Add, Button, ggetcolfold w40 h20 xs, &Save if (fold=0) or (fold="") or (fold=not defined) { Gui, Add, Text, w270 h13 cRed xs, &Warning! Gui, Add, Text, w270 h12 cRed xs, &Color has not been saved Gui, Add, Text, w270 h12 xs, &Open any Pokerstars table Gui, Add, Text, w270 h12 xs, &with "fold" button NOT visible Gui, Add, Text, w270 h12 xs, &and press save } else { Gui, Add, Text, w270 h12 xs, ¤t "fold" color : Gui, Add, Text, w270 h12 xs, &"%fold%" } IniRead, x, % ini, Gui, x, center IniRead, y, % ini, Gui, y, center Gui, Show, x%x% y%y% w194, StarsAssistant } Show: Gui, 1:Show return About: Msgbox,, StarsAssistant, StarsAssistant v%version% `nAuthor: Chris228 @ 2+2 formus`nE-Mail: chris228@gmx.de`nSee file for further credits`n`nIf you like my program I would be happy about a donation.`nMy screenname on PokerStars is 'mr.cray'.`nThank you! return Help: Run % web() "http://overcards.com/wiki/moin.cgi/StarsAssistant" return web() { ; by Titan, modified by Roland regRead, p, HKCR, HTTP\shell\open\command return SubStr(p, 1, InStr(p, ".exe")+4) } Exit: exitApp GuiClose: Gui 1:Cancel return Submit: Gui, 1:Submit, NoHide return exitSub: Gui 1:Default Gui, Submit Gui +lastfound WinGetPos, x, y IniWrite, % x, % ini, Gui, x IniWrite, % y, % ini, Gui, y IniWrite, % AutoOn, % ini, Prefs, AutoOn IniWrite, % Highlight, % ini, Prefs, Highlight IniWrite, % MoveMouse, % ini, Prefs, MoveMouse IniWrite, % TimeBankClicker, % ini, Prefs, TimeBankClicker IniWrite, % AlternateDetection, % ini, Prefs, AlternateDetection IniWrite, % ActivateUrgent, % ini, Prefs, ActivateUrgent IniWrite, % KillPopups, % ini, Prefs, KillPopups IniWrite, % SafeReg, % ini, Prefs, SafeReg IniWrite, % AutoTakeSeat, % ini, Prefs, AutoTakeSeat IniWrite, %fold%, %ini%, Prefs,fold exitApp MinMaxStarsAssistant() { WinGetActiveTitle, title If ( title = "StarsAssistant" ) Gui 1:Cancel else Gui, 1:Show } ToggleCheckbox(box) { Gui 1:Default GuiControlGet, state, , %box% if ( state = 1 ) GuiControl, , %box%, 0 if ( state = 0 ) GuiControl, , %box%, 1 Gui, 1:Submit, NoHide } ;===================================================================== ;=================== Buttons ========================================= ;===================================================================== ButtonOn: tablecolor:= "" last_table_id := "" tablequeue := "" most_urgent_table := "" GoSub, RefreshLobby GoSub, TableColor SetTimer, RefreshQueue, %RefreshQueue_timer% SetTimer, PopUpWatcher, %PopUpWatcher_timer% SetTimer, RefreshLobby, %RefreshLobby_timer% Suspend, Off GuiControl, 1:Disable, On GuiControl, 1:Enable, Off return ButtonOff: SetTimer, RefreshQueue, Off SetTimer, PopUpWatcher, Off SetTimer, RefreshLobby, Off SetTimer, TableColor, Off Gui, 2: Cancel Gui, 3: Cancel Gui, 4: Cancel Gui, 5: Cancel tablecolor:="" Suspend, On GuiControl, 1:Disable, Off GuiControl, 1:Enable, On return ;===================================================================== ;=================== Urgent Table Functions ========================== ;===================================================================== RefreshQueue: null:=false ids := TableIDListStars(LobbyPID) Loop, Parse, tablequeue, `, { StringTrimLeft, this_id, A_LoopField, InStr(A_LoopField, "_") if (!InStr(ids, this_id)) { StringReplace, tablequeue, tablequeue, %A_LoopField%, , All } } Loop, Parse, ids, `, { ifwinactive, ahk_id%A_LoopField% if PixelColor(foldx,foldy)!=fold { if (!InStr(tablequeue, A_LoopField)) { DllCall("QueryPerformanceCounter", "Int64 *", CurrentQPC) tablequeue := tablequeue . "," . CurrentQPC . "-" . A_TickCount . "_" . A_LoopField } null:=true } ControlGet, v, Visible, , PokerStarsSliderEditorClass1, ahk_id%A_LoopField% if ( v = 1 ) { if (!InStr(tablequeue, A_LoopField)) { DllCall("QueryPerformanceCounter", "Int64 *", CurrentQPC) tablequeue := tablequeue . "," . CurrentQPC . "-" . A_TickCount . "_" . A_LoopField } } else { col:=PixelcolorA(foldx,foldy,A_LoopField) if col!=%fold% { if (!InStr(tablequeue, A_LoopField)) { DllCall("QueryPerformanceCounter", "Int64 *", CurrentQPC) tablequeue := tablequeue . "," . CurrentQPC . "-" . A_TickCount . "_" . A_LoopField } } else if (InStr(tablequeue, A_LoopField)) { StringReplace, tablequeue, tablequeue, %A_LoopField%, , All } } } tmpvar := "" Loop, Parse, tablequeue, `, { if (InStr(A_LoopField, "0x")) { tmpvar := tmpvar . "," . A_LoopField } } Sort, tmpvar, N D`, tablequeue := CleanList(tmpvar) most_urgent_table := "" Loop, Parse, tablequeue, `, { StringTrimLeft, most_urgent_table, A_LoopField, InStr(A_LoopField, "_") break } if ( TimeBankClicker = 1 ) { tc := A_TickCount Loop, Parse, tablequeue, `, { StringTrimLeft, waiting_time, A_LoopField, InStr(A_LoopField, "-") StringTrimRight, waiting_time, waiting_time, ( StrLen(waiting_time) - (InStr(waiting_time, "_")-1) ) waiting_time := (tc - waiting_time) / 1000 if (waiting_time > timebank_min && waiting_time < timebank_max) { StringTrimLeft, waiting_table, A_LoopField, InStr(A_LoopField, "_") ;timebank_x := 560 ; lastmax 565 ;timebank_y := 430 ; lastmax 430 +/-10 too much timebank_x :=0.6582 timebank_y :=0.7729 relStarsClientPoint(waiting_table, timebank_x, timebank_y) PostLeftClick(timebank_x, timebank_y, waiting_table, 0) } } } if ( ActivateUrgent = 1 ) if !null { WinActivate, ahk_id%most_urgent_table% if ( AlternateDetection = 1 ) { color:=TableColor(most_urgent_table) if ( color != tablecolor ) { if ( Highlight = 1 || MoveMouse = 1) makegui(most_urgent_table, Highlight, MoveMouse, beep, x_mouse, y_mouse) } } else { if ( Highlight = 1 || MoveMouse = 1) makegui(most_urgent_table, Highlight, MoveMouse, beep, x_mouse, y_mouse) } } else { if ( Highlight = 1 || MoveMouse = 1) makegui(most_urgent_table, Highlight, MoveMouse, beep, x_mouse, y_mouse) } return makegui(id="", Highlight=1, MoveMouse=1, beep=0, x_mouse=0.75, y_mouse=0.75 ) { global last_table_id global border_colour global border_size global trans if (id != last_table_id) { last_table_id := id if(!id) { Gui, 2: Cancel Gui, 3: Cancel Gui, 4: Cancel Gui, 5: Cancel return } WinGetPos, x, y, w, h, ahk_id%id% global border global caption x := x + border y := y + border + caption w := w - (2*border) h := h - (2*border) - caption ;Makes Border around urgent table if ( Highlight = 1 ) { ;top guinum := 2 Gui, %guinum%: +Alwaysontop +Lastfound +Owner Gui, %guinum%: Color, %border_colour% WinSet, Transparent, %trans% Gui, %guinum%: -Caption Gui, %guinum%: Show, w%w% h%border_size% x%x% y%y% NoActivate ;left guinum++ Gui, %guinum%: +Alwaysontop +Lastfound +Owner Gui, %guinum%: Color, %border_colour% WinSet, Transparent, %trans% Gui, %guinum%: -Caption Gui, %guinum%: Show, w%border_size% h%h% x%x% y%y% NoActivate ;bottom guinum++ Gui, %guinum%: +Alwaysontop +Lastfound +Owner Gui, %guinum%: Color, %border_colour% WinSet, Transparent, %trans% Gui, %guinum%: -Caption y2 := y + h - border_size Gui, %guinum%: Show, w%w% h%border_size% x%x% y%y2% NoActivate ;right guinum++ Gui, %guinum%: +Alwaysontop +Lastfound +Owner Gui, %guinum%: Color, %border_colour% WinSet, Transparent, %trans% Gui, %guinum%: -Caption x2 := x + w - border_size Gui, %guinum%: Show, w%border_size% h%h% x%x2% y%y% NoActivate } ;Puts mouse pointer nearer the bet buttons if ( MoveMouse = 1) { x3 := x + (w * x_mouse) y3 := y + (h * y_mouse) Coordmode, Mouse, Screen MouseMove, x3, y3, 0 } ;Beeps on urgent table if ( beep = 1 ) SoundBeep, 750, 100 } } ;removes empty items (and trailing delimiters) CleanList(list, del="") { del := del="" ? "," : del Loop { StringReplace, list, list, %del%%del%, %del%, UseErrorLevel If ! ErrorLevel break } If InStr(list, del) = 1 StringTrimLeft, list, list, 1 If InStr(list, del,0,0) = StrLen(list) StringTrimRight, list, list, 1 return list } PostLeftClick(x, y, table_id, activate=1, control_class="") { ; ### 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), %control_class%, ahk_id%table_id% PostMessage, 0x202 , 0, ((y<<16)^x), %control_class%, ahk_id%table_id% } relStarsClientPoint(id, ByRef x, ByRef y) { SysGet, xbord, 32 SysGet, ybord, 33 SysGet, cap, 4 WinGetPos, , , w, h, ahk_id%id% w := w - (2*xbord) h := h - (2*ybord) - cap Transform, X, Round, W*x Transform, Y, Round, H*y } TableColor(id) { CoordMode, Pixel, Screen WinGetPos, x, y, w, h, ahk_id%id% rw := 800 rh := 578 x := x+475 y := y+555 x := Floor( (x / rw ) * w ) y := Floor( (y / rh) * h ) PixelGetColor, color, %x%, %y%, RGB return color } TableColor: tableids := TableIDListStars(LobbyPID) Loop, Parse, tableids, `, { ControlGet, v, Visible, , PokerStarsSliderEditorClass1, ahk_id%A_LoopField% if ( v != 1 ) { WinActivate, ahk_id%a_loopfield% sleep, 500 tablecolor:=TableColor(a_loopfield) break } } if ( tablecolor != "" ) SetTimer, TableColor, Off else SetTimer, TableColor, %TableColor_timer% return ;===================================================================== ;=================== SNG Registration Functions ====================== ;===================================================================== RegSNG(id) { if ( SafeReg = 1 ) { IfWinActive, ahk_id%id% RegSNGexec(id) } else { RegSNGexec(id) } } RegSNGexec(id) { ControlGet, v, Visible, , PokerStarsButtonClass8, ahk_id%id% if v { ControlClick, PokerStarsButtonClass8, ahk_id%id% WinWait, Tournament Registration ahk_class #32770, , 10 { WinGet, regid, id ControlFocus, Button3, ahk_id%regid% Sleep, -1 ControlSend, Button3, {SPACE}, ahk_id%regid% } WinWait, Tournament Registration ahk_class #32770, , 10 { WinGet, regid, id ControlGetText, ctext, Button1, ahk_id%regid% if ( cText = "OK" ) { ControlFocus, Button1, ahk_id%regid% Sleep, -1 ControlSend, Button1, {SPACE}, ahk_id%regid% } } } else { ControlGet, v, Visible, , PokerStarsButtonClass6, ahk_id%id% if v { ControlClick, PokerStarsButtonClass6, ahk_id%id% WinWait, Tournament Registration ahk_class #32770, , 10 { WinGet, regid, id ControlGetText, ctext, Button1, ahk_id%regid% if ( cText = "OK" ) { ControlFocus, Button1, ahk_id%regid% Sleep, -1 ControlSend, Button1, {SPACE}, ahk_id%regid% } } } } } CloseTournamentLobby(id, pid) { Loop { IfWinExist, Lobby ahk_pid%pid%,, PokerStars Lobby WinClose else break } Sleep, 100 WinGet, state, MinMax, ahk_id%id% if ( state = 1 || state = 0 ) WinMinimize, ahk_id%id% } ;===================================================================== ;=================== Join Cashgame Functions ========================= ;===================================================================== OpenJoinUnJoinTable(id) { ControlGet, v, Visible, , PokerStarsButtonClass4, ahk_id%id% if ( v = 1 ) { ControlClick, PokerStarsButtonClass4, ahk_id%id% ;WinWait, Waiting List ahk_class #32770, , 10 { WinGet, joinid, id ControlFocus, Button1, ahk_id%joinid% Sleep, -1 ControlSend, Button1, {SPACE}, ahk_id%joinid% } } else { ControlGet, v, Visible, , PokerStarsButtonClass3, ahk_id%id% if ( v = 1 ) { ControlClick, PokerStarsButtonClass3, ahk_id%id% } } } ;===================================================================== ;=================== Popup Functions ================================= ;===================================================================== PopUpWatcher: If ( KillPopups = 1 ) KillPopUps(LobbyPID) if ( AutoTakeSeat = 1 ) TakeSeat(LobbyPID) return KillPopUps(pid) { IfWinExist, PokerStars ahk_class #32770 ahk_pid%pid% { WinGet, list1, list, PokerStars ahk_class #32770 ahk_pid%pid%, , Lobby Loop, %list1% { This_id := list1%A_Index% WinGet, list2, ControlList, ahk_id%this_id% if (InStr(list2, "Button2")) { continue } else { Loop, 20 { ControlFocus, Button1, ahk_id%this_id% Sleep, -1 ControlSend, Button1, {SPACE}, ahk_id%this_id% Sleep, 100 IfWinNotExist, ahk_id%this_id% { break } } } } } } TakeSeat(pid) { IfWinExist, PokerStars ahk_class #32770 ahk_pid%pid% { WinGet, list, list, Seat Available ahk_class #32770 ahk_pid%pid% Loop, %list% { This_id := list%A_Index% ControlFocus, Button2, ahk_id%this_id% Sleep, -1 ControlSend, Button2, {SPACE}, ahk_id%this_id% } } } ;===================================================================== ;=================== Lobby & Tables Functions ======================== ;===================================================================== RefreshLobby: WinGet, LobbyID, id, PokerStars Lobby WinGet, LobbyPID, PID, ahk_id%LobbyID% return MaxMinLobby(id) { WinGetActiveTitle, title IfInString, title, PokerStars Lobby { WinMinimize,ahk_id%id% } else { WinActivate, ahk_id%id% } } TableIDListStars(pid) { WinGet, list, list, / ahk_pid%pid%, , Lobby Loop %list% { this_id := list%a_index% If (this_id != id) { ids = %ids%,%this_id% } } StringTrimLeft, ids, ids, 1 return ids } ;===================================================================== ;=================== Colors ======================== ;===================================================================== GetColfold: GetCol("fold",foldx,foldy) return ;----------------------------------------------------------------------------------------------------- GetCol(var,xc,yc) { global Gui, +toolwindow -AlwaysOnTop winactivate, ahk_class PokerStarsTableFrameClass IfWinActive, ahk_class PokerStarsTableFrameClass { col:=PixelColor(xc,yc) Gui, 11:Add, Text,, saving color: %col% Gui, 11:+ToolWindow Gui, 11:Show, w150 h20 Sleep, 1000 Gui, 11:Destroy IniWrite, %col%, %ini%, Prefs, %var% Gui, 11:Add, Text,, done Gui, 11:+ToolWindow Gui, 11:Show, w150 h20 Sleep, 1000 Gui, 11:Destroy if (col="") or (col=0) %var%:="not defined" else %var%:=col Gui, 1:Destroy buildgui() Gui, +toolwindow +AlwaysOnTop } } return ;----------------------------------------------------------------------------------------------------- PixelColor(colx,coly) { CoordMode, Pixel, Relative WinGetPos, X, Y, W, H, A SysGet, xbord, 32 SysGet, ybord, 33 SysGet, cap, 4 w := w - (2*xbord) h := h - (2*ybord) - cap Transform, X, Round, W*colx Transform, Y, Round, H*coly x := x + xbord y := y + ybord + cap winget, id ,id, A wingettitle, tid, A PixelGetColor, fcol, %X%, %Y% return fcol } ;----------------------------------------------------------------------------------------------------- PixelColorA(colxa,colya,id) { ; Set up a DC hdc_frame := DllCall( "GetDC", UInt, PokerWindowID ) hdc_buffer := DllCall("gdi32.dll\CreateCompatibleDC", UInt, hdc_frame) hbm_buffer := DllCall("gdi32.dll\CreateCompatibleBitmap", UInt,hdc_frame, Int,A_ScreenWidth, Int,A_ScreenHeight) DllCall( "gdi32.dll\SelectObject", UInt,hdc_buffer, UInt,hbm_buffer) DllCall( "PrintWindow", UInt , id , UInt , hdc_buffer , UInt , 0 ) Dllcall("InvalidateRect", "uint",id , "uint",0 , "uint",1) WinGetPos, X, Y, W, H, ahk_id %id% SysGet, xbord, 32 SysGet, ybord, 33 SysGet, cap, 4 w := w - (2*xbord) h := h - (2*ybord) - cap Transform, X, Round, W*colxa Transform, Y, Round, H*colya pixel_x := x + xbord pixel_y := y + ybord + cap pix := DllCall("GetPixel", UInt, hdc_buffer, Int, pixel_x , Int, pixel_y) SetFormat, IntegerFast, hex pix += 0 ; Sets Var (which previously contained 11) to be 0xb. pix .= "" ; Necessary due to the "fast" mode. SetFormat, IntegerFast, d DllCall( "gdi32.dll\DeleteObject", "uint", hbm_buffer ) DllCall( "gdi32.dll\DeleteDC" , "uint", hdc_frame ) DllCall( "gdi32.dll\DeleteDC" , "uint", hdc_buffer ) return pix } ;===================================================================== ClickImBack() { IfWinActive, ahk_class PokerStarsTableFrameClass WinGet, WinId, ID, A WinGet, list, List, ahk_class PokerStarsTableFrameClass Loop, %list% { Z:=list%A_Index% WinGetPos, X, Y, W, H, ahk_id %Z% Sittingout:=PixelColorA(0.8125,0.8621,Z) JoinWaitingList:=PixelColorA(0.8625,0.8621,Z) If (Sittingout=0x000000) OR (Sittingout=0xDFD9CE) OR (Sittingout=0xD2EBF3) OR (Sittingout=0xB3A39D) OR (Sittingout=0x9D9D9D) OR (Sittingout=0xCCCCCC) OR (Sittingout=0xDEDBCE) OR (Sittingout=0xB5A29c) OR (Sittingout=0xBDAEAD) OR (Sittingout=0xFCF8F2) If (JoinWaitingList!=0x000000) AND (JoinWaitingList!=0xDFD9CE) AND (JoinWaitingList!=0xDEDBCE) AND (JoinWaitingList!=0x0xB5A29c) AND (JoinWaitingList!=0xBDAEAD) { back_x :=0.7515 back_y :=0.8468 relStarsClientPoint(Z, back_x, back_y) PostLeftClick(back_x, back_y, Z, 0) } } winactivate, ahk_id %winid% } ;=====================================================================
Timebank clicker should work correctly in both versions.
There was one mistake in "new" version, to make Highlight work properly without "Activate urgent table" option turned on replace these strings
with these
Code:
if ( ActivateUrgent = 1 ) if !null { WinActivate, ahk_id%most_urgent_table%
Code:
if ( ActivateUrgent = 1 ) { if !null WinActivate, ahk_id%most_urgent_table%
thanks max1mus,
could you post the complete version at overcards, so not everyone has to copy & paste?
could you post the complete version at overcards, so not everyone has to copy & paste?
Look at my post below for complete version with old "urgent table" function, and here is updated version of script with 'new' function (made some fixes, added one new option).
Code:
; #### StarsAssistant #### ; AHK version: 1.0.46.05 ; date: December 02,2009 version := "0.88a" ; author: Chris228 @ 2p2 forums ; thx to _dave_, JBOPoker, Roland, JukofYork & pusteblume ; based on ; #### StarsUrgentTable #### ; AHK version: 1.0.46.03 ; date: May 24,2007 ; version: 0.75a ; author: _dave_ @ 2p2 forums ; revised by: JBOPoker @ earthlink.net ; thx to Roland & JukofYork for some of the functions ;===================================================================== ;=================== Settings ======================================== ;===================================================================== ; Hotkeys see below ; Border of the "Highlighter" border_colour := "ff0000" border_size := 5 trans := 255 ; Timings for the "Time Bank Clicker" [fast/turbo 8/17; normal 20/35; both 8/35] timebank_min := 8 timebank_max := 35 ; Beep on urgent table beep := 0 ; Position of the mouse in perc of the table window x_mouse := 0.75 y_mouse := 0.75 foldx:=0.5575 foldy:=0.9846 ; Don't edit below unless you know what you do (except Hotkeys) ; Gui Settings settings() { global ini:="StarsAssistant.ini" iniRead, AutoOn, %ini%, Prefs, AutoOn, 1 iniRead, Highlight, %ini%, Prefs, Highlight, 1 iniRead, MoveMouse, %ini%, Prefs, MoveMouse, 1 iniRead, TimeBankClicker, %ini%, Prefs, TimeBankClicker, 1 iniRead, AlternateDetection, %ini%, Prefs, AlternateDetection, 0 iniRead, ActivateUrgent, %ini%, Prefs, ActivateUrgent, 0 iniRead, KillPopups, %ini%, Prefs, KillPopups, 0 iniRead, SafeReg, %ini%, Prefs, SafeReg, 1 iniRead, AutoTakeSeat, %ini%, Prefs, AutoTakeSeat, 0 IniRead, fold, %ini%, Prefs, fold, 0 } ; Intervalls for sub execution RefreshQueue_timer := 333 RefreshLobby_timer := 1000 PopUpWatcher_timer := 200 TableColor_timer := 500 ;===================================================================== ;=================== Autoexec ======================================== ;===================================================================== #NoEnv #SingleInstance, Force #Include %a_scriptDir% SendMode Input SetTitleMatchMode, 2 SetWorkingDir %a_scriptDir% OnExit exitSub once:=true settings() TrayMenu() BuildGui() Gui, 10: Show, hide, x1 y1 h1 w1, PokerWindow WinGet PokerWindowID, id, PokerWindow Suspend, On SysGet, border, 32 SysGet, caption, 4 if ( AutoOn = 1 ) { Gosub, ButtonOn } return ;===================================================================== ;=================== Hotkeys ========================================= ;===================================================================== ^a:: ToggleCheckbox("MoveMouse") return ;^w:: ; ToggleCheckbox("AlternateDetection") ;return ^s:: MaxMinLobby(LobbyID) return ^d:: MinMaxStarsAssistant() return ^r:: RegSNG(LobbyID) OpenJoinUnJoinTable(LobbyID) return ^e:: CloseTournamentLobby(LobbyID, LobbyPID) return ^u::ClickImBack() return ^i::SitOutNextAll() return ;===================================================================== ;=================== Gui ============================================= ;===================================================================== trayMenu() { global Menu, Tray, noStandard Menu, Tray, Add, &Show, Show Menu, Tray, default, &Show Menu, Tray, Add Menu, Tray, Add, &About, About Menu, Tray, Add, &Help, Help Menu, Tray, Add Menu, Tray, Add, E&xit, Exit Menu, Tray, Tip, StarsAssistant v%version% } buildGui() { global Gui 1:Default Gui, +toolwindow +AlwaysOnTop Gui, Margin, 5, 5 Gui, Font,, Verdena Gui, Add, Button, vOn section w56 h20 center, &On Gui, Add, Button, vOff disabled w56 h20 ys xs+56 center, &Off Gui, Add, Checkbox, checked%AutoOn% vAutoOn gSubmit xs+2, &Auto on Gui, Add, Text, section x7 0x1000 w110 h2 Gui, Add, Checkbox, checked%Highlight% vHighlight gSubmit xs, &Highlight table Gui, Add, Checkbox, checked%MoveMouse% vMoveMouse gSubmit xs, &Move mouse (Ctrl+a) Gui, Add, Checkbox, checked%TimeBankClicker% vTimeBankClicker gSubmit xs, &Click time bank Gui, Add, Checkbox, checked%AlternateDetection% vAlternateDetection gSubmit xs, &Detect All-in/Fixed l. Gui, Add, Checkbox, checked%ActivateUrgent% vActivateUrgent gSubmit xs, &Activate urgent table Gui, Add, Checkbox, checked%KillPopups% vKillPopups gSubmit xs, &Kill popups Gui, Add, Checkbox, checked%SafeReg% vSafeReg gSubmit xs, &Safe SNG regist. (Ctrl+r) Gui, Add, Checkbox, checked%AutoTakeSeat% vAutoTakeSeat gSubmit xs, &Auto take seat Gui, Add, Text, w270 h12 xs, &Remove sitout from all tables (Ctrl+u) Gui, Add, Text, w270 h12 xs, &Sitout on all tables (Ctrl+i) ; Gui, Add, Button, ggetcolfold w40 h20 xs, &Save ; if (fold=0) or (fold="") or (fold=not defined) ; { ; Gui, Add, Text, w270 h13 cRed xs, &Warning! ; Gui, Add, Text, w270 h12 cRed xs, &Color has not been saved ; Gui, Add, Text, w270 h12 xs, &Open any Pokerstars table ; Gui, Add, Text, w270 h12 xs, &with "fold" button NOT visible ; Gui, Add, Text, w270 h12 xs, &and press save ; } ; else ; { ; Gui, Add, Text, w270 h12 xs, ¤t "fold" color : ; Gui, Add, Text, w270 h12 xs, &"%fold%" ; } IniRead, x, % ini, Gui, x, center IniRead, y, % ini, Gui, y, center Gui, Show, x%x% y%y% w194, StarsAssistant } Show: Gui, 1:Show return About: Msgbox,, StarsAssistant, StarsAssistant v%version% `nAuthor: Chris228 @ 2+2 formus`nE-Mail: chris228@gmx.de`nSee file for further credits`n`nIf you like my program I would be happy about a donation.`nMy screenname on PokerStars is 'mr.cray'.`nThank you! return Help: Run % web() "http://overcards.com/wiki/moin.cgi/StarsAssistant" return web() { ; by Titan, modified by Roland regRead, p, HKCR, HTTP\shell\open\command return SubStr(p, 1, InStr(p, ".exe")+4) } Exit: exitApp GuiClose: Gui 1:Cancel return Submit: Gui, 1:Submit, NoHide return exitSub: Gui 1:Default Gui, Submit Gui +lastfound WinGetPos, x, y IniWrite, % x, % ini, Gui, x IniWrite, % y, % ini, Gui, y IniWrite, % AutoOn, % ini, Prefs, AutoOn IniWrite, % Highlight, % ini, Prefs, Highlight IniWrite, % MoveMouse, % ini, Prefs, MoveMouse IniWrite, % TimeBankClicker, % ini, Prefs, TimeBankClicker IniWrite, % AlternateDetection, % ini, Prefs, AlternateDetection IniWrite, % ActivateUrgent, % ini, Prefs, ActivateUrgent IniWrite, % KillPopups, % ini, Prefs, KillPopups IniWrite, % SafeReg, % ini, Prefs, SafeReg IniWrite, % AutoTakeSeat, % ini, Prefs, AutoTakeSeat IniWrite, %fold%, %ini%, Prefs,fold exitApp MinMaxStarsAssistant() { WinGetActiveTitle, title If ( title = "StarsAssistant" ) Gui 1:Cancel else Gui, 1:Show } ToggleCheckbox(box) { Gui 1:Default GuiControlGet, state, , %box% if ( state = 1 ) GuiControl, , %box%, 0 if ( state = 0 ) GuiControl, , %box%, 1 Gui, 1:Submit, NoHide } ;===================================================================== ;=================== Buttons ========================================= ;===================================================================== ButtonOn: tablecolor:= "" last_table_id := "" tablequeue := "" most_urgent_table := "" GoSub, RefreshLobby GoSub, TableColor SetTimer, RefreshQueue, %RefreshQueue_timer% SetTimer, PopUpWatcher, %PopUpWatcher_timer% SetTimer, RefreshLobby, %RefreshLobby_timer% Suspend, Off GuiControl, 1:Disable, On GuiControl, 1:Enable, Off return ButtonOff: SetTimer, RefreshQueue, Off SetTimer, PopUpWatcher, Off SetTimer, RefreshLobby, Off SetTimer, TableColor, Off Gui, 2: Cancel Gui, 3: Cancel Gui, 4: Cancel Gui, 5: Cancel tablecolor:="" Suspend, On GuiControl, 1:Disable, Off GuiControl, 1:Enable, On return ;===================================================================== ;=================== Urgent Table Functions ========================== ;===================================================================== RefreshQueue: null:=false ids := TableIDListStars(LobbyPID) Loop, Parse, tablequeue, `, { StringTrimLeft, this_id, A_LoopField, InStr(A_LoopField, "_") if (!InStr(ids, this_id)) { StringReplace, tablequeue, tablequeue, %A_LoopField%, , All } } Loop, Parse, ids, `, { ifwinactive, ahk_id%A_LoopField% if PixelColor(foldx,foldy)!=fold { if (!InStr(tablequeue, A_LoopField)) { DllCall("QueryPerformanceCounter", "Int64 *", CurrentQPC) tablequeue := tablequeue . "," . CurrentQPC . "-" . A_TickCount . "_" . A_LoopField } null:=true } ControlGet, v, Visible, , PokerStarsSliderEditorClass1, ahk_id%A_LoopField% if ( v = 1 ) { if (!InStr(tablequeue, A_LoopField)) { DllCall("QueryPerformanceCounter", "Int64 *", CurrentQPC) tablequeue := tablequeue . "," . CurrentQPC . "-" . A_TickCount . "_" . A_LoopField } } else { col:=PixelcolorA(foldx,foldy,A_LoopField) if col!=%fold% { if (!InStr(tablequeue, A_LoopField)) { DllCall("QueryPerformanceCounter", "Int64 *", CurrentQPC) tablequeue := tablequeue . "," . CurrentQPC . "-" . A_TickCount . "_" . A_LoopField } } else if (InStr(tablequeue, A_LoopField)) { StringReplace, tablequeue, tablequeue, %A_LoopField%, , All } } } tmpvar := "" Loop, Parse, tablequeue, `, { if (InStr(A_LoopField, "0x")) { tmpvar := tmpvar . "," . A_LoopField } } Sort, tmpvar, N D`, tablequeue := CleanList(tmpvar) most_urgent_table := "" Loop, Parse, tablequeue, `, { StringTrimLeft, most_urgent_table, A_LoopField, InStr(A_LoopField, "_") break } if ( TimeBankClicker = 1 ) { tc := A_TickCount Loop, Parse, tablequeue, `, { StringTrimLeft, waiting_time, A_LoopField, InStr(A_LoopField, "-") StringTrimRight, waiting_time, waiting_time, ( StrLen(waiting_time) - (InStr(waiting_time, "_")-1) ) waiting_time := (tc - waiting_time) / 1000 if (waiting_time > timebank_min && waiting_time < timebank_max) { StringTrimLeft, waiting_table, A_LoopField, InStr(A_LoopField, "_") ;timebank_x := 560 ; lastmax 565 ;timebank_y := 430 ; lastmax 430 +/-10 too much timebank_x :=0.6582 timebank_y :=0.7729 relStarsClientPoint(waiting_table, timebank_x, timebank_y) PostLeftClick(timebank_x, timebank_y, waiting_table, 0) } } } if ( ActivateUrgent = 1 ) { if !null WinActivate, ahk_id%most_urgent_table% if ( AlternateDetection = 1 ) { color:=TableColor(most_urgent_table) if ( color != tablecolor ) { if ( Highlight = 1 || MoveMouse = 1) makegui(most_urgent_table, Highlight, MoveMouse, beep, x_mouse, y_mouse) } } else { if ( Highlight = 1 || MoveMouse = 1) makegui(most_urgent_table, Highlight, MoveMouse, beep, x_mouse, y_mouse) } } else { if ( Highlight = 1 || MoveMouse = 1) makegui(most_urgent_table, Highlight, MoveMouse, beep, x_mouse, y_mouse) } return makegui(id="", Highlight=1, MoveMouse=1, beep=0, x_mouse=0.75, y_mouse=0.75 ) { global last_table_id global border_colour global border_size global trans if (id != last_table_id) { last_table_id := id if(!id) { Gui, 2: Cancel Gui, 3: Cancel Gui, 4: Cancel Gui, 5: Cancel return } WinGetPos, x, y, w, h, ahk_id%id% global border global caption x := x + border y := y + border + caption w := w - (2*border) h := h - (2*border) - caption ;Makes Border around urgent table if ( Highlight = 1 ) { ;top guinum := 2 Gui, %guinum%: +Alwaysontop +Lastfound +Owner Gui, %guinum%: Color, %border_colour% WinSet, Transparent, %trans% Gui, %guinum%: -Caption Gui, %guinum%: Show, w%w% h%border_size% x%x% y%y% NoActivate ;left guinum++ Gui, %guinum%: +Alwaysontop +Lastfound +Owner Gui, %guinum%: Color, %border_colour% WinSet, Transparent, %trans% Gui, %guinum%: -Caption Gui, %guinum%: Show, w%border_size% h%h% x%x% y%y% NoActivate ;bottom guinum++ Gui, %guinum%: +Alwaysontop +Lastfound +Owner Gui, %guinum%: Color, %border_colour% WinSet, Transparent, %trans% Gui, %guinum%: -Caption y2 := y + h - border_size Gui, %guinum%: Show, w%w% h%border_size% x%x% y%y2% NoActivate ;right guinum++ Gui, %guinum%: +Alwaysontop +Lastfound +Owner Gui, %guinum%: Color, %border_colour% WinSet, Transparent, %trans% Gui, %guinum%: -Caption x2 := x + w - border_size Gui, %guinum%: Show, w%border_size% h%h% x%x2% y%y% NoActivate } ;Puts mouse pointer nearer the bet buttons if ( MoveMouse = 1) { x3 := x + (w * x_mouse) y3 := y + (h * y_mouse) Coordmode, Mouse, Screen MouseMove, x3, y3, 0 } ;Beeps on urgent table if ( beep = 1 ) SoundBeep, 750, 100 } } ;removes empty items (and trailing delimiters) CleanList(list, del="") { del := del="" ? "," : del Loop { StringReplace, list, list, %del%%del%, %del%, UseErrorLevel If ! ErrorLevel break } If InStr(list, del) = 1 StringTrimLeft, list, list, 1 If InStr(list, del,0,0) = StrLen(list) StringTrimRight, list, list, 1 return list } PostLeftClick(x, y, table_id, activate=1, control_class="") { ; ### 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), %control_class%, ahk_id%table_id% PostMessage, 0x202 , 0, ((y<<16)^x), %control_class%, ahk_id%table_id% } relStarsClientPoint(id, ByRef x, ByRef y) { SysGet, xbord, 32 SysGet, ybord, 33 SysGet, cap, 4 WinGetPos, , , w, h, ahk_id%id% w := w - (2*xbord) h := h - (2*ybord) - cap Transform, X, Round, W*x Transform, Y, Round, H*y } TableColor(id) { CoordMode, Pixel, Screen WinGetPos, x, y, w, h, ahk_id%id% rw := 800 rh := 578 x := x+475 y := y+555 x := Floor( (x / rw ) * w ) y := Floor( (y / rh) * h ) PixelGetColor, color, %x%, %y%, RGB return color } TableColor: tableids := TableIDListStars(LobbyPID) Loop, Parse, tableids, `, { ControlGet, v, Visible, , PokerStarsSliderEditorClass1, ahk_id%A_LoopField% if ( v != 1 ) { WinActivate, ahk_id%a_loopfield% sleep, 500 tablecolor:=TableColor(a_loopfield) break } } if ( tablecolor != "" ) SetTimer, TableColor, Off else SetTimer, TableColor, %TableColor_timer% return ;===================================================================== ;=================== SNG Registration Functions ====================== ;===================================================================== RegSNG(id) { if ( SafeReg = 1 ) { IfWinActive, ahk_id%id% RegSNGexec(id) } else { RegSNGexec(id) } } RegSNGexec(id) { ControlGet, v, Visible, , PokerStarsButtonClass8, ahk_id%id% if v { ControlClick, PokerStarsButtonClass8, ahk_id%id% WinWait, Tournament Registration ahk_class #32770, , 10 { WinGet, regid, id ControlFocus, Button3, ahk_id%regid% Sleep, -1 ControlSend, Button3, {SPACE}, ahk_id%regid% } WinWait, Tournament Registration ahk_class #32770, , 10 { WinGet, regid, id ControlGetText, ctext, Button1, ahk_id%regid% if ( cText = "OK" ) { ControlFocus, Button1, ahk_id%regid% Sleep, -1 ControlSend, Button1, {SPACE}, ahk_id%regid% } } } else { ControlGet, v, Visible, , PokerStarsButtonClass6, ahk_id%id% if v { ControlClick, PokerStarsButtonClass6, ahk_id%id% WinWait, Tournament Registration ahk_class #32770, , 10 { WinGet, regid, id ControlGetText, ctext, Button1, ahk_id%regid% if ( cText = "OK" ) { ControlFocus, Button1, ahk_id%regid% Sleep, -1 ControlSend, Button1, {SPACE}, ahk_id%regid% } } } } } CloseTournamentLobby(id, pid) { Loop { IfWinExist, Lobby ahk_pid%pid%,, PokerStars Lobby WinClose else break } Sleep, 100 WinGet, state, MinMax, ahk_id%id% if ( state = 1 || state = 0 ) WinMinimize, ahk_id%id% } ;===================================================================== ;=================== Join Cashgame Functions ========================= ;===================================================================== OpenJoinUnJoinTable(id) { ControlGet, v, Visible, , PokerStarsButtonClass4, ahk_id%id% if ( v = 1 ) { ControlClick, PokerStarsButtonClass4, ahk_id%id% ;WinWait, Waiting List ahk_class #32770, , 10 { WinGet, joinid, id ControlFocus, Button1, ahk_id%joinid% Sleep, -1 ControlSend, Button1, {SPACE}, ahk_id%joinid% } } else { ControlGet, v, Visible, , PokerStarsButtonClass3, ahk_id%id% if ( v = 1 ) { ControlClick, PokerStarsButtonClass3, ahk_id%id% } } } ;===================================================================== ;=================== Popup Functions ================================= ;===================================================================== PopUpWatcher: If ( KillPopups = 1 ) KillPopUps(LobbyPID) if ( AutoTakeSeat = 1 ) TakeSeat(LobbyPID) return KillPopUps(pid) { IfWinExist, PokerStars ahk_class #32770 ahk_pid%pid% { WinGet, list1, list, PokerStars ahk_class #32770 ahk_pid%pid%, , Lobby Loop, %list1% { This_id := list1%A_Index% WinGet, list2, ControlList, ahk_id%this_id% if (InStr(list2, "Button2")) { continue } else { Loop, 20 { ControlFocus, Button1, ahk_id%this_id% Sleep, -1 ControlSend, Button1, {SPACE}, ahk_id%this_id% Sleep, 100 IfWinNotExist, ahk_id%this_id% { break } } } } } } TakeSeat(pid) { IfWinExist, PokerStars ahk_class #32770 ahk_pid%pid% { WinGet, list, list, Seat Available ahk_class #32770 ahk_pid%pid% Loop, %list% { This_id := list%A_Index% ControlFocus, Button2, ahk_id%this_id% Sleep, -1 ControlSend, Button2, {SPACE}, ahk_id%this_id% } } } ;===================================================================== ;=================== Lobby & Tables Functions ======================== ;===================================================================== RefreshLobby: WinGet, LobbyID, id, PokerStars Lobby WinGet, LobbyPID, PID, ahk_id%LobbyID% return MaxMinLobby(id) { WinGetActiveTitle, title IfInString, title, PokerStars Lobby { WinMinimize,ahk_id%id% } else { WinActivate, ahk_id%id% } } TableIDListStars(pid) { global once, foldx, foldy ifwinexist, ahk_class PokerStarsTableFrameClass if once { GetCol("fold",foldx,foldy) once:=false gui 1:submit,nohide } WinGet, list, list, / ahk_pid%pid%, , Lobby Loop %list% { this_id := list%a_index% If (this_id != id) { ids = %ids%,%this_id% } } StringTrimLeft, ids, ids, 1 return ids } ;===================================================================== ;=================== Colors ======================== ;===================================================================== GetColfold: GetCol("fold",foldx,foldy) return ;----------------------------------------------------------------------------------------------------- GetCol(var,xc,yc) { global Gui, +toolwindow -AlwaysOnTop winactivate, ahk_class PokerStarsTableFrameClass IfWinActive, ahk_class PokerStarsTableFrameClass { col:=PixelColor(xc,yc) ;Gui, 11:Add, Text,, saving color: %col% ;Gui, 11:+ToolWindow ;Gui, 11:Show, w150 h20 ;Sleep, 1000 ;Gui, 11:Destroy IniWrite, %col%, %ini%, Prefs, %var% ;Gui, 11:Add, Text,, done ;Gui, 11:+ToolWindow ;Gui, 11:Show, w150 h20 ;Sleep, 1000 ;Gui, 11:Destroy if (col="") or (col=0) %var%:="not defined" else %var%:=col ;Gui, 1:Destroy ;buildgui() Gui, +toolwindow +AlwaysOnTop } } return ;----------------------------------------------------------------------------------------------------- PixelColor(colx,coly) { CoordMode, Pixel, Relative WinGetPos, X, Y, W, H, A SysGet, xbord, 32 SysGet, ybord, 33 SysGet, cap, 4 w := w - (2*xbord) h := h - (2*ybord) - cap Transform, X, Round, W*colx Transform, Y, Round, H*coly x := x + xbord y := y + ybord + cap winget, id ,id, A wingettitle, tid, A PixelGetColor, fcol, %X%, %Y% return fcol } ;----------------------------------------------------------------------------------------------------- PixelColorA(colxa,colya,id) { ;critical SysGet, xbord, 32 SysGet, ybord, 33 SysGet, cap, 4 ; Set up a DC hdc_frame := DllCall( "GetDC", UInt, PokerWindowID ) hdc_buffer := DllCall("gdi32.dll\CreateCompatibleDC", UInt, hdc_frame) WinGetPos, X, Y, W, H, ahk_id %id% hbm_buffer := DllCall("gdi32.dll\CreateCompatibleBitmap", UInt,hdc_frame, Int,w, Int,h) DllCall( "gdi32.dll\SelectObject", UInt,hdc_buffer, UInt,hbm_buffer) DllCall( "PrintWindow", "UInt" , id , "UInt" , hdc_buffer , "UInt" , 0 ) WinGetPos, X, Y, W, H, ahk_id %id% Dllcall("Invalidatergn", "uint", id, "uint",Dllcall("SetWindowRgn", "uint", id, "uint",DllCall("gdi32.dll", "uint", "setRectRgn", "uint", x, "uint", y, "uint", w, "uint", h), "uint", 1), "uint", 1) WinGet,ctrls,ControlList,ahk_id %id% Loop,Parse,ctrls,`n { class:=A_LoopField ControlGet,ctrlid,Hwnd,,%class%,ahk_id %id% ControlGet,visible,Visible,,,ahk_id %ctrlid% If visible=1 { ControlGetPos,ctrlx,ctrly,ctrlw,ctrlh,%class%,ahk_id %id% Dllcall("Invalidatergn", "uint", ctrlid, "uint",Dllcall("SetWindowRgn", "uint", ctrlid, "uint",DllCall("gdi32.dll", "uint", "setRectRgn", "uint", ctrlx, "uint", ctrly, "uint", ctrlw, "uint", ctrlh), "uint", 1), "uint", 1) WinSet, Redraw, , ahk_id%ctrlid% } } WinSet, Redraw, , ahk_id%id% w := w - (2*xbord) h := h - (2*ybord) - cap Transform, X, Round, W*colxa Transform, Y, Round, H*colya pixel_x := x + xbord pixel_y := y + ybord + cap pix := DllCall("GetPixel", UInt, hdc_buffer, Int, pixel_x , Int, pixel_y) SetFormat, IntegerFast, hex pix += 0 ; Sets Var (which previously contained 11) to be 0xb. pix .= "" ; Necessary due to the "fast" mode. SetFormat, IntegerFast, d DllCall( "gdi32.dll\DeleteObject", "uint", hbm_buffer ) DllCall( "gdi32.dll\ReleaseDC" , "uint", hdc_frame ) DllCall( "gdi32.dll\DeleteDC" , "uint", hdc_frame ) DllCall( "gdi32.dll\DeleteDC" , "uint", hdc_buffer ) return pix } ;===================================================================== ClickImBack() { IfWinActive, ahk_class PokerStarsTableFrameClass WinGet, WinId, ID, A WinGet, list, List, ahk_class PokerStarsTableFrameClass Loop, %list% { Z:=list%A_Index% WinGetPos, X, Y, W, H, ahk_id %Z% Sittingout:=PixelColorA(0.8125,0.8621,Z) JoinWaitingList:=PixelColorA(0.8625,0.8621,Z) If (Sittingout=0x000000) OR (Sittingout=0xDFD9CE) OR (Sittingout=0xD2EBF3) OR (Sittingout=0xB3A39D) OR (Sittingout=0x9D9D9D) OR (Sittingout=0xCCCCCC) OR (Sittingout=0xDEDBCE) OR (Sittingout=0xB5A29c) OR (Sittingout=0xBDAEAD) OR (Sittingout=0xFCF8F2) If (JoinWaitingList!=0x000000) AND (JoinWaitingList!=0xDFD9CE) AND (JoinWaitingList!=0xDEDBCE) AND (JoinWaitingList!=0x0xB5A29c) AND (JoinWaitingList!=0xBDAEAD) { back_x :=0.7515 back_y :=0.8468 relStarsClientPoint(Z, back_x, back_y) PostLeftClick(back_x, back_y, Z, 0) } } winactivate, ahk_id %winid% } ;===================================================================== SitOutNextAll() { IfWinActive, ahk_class PokerStarsTableFrameClass WinGet, WinId, ID, A WinGet, list, List, ahk_class PokerStarsTableFrameClass Loop, %list% { Z:=list%A_Index% WinGetPos, X, Y, W, H, ahk_id %Z% Sittingout:=PixelColorA(0.8125,0.8621,Z) ;JoinWaitingList:=PixelColorA(0.8625,0.8621,Z) If (Sittingout=0x000000) OR (Sittingout=0xDFD9CE) OR (Sittingout=0xD2EBF3) OR (Sittingout=0xB3A39D) OR (Sittingout=0x9D9D9D) OR (Sittingout=0xCCCCCC) OR (Sittingout=0xDEDBCE) OR (Sittingout=0xB5A29c) OR (Sittingout=0xBDAEAD) OR (Sittingout=0xFCF8F2) ; If (JoinWaitingList!=0x000000) AND (JoinWaitingList!=0xDFD9CE) AND (JoinWaitingList!=0xDEDBCE) AND (JoinWaitingList!=0x0xB5A29c) AND (JoinWaitingList!=0xBDAEAD) sit:=true else { back_x:=0.0141 back_y:=0.6840 relStarsClientPoint(Z, back_x, back_y) PostLeftClick(back_x, back_y, Z, 0) } } winactivate, ahk_id %winid% } return ;=====================================================================
hey man an auto add on feature for when the breaks start will totally help alot of ppl
Thanks for updating this Max1mums!
I'm getting an error message on these 2 lines when I start the script:
SetFormat, IntegerFast, hex
SetFormat, IntegerFast, d
Also, why are you posting a "new" and "old" urgent table function? Is the old function still useful? Does it do something the new function doesn't do?
Thanks!
I'm getting an error message on these 2 lines when I start the script:
SetFormat, IntegerFast, hex
SetFormat, IntegerFast, d
Also, why are you posting a "new" and "old" urgent table function? Is the old function still useful? Does it do something the new function doesn't do?
Thanks!
yo so i downloaded this software and unzipped it but all i get is errors.
Checked it out, everything is working fine, i guess you guys should update your autohotkey program: http://www.autohotkey.com/download/
Clemenza, i never got reply that my function does work fine so people can still use old version if they want, it's trusty.
Clemenza, i never got reply that my function does work fine so people can still use old version if they want, it's trusty.
Thanks a lot for this maximums, it really helps a lot of us out! I thought I was going to have to get TableNinja just to get the auto take seat function working again.
Hmm I can't get this to work...I originally downloaded the one from overcards, then I just took the scrip max1mus posted. Copy and pasted it over old script. Wont auto-buy in for me when I sit at a table. And won't auto sit either.
Any suggestions? Im on 7.
Any suggestions? Im on 7.
Feedback is used for internal purposes. LEARN MORE