Hi dave,
getting the screenname is much more easy by using the Notes. No need to look into hand histories and therefore no need to be seated. Also, no need for the layouts.
Code:
mousegetpos , , , id
click 2
controlgettext , playername , Edit1, ahk_id%id%
You can shorten the script to under 100 lines. Like this:
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 PokerStarsTableFrameClass,,, PokerStars Lobby
Menu, menu1, Add, test
Menu, Tray, Add, Find Buddies, allbuddies
return
F1::gosub allbuddies
return
^RButton::
mousegetpos , , , id
IfWinExist, ahk_id%id% ahk_group StarsTables
{
click 2
controlgettext , playername , Edit1, ahk_id%id%
if (playername)
{
Menu, menu1, Delete
Menu, menu1, Add, Search for %playername%, searchplayer
Menu, menu1, Add, Buddylist %playername%, searchplayer
Menu, menu1, Show
}
}
return
searchplayer:
if (A_ThisMenuItemPos = 2)
{
FileAppend, %playername%`n, buddies.txt
}
else
{
;msgbox %playername%
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
}
Send , %playername% {Enter}
;msgbox %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
test:
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
}
return
Last edited by rubbishaka80; 12-05-2008 at 07:11 PM.