#1
|
|||
|
|||
Stars Buddy Search (new AHK script)
Hi all,
I wrote a AHK script that searches for buddies on Pokerstars tells you how many tables they play and lets you open these tables. You have to have a file with the buddies, one on each line: <font class="small">Code:</font><hr /><pre> Player1 Player2 Player3 </pre><hr /> The location and name of this file can be customized, the default is "buddies.txt" in the same directory as the script. After pressing the hotkey "F9" (can be changed, also) the script performs the search and shows the results: You can then decide how many of the found tables you want to open. I took ideas from wildzer0, handsome and Adde to create this. Comments are welcome. This script has ScriptPad support. ScriptPad is a tool where you can connect any number of scripts to a toolpad, a small pop-up window with buttons for all available commands in these scripts. You access the toolpad by a hotkey, for instance the middle mouse button. (see scriptpad ) <font class="small">Code:</font><hr /><pre> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Code begins here ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;------------------------------------------------------------------------------------------------ ; Stars Buddy Search v0.1 ;------------------------------------------------------------------------------------------------ ; Date: 2006-12-19 ; AHK version: 1.0.44.14 ;------------------------------------------------------------------------------------------------ ; Author(s): rubbishaka @ 2+2 forums ; Contact: poker at postsack dot cjb dot net ;------------------------------------------------------------------------------------------------ ; ; ; ; ; credits: wildzer0, handsome, Adde ;------------------------------------------------------------------------------------------------ ; Set what hotkeys should start buddy search. ; Leave empty (=) if you don't want to use a hotkey. ; List of available hotkeys: http://www.autohotkey.com/docs/KeyList.htm sb_hotkey = F9 sb_buddyFile = buddies.txt ;clear search list in pokerstars prior to searching (1) or not (0) sb_clearSearchList = 0 ;_________________________________________________ _______________________________________________ ; ; DO NOT EDIT BELOW HERE ;_________________________________________________ _______________________________________________ ;;;;;;;;;;;;;;;;;;;;auto-execute;;;;;;;;;;;;;;;;; #NoEnv #SingleInstance Ignore #Persistent names= sb_scriptpad_command_header = Buddies sb_scriptpad_command_name = Find Online Buddies sb_scriptpad_command_label = sb_OnlineBuddy_Label sb_scriptpad_command_enabled = 1 ahk_version = 1.0.44.14 if A_AhkVersion < %ahk_version% { msgbox, 4, , This script needs AutoHotkey version %ahk_version% or newer (you are using version %A_AhkVersion%) . Script will exit`n`nGo to web page and download new version now? IfMsgBox, Yes Run, http://www.autohotkey.com ExitApp } Hotkey, %sb_hotkey%, sb_OnlineBuddy_Label, UseErrorLevel goto sb_Scriptpad_End ;;;;;;;;;;;;;;;labels;;;;;;;;;;;;;; sb_FindBuddy_Label: sb_FindBuddy() return sb_Delete_Label: sb_ClearSearchList() return sb_OnlineBuddy_Label: if (sb_clearSearchList=1) sb_ClearSearchList() sb_OnlineBuddy() return Open: ControlGet, tableNumber, choice,,combobox%A_GuiControl% sb_openTablesForBuddy(names%A_GuiControl%,tableNum ber) return CloseGui: gui, destroy return ;;;;;;;;;;;;;;;functions;;;;;;;;;;;;; sb_ClearSearchList() { SetTitleMatchMode 1 WinActivate, PokerStars Lobby Send !r Send f {Enter} WinWait, %A_SPACE%Find Player, , 3 WinActivate, %A_SPACE%Find Player ControlGet, List, List,, ComboBox1 Loop, Parse, List, `n { Control, choose, 1, Combobox1 ControlClick, Button3 } Send, {Esc} } sb_FindBuddy() { SetTitleMatchMode 1 IfWinNotExist PokerStars Lobby - Logged in return InputBox, UserInput, Stars Buddy Search, Enter username to search for. if ErrorLevel return else InputBox, Index, Stars Buddy Search, How many tables do you want to open? if ErrorLevel return else sb_openTablesForBuddy(UserInput, Index) } sb_openTablesForBuddy(UserInput, Index) { Tables := 0 sleep, 100 Loop %Index% { SetTitleMatchMode 1 WinActivate, PokerStars Lobby WinwaitActive, PokerStars Lobby Send !r Send f {Enter} Send, %UserInput% {Enter} WinWait, %A_SPACE%Find Player, , 3 WinActivate, %A_SPACE%Find Player Send {Tab}{Tab} Loop %Tables% { Send {Down} Sleep 100 } Tables++ Send {Enter} Sleep 500 } } sb_onlineBuddy() { global sb_buddyFile global tablelist global namelist ifnotexist, %sb_buddyFile% { msgBox, Buddy File "%sb_buddyFile%" not found return } Loop, Read, %sb_buddyFile% { SetTitleMatchMode, 2 IfWinExist PokerStars Lobby { WinActivate winwaitactive, PokerStars Lobby } else return Send, !r Sleep, 10 Send, f {Enter} Send, %A_LoopReadLine% {Enter} Loop { Sleep, 100 IfWinExist, PokerStars, Not Found { Send, {Enter} break } ifWinExist, Find Player { namelist=%namelist%%A_LoopReadLine%| number:=countTables() tableList=%tablelist%%number%| Send, {Esc} break } } } sb_buildGui() } countTables() { WinActivate, Find Player send {down} send {down} number:=1 loop { send {down} y:=(number*13)+44 PixelGetColor, color, 200, %y% if color=0xffffff { number++ } else { break } } return number } sb_buildGUI() { global StringSplit, names, namelist, | StringSplit, tables, tablelist, | arraycount=% names0-1 if (arraycount <1) { msgbox, No one online :-( return } loop,%ArrayCount% Gui, Add, Text,, % names%A_Index% gui, add, button,gCloseGui,close loop,%ArrayCount% { strNumber:="" loop, % tables%A_Index% strNumber=%strNumber%%A_Index%| strNumber=%strNumber%| if (A_Index=1) Gui, Add, DropDownList, ym w40, %strNumber% else Gui, Add, DropDownList,w40, %strNumber% } loop,%ArrayCount% { if (A_Index=1) Gui, Add, Button,v%A_Index% ym gOpen, Open Tables else Gui, Add, Button,v%A_Index% gOpen, Open Tables } Gui, Show,,Buddy Search return } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; scriptpad ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; sb_Scriptpad_End: ; Do nothing. This is needed to work with Scriptpad. </pre><hr /> |
#2
|
|||
|
|||
Re: Stars Buddy Search (new AHK script)
Very nice.
Is there a way to make your script automatically open the tables your buddies are at? |
#3
|
|||
|
|||
Re: Stars Buddy Search (new AHK script)
hey this looks really great. I'm totally new to AHK just downloaded it now because I really want to try your script out. Cant get it to open though. I copy and pasted the script into notepad and saved it as starsbuddy.ahk
It saved to my desktop with an ahk file icon. When i double click it however, I get the hourglass thing for a second then nothing. FYI, I copied the entire part of the script including the ;;;;;;;;;;;;;;;;;;code starts here;;;;;;;;;;;; part. Maybe I'm supposed to exclude this? |
#4
|
|||
|
|||
Re: Stars Buddy Search (new AHK script)
[ QUOTE ]
Is there a way to make your script automatically open the tables your buddies are at? [/ QUOTE ] Could be done. I will post something later. |
#5
|
|||
|
|||
Re: Stars Buddy Search (new AHK script)
[ QUOTE ]
Is there a way to make your script automatically open the tables your buddies are at? [/ QUOTE ] Yeah.. this would make this even more awesome. |
#6
|
|||
|
|||
Re: Stars Buddy Search (new AHK script)
[ QUOTE ]
hey this looks really great. I'm totally new to AHK just downloaded it now because I really want to try your script out. Cant get it to open though. I copy and pasted the script into notepad and saved it as starsbuddy.ahk It saved to my desktop with an ahk file icon. When i double click it however, I get the hourglass thing for a second then nothing. FYI, I copied the entire part of the script including the ;;;;;;;;;;;;;;;;;;code starts here;;;;;;;;;;;; part. Maybe I'm supposed to exclude this? [/ QUOTE ] You did everything right (I suppose PokerStars is running and you're logged in). Now press F9. |
#7
|
|||
|
|||
Re: Stars Buddy Search (new AHK script)
I am logged in to pokerstars. Shouldnt the graphical interface of the script come up? I pressed F9 and nothing happened. Nothing indicates that the script is actually running. I think it's something to do with when I am copying it and pasting into notepad. It's not retaining the same format though I dont know how to stop it from doing this. The line breaks arent where they should be. Sorry i'm dumb but how do I prevent the format of the text from changing when i paste into notepad?
|
#8
|
|||
|
|||
Re: Stars Buddy Search (new AHK script)
Ooh.. one other thing that would be really awesome is if you said what stakes the tables are.
|
#9
|
|||
|
|||
Re: Stars Buddy Search (new AHK script)
[ QUOTE ]
Nothing indicates that the script is actually running. [/ QUOTE ] You should at least see the AHK symbol in the tray bar? Also, there should be error messages, when the line breaks are wrong, so I suppose that part went well. |
#10
|
|||
|
|||
Re: Stars Buddy Search (new AHK script)
[ QUOTE ]
Is there a way to make your script automatically open the tables your buddies are at? [/ QUOTE ] Ok, I added a option to do that. <font class="small">Code:</font><hr /><pre> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Code begins here ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;------------------------------------------------------------------------------------------------ ; Stars Buddy Search v0.2 ;------------------------------------------------------------------------------------------------ ; Date: 2006-12-19 ; AHK version: 1.0.44.14 ;------------------------------------------------------------------------------------------------ ; Author(s): rubbishaka @ 2+2 forums ; Contact: poker at postsack dot cjb dot net ;------------------------------------------------------------------------------------------------ ; changes: add option to open all buddies tables immediately ; ; ; ; credits: wildzer0, handsome, Adde ;------------------------------------------------------------------------------------------------ ; Set what hotkeys should start buddy search. ; Leave empty (=) if you don't want to use a hotkey. ; List of available hotkeys: http://www.autohotkey.com/docs/KeyList.htm sb_hotkey = F9 ; Set location of your buddy file here. Relative to the path of the script. sb_buddyFile = buddies.txt ; opens all tables your buddies are playing on immediately(1) or not (0) sb_openAllTables=0 ;clear search list in pokerstars prior to searching (1) or not (0) sb_clearSearchList = 0 ;_________________________________________________ _______________________________________________ ; ; DO NOT EDIT BELOW HERE ;_________________________________________________ _______________________________________________ ;;;;;;;;;;;;;;;;;;;;auto-execute;;;;;;;;;;;;;;;;; #NoEnv #SingleInstance Ignore #Persistent sb_scriptpad_command_header = Buddies sb_scriptpad_command_name = Find Online Buddies sb_scriptpad_command_label = sb_OnlineBuddy_Label sb_scriptpad_command_enabled = 1 ahk_version = 1.0.44.14 if A_AhkVersion < %ahk_version% { msgbox, 4, , This script needs AutoHotkey version %ahk_version% or newer (you are using version %A_AhkVersion%) . Script will exit`n`nGo to web page and download new version now? IfMsgBox, Yes Run, http://www.autohotkey.com ExitApp } Hotkey, %sb_hotkey%, sb_OnlineBuddy_Label, UseErrorLevel goto sb_Scriptpad_End ;;;;;;;;;;;;;;;labels;;;;;;;;;;;;;; sb_FindBuddy_Label: sb_FindBuddy() return sb_Delete_Label: sb_ClearSearchList() return sb_OnlineBuddy_Label: if (sb_clearSearchList=1) sb_ClearSearchList() sb_OnlineBuddy() return Open: ControlGet, tableNumber, choice,,combobox%A_GuiControl% sb_openTablesForBuddy(names%A_GuiControl%,tableNum ber) return CloseGui: gui, destroy return ;;;;;;;;;;;;;;;functions;;;;;;;;;;;;; sb_checkPokerstarsIsRunning() { Process, Exist, Pokerstars.exe if (ErrorLevel <> 0) return (true) return (false) } sb_ClearSearchList() { if (not sb_checkPokerstarsIsRunning()) { msgBox, Pokerstars is not running return } SetTitleMatchMode 1 WinActivate, PokerStars Lobby Send !r Send f {Enter} WinWait, %A_SPACE%Find Player, , 3 WinActivate, %A_SPACE%Find Player ControlGet, List, List,, ComboBox1 Loop, Parse, List, `n { Control, choose, 1, Combobox1 ControlClick, Button3 } Send, {Esc} } sb_FindBuddy() { SetTitleMatchMode 1 IfWinNotExist PokerStars Lobby - Logged in return InputBox, UserInput, Stars Buddy Search, Enter username to search for. if ErrorLevel return else InputBox, Index, Stars Buddy Search, How many tables do you want to open? if ErrorLevel return else sb_openTablesForBuddy(UserInput, Index) } sb_openTablesForBuddy(UserInput, Index) { Tables := 0 sleep, 100 Loop %Index% { SetTitleMatchMode 1 WinActivate, PokerStars Lobby WinwaitActive, PokerStars Lobby Send !r Send f {Enter} Send, %UserInput% {Enter} WinWait, %A_SPACE%Find Player, , 3 WinActivate, %A_SPACE%Find Player Send {Tab}{Tab} Loop %Tables% { Send {Down} Sleep 100 } Tables++ Send {Enter} Sleep 500 } } sb_onlineBuddy() { global sb_buddyFile global tablelist global namelist global sb_openalltables if (not sb_checkPokerstarsIsRunning()) { msgBox, Pokerstars is not running return } ifnotexist, %sb_buddyFile% { msgBox, Buddy File "%sb_buddyFile%" not found return } Loop, Read, %sb_buddyFile% { SetTitleMatchMode, 2 IfWinExist PokerStars Lobby { WinActivate winwaitactive, PokerStars Lobby } else return Send, !r Sleep, 10 Send, f {Enter} Send, %A_LoopReadLine% {Enter} Loop { Sleep, 100 IfWinExist, PokerStars, Not Found { Send, {Enter} break } ifWinExist, Find Player { number:=countTables() Send, {Esc} if (sb_openAllTables=1) { sb_openTablesForBuddy(A_LoopReadLine,number) } else { namelist=%namelist%%A_LoopReadLine%| tableList=%tablelist%%number%| } break } } } if (sb_openAllTables=0) { sb_buildGui() } } countTables() { WinActivate, Find Player send {down} send {down} number:=1 loop { send {down} y:=(number*13)+44 PixelGetColor, color, 200, %y% if color=0xffffff { number++ } else { break } } return number } sb_buildGUI() { global StringSplit, names, namelist, | StringSplit, tables, tablelist, | arraycount=% names0-1 if (arraycount <1) { msgbox, No one online :-( return } loop,%ArrayCount% Gui, Add, Text,, % names%A_Index% gui, add, button,gCloseGui,close loop,%ArrayCount% { strNumber:="" loop, % tables%A_Index% strNumber=%strNumber%%A_Index%| strNumber=%strNumber%| if (A_Index=1) Gui, Add, DropDownList, ym w40, %strNumber% else Gui, Add, DropDownList,w40, %strNumber% } loop,%ArrayCount% { if (A_Index=1) Gui, Add, Button,v%A_Index% ym gOpen, Open Tables else Gui, Add, Button,v%A_Index% gOpen, Open Tables } Gui, Show,,Stars Buddy Search v0.2 return } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; scriptpad ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; sb_Scriptpad_End: ; Do nothing. This is needed to work with Scriptpad. </pre><hr /> |
|
|