View Single Post
  #28  
Old 12-23-2006, 11:47 PM
rubbishaka80 rubbishaka80 is offline
Member
 
Join Date: Jul 2005
Posts: 84
Default Re: Stars Buddy Search (new AHK script)

[ QUOTE ]
Oh.. why don't you make the script turn of auto popup at first and then turn it back on when it's finished?

[/ QUOTE ]
I added an option to do exactly this plus some bug fixes.

<font class="small">Code:</font><hr /><pre> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Code begins here ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;------------------------------------------------------------------------------------------------
; Stars Buddy Search v0.3
;------------------------------------------------------------------------------------------------
; Date: 2006-12-19
; AHK version: 1.0.44.14
;------------------------------------------------------------------------------------------------
; Author(s): rubbishaka80 @ 2+2 forums
; Contact: poker at postsack dot cjb dot net
;------------------------------------------------------------------------------------------------
; changes: add option to open all buddies tables immediately
; add temporarily turn-off of auto popup
;
;
; 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

; If you use the auto popup tables option in the PokerStars software, it greatly interferes
; with this script. Therefore this script deactivates the option. If you want to re-activate
; it afterwards, set this value to 1. If you don't use the option at all, set this value to 0.
sb_useAutoPopup = 1

; 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 &lt; %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

sb_Open:
ControlGet, tableNumber, choice,,combobox%A_GuiControl%

sb_openTablesForBuddy(names%A_GuiControl%,tableNum ber)
return

sb_CloseGui:
sb_CloseGui()
return
;;;;;;;;;;;;;;;functions;;;;;;;;;;;;;
sb_EnablePopups(enable)
{
if (not sb_checkPokerstarsIsRunning())
{
msgBox, Pokerstars is not running
return
}
SetTitleMatchMode 1
WinActivate, PokerStars Lobby
WinwaitActive, PokerStars Lobby

WinMenuSelectItem, PokerStars Lobby ,, Options, Advanced Multi

WinActivate, Advanced
WinwaitActive, Advanced

ControlGet, vH, checked, , Button3
if (vH=1)
{
if (enable=false)
{
ControlClick, Button3
}

}
else
{
if (enable=true)
{
ControlClick, Button3
}
}
ControlClick, Button1

}
sb_CloseGui()
{
gui, destroy

return
}
sb_checkPokerstarsIsRunning()
{
Process, Exist, Pokerstars.exe
if (ErrorLevel &lt;&gt; 0)
return (true)

return (false)
}
sb_ClearSearchList()
{
if (not sb_checkPokerstarsIsRunning())
{
msgBox, Pokerstars is not running
return
}
SetTitleMatchMode 1
WinActivate, PokerStars Lobby
WinwaitActive, PokerStars Lobby

WinMenuSelectItem, PokerStars Lobby ,, Requests, Find a Player


WinWait, %A_SPACE%Find Player, , 3
WinActivate, %A_SPACE%Find Player
WinWaitActive, %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

WinMenuSelectItem, PokerStars Lobby ,, Requests, Find a Player
Send, %UserInput% {Enter}

WinWait, %A_SPACE%Find Player, , 3
WinActivate, %A_SPACE%Find Player
WinWaitActive,%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
global sb_useAutoPopup
tablelist=
namelist=

sb_CloseGui()
sb_enablePopups(false)

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 1
WinActivate, PokerStars Lobby
WinwaitActive, PokerStars Lobby

WinMenuSelectItem, PokerStars Lobby ,, Requests, Find a Player
WinWait, %A_SPACE%Find Player, , 3
WinActivate, %A_SPACE%Find Player
Send, %A_LoopReadLine% {Enter}

Loop
{
Sleep, 100
IfWinExist, PokerStars, Not Found
{
Send, {Enter}
break
}

ifWinExist, %A_SPACE%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_useAutoPopup=1)
{
sb_enablePopups(true)
}

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 &lt;1)
{
msgbox, No one online :-(
return
}



loop,%ArrayCount%
Gui, Add, Text,, % names%A_Index%

gui, add, button,gsb_CloseGui,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 gsb_Open, Open Tables
else
Gui, Add, Button,v%A_Index% gsb_Open, Open Tables
}
Gui, Show,,Stars Buddy Search v0.3
return
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; scriptpad ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sb_Scriptpad_End:
; Do nothing. This is needed to work with Scriptpad.

</pre><hr />
Reply With Quote