#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 /> |
|
|