Somewhat stripped down:
Code:
; by _dave_ - CTRL + RightClick on a player, or right click the tray icon to search
#NoEnv
#SingleInstance, Force
SendMode Input
GroupAdd, StarsTables, ahk_class #32770,,, PokerStars Lobby
Menu, menu1, Add, test
Menu, Tray, Add, Find Buddies, allbuddies
gosub allbuddies
~!^Esc::Suspend
return
F1::gosub allbuddies
return
searchplayer:
if (A_ThisMenuItemPos = 2)
{
FileAppend, %playername%`n, buddies.txt
}
else
{
WinGet, ps_id, id, PokerStars Lobby
Winget, ps_pid, pid, ahk_id%ps_id%
WinMenuSelectItem, ahk_id%ps_id%,, Requests,Find a Player...
WinWait,Find a Player ahk_pid%ps_pid%,,2
WinGet, playerwin, id,Find a Player ahk_class #32770 ahk_pid%ps_pid%
if (!playerwin)
{
return
}
ControlSetText,Edit1, %playername%, ahk_id%playerwin%
ControlSend, Find, {SPACE}, ahk_id%playerwin%
Sleep, 200
WinWait,Find a Player ahk_pid%ps_pid%,,2
WinGet, playerwin, id,Find a Player ahk_class #32770 ahk_pid%ps_pid%
if (playerwin)
{
WinGet, clist, ControlList, ahk_id%id%
if (InStr(clist, "Remove From List"))
{
ControlSend, Cancel, {SPACE}, ahk_id%playerwin%
}
else
{
sleep, 200
}
}
}
return
allbuddies:
WinGet, ps_id, id, PokerStars Lobby
Winget, ps_pid, pid, ahk_id%ps_id%
FileRead, buddies, buddies.txt
Loop, Parse, buddies, `n
{
playername := A_LoopField
gosub searchplayer
}
ifwinexist Find a Player
{
wingetpos ,x,y,w,h
if (h<200)
controlclick , button3
}
return