This is what i get when i click the download link. Anyone know what im doing wrong?Thanks
;
; FullTiltBuddies.ahk version 1.4b1
; Language: English
; Platform: Win9x/NT
; Author: runstop@2p2 (john AT underthegun.ca)
;
; This script will maintain and find buddies for Full Tilt poker.
;
; It relies on %FullTilt_Path% to find the current players for open tables.
;
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
;Purge If Buddies should be removed if not seen for %Auto_Purge_If_Greater_Than_Days% days
Auto_Purge_If_Greater_Than_Days = 30
;our global vars
FullTilt_Path := "C:\Program Files\Full Tilt Poker"
TableArray_Length := 0
PlayerArray_Length := 0
BuddyArray_Length := 0
SelectedTable := ; the currently selected table
;our options
ShowOnlyOnline := False
PurgeOldBuddies := False
;
; Returns TRUE if fulltilt is running, false otherwise
;
FullTilt_IsRunning()
{
IfWinExist, Full Tilt Poker - Logged In As
{
return TRUE
}
else
{
return FALSE
}
}
;
;Searches for Buddies.
;Populates the global 'TableArray' array
;
FullTilt_FindPlayer(names)
{
global
if FullTilt_IsRunning()
{
Gui, ListView, MyBuddyList
LV_Delete()
;close 'find' if it's open and any OK dialogs
WinClose, Find Player ahk_class #32770
PostMessage, 0x112, 0xF060,,, Full Tilt Poker, OK ; 0x112 = WM_SYSCOMMAND, 0xF060 = SC_CLOSE
WinActivate ; use the window found above
Send ^f
WinWait, Find Player ahk_class #32770,,5
; minimize it
;WinMinimize, Find Player ahk_class #32770
;WinMinimize, Full Tilt Poker ahk_class FTCLobby
Loop, %BuddyArray_Length%
{
if BuddyArray%A_Index%=
continue
name := BuddyArray%A_Index%
encName := Hex(name)
WinRestore, Find Player ahk_class #32770
;input the name
ControlSetText, Edit1, , Find Player ahk_class #32770
ControlSend, Edit1, %name%{ENTER}, Find Player ahk_class #32770
BuddyCount += 1
WinWait,Full Tilt Poker, OK, 1
WinRestore, Full Tilt Poker ahk_class FTCLobby
ControlGet, Countit, List, Selected, ListBox1, Find Player ahk_class #32770
if Countit=
{
;not found
TableArray%encName% = Offline
TableArray%encName%_Length := 0
; close it
PostMessage, 0x112, 0xF060,,, Full Tilt Poker, OK ; 0x112 = WM_SYSCOMMAND, 0xF060 = SC_CLOSE
}
else
{
;found
indexA = %A_Index%
ControlGet, List, List, Selected, ListBox1, Find Player ahk_class #32770
Loop, Parse, List, `n
{
TableArray%encName% := "Online"
TableArray%encName%_Length := A_Index
TableArray%encName%_%A_Index% := A_LoopField
}
;set the last seen
BuddyArray%A_Index%_Last := A_Now
}
}
WinRestore, Full Tilt Poker ahk_class FTCLobby
WinClose, Find Player ahk_class #32770
}
}
;
; Returns the currently logged in username
;
FullTilt_LoggedInAs()
{
if FullTilt_IsRunning()
{
WinGetTitle, Name, Full Tilt Poker - Logged In As
Length := StrLen(Name)
StringRight, Name, Name, Length-31
return %Name%
} else {
return "N/A"
}
}
;
; Returns the HH Path of the currently logged in user
;
FullTilt_GetHHPath()
{
global
;user := FullTilt_LoggedInAs()
hhpath := FullTilt_Path . "\HandHistory\"
return % hhpath
}
;
; Gets all the players for a table
; sets the global 'PlayerArray' array
;
FullTilt_GetPlayersForTable(name)
{
global
if name=
return
;recurses through all files
files := FullTilt_GetHHPath() . "*"
PlayerArray_Length := 0
Found := false
Loop, %files%, 1 , 1
{
;open this and find the name of the players
FileRead, Contents, %A_LoopFileFullPath%
if not ErrorLevel ; Successfully loaded.
{
StringGetPos, pos, Contents, Table %name%, R
If ErrorLevel
continue
StringGetPos, posend, Contents, *** SUMMARY, L, %pos%
If ErrorLevel
len := StrLen(Contents)-pos
else
len := posend-pos
StringMid, Game, Contents, pos, len
if Game<>
{
PlayerArray_Length := 0
;find all the seats
Loop, 9
{
seat := "Seat " . A_Index . ":"
IfInString, Game, %seat%
{
Space := "("
StringGetPos, pos, Game, %seat%
pos := pos + StrLen(seat) + 2
StringGetPos, len, Game, %Space%, L, %pos%
len := len - pos
StringMid, Seat, Game, %pos%, %len%
PlayerArray_Length := PlayerArray_Length + 1
PlayerArray%PlayerArray_Length% := Seat
Found := true
}
}
if Found
{
break
}
}
}
}
}
;
; Finds open tables
; Populates the global 'OpenTableArray' array
;
FullTilt_FindOpenTables()
{
global
if FullTilt_IsRunning()
{
;find out what tables we're on
WinGet, id, list, ahk_class FTC_TableViewFull
OpenTableArray_Length := id
Loop, %id%
{
this_id := id%A_Index%
WinGetClass, this_class, ahk_id %this_id%
WinGetTitle, this_title, ahk_id %this_id%
OpenTableArray%A_Index% := this_title
}
}
}
;
; opens a table by name
;
FullTilt_OpenTableByName(Name)
{
if Name=
{
return
}
if FullTilt_IsRunning()
{
;Activate the main table
WinActivate, Full Tilt Poker - Logged In As
;make sure Real Money is checked
ControlClick, , Full Tilt Poker - Logged In As,,LEFT,1
;sort by name
Click 71, 281
;send a home
Send {HOME}
;ensure we're sorted
ControlGet, List, List,, SysListView323, Full Tilt Poker - Logged In As
Loop, Parse, List, `n
{
RowNumber := A_Index
StringSplit, Columns, A_LoopField, %A_Tab% ; split on A_Tab
StringLeft, ColFirstChar, Columns2, 1
; resort it by A on the first loop
if ColFirstChar = Z
{
if RowNumber = 1
{
;resort
Click 71, 281
Send {HOME}
}
}
}
ControlGet, List, List,, SysListView323, Full Tilt Poker - Logged In As
Loop, Parse, List, `n
{
RowNumber := A_Index
StringSplit, Columns, A_LoopField, %A_Tab% ; split on A_Tab
IfInString, Name, %Columns2%
{
Send {ENTER}
break
}
else
{
Send {Down}
}
}
}
}
;
; reads the FullTiltBuddies.ini file and populates the 'names'
;
ReadIni()
{
global
IniRead, names, FullTiltBuddies.ini, BuddyList, Buddies
;populate the list
Loop, parse, names, `,
{
if A_LoopField=
continue
encName := Hex(A_LoopField)
index := A_Index
BuddyArray_Length := A_Index
TableArray%encName% := "Unscanned"
IfInString, A_LoopField, |
{
StringSplit, FieldArray, A_LoopField, |
BuddyArray%index% := FieldArray1
BuddyArray%index%_Last := FieldArray2
}
else
{
BuddyArray%index% := A_LoopField
BuddyArray%index%_Last :=
}
}
; read any options
IniRead, ShowOnlyOnline, FullTiltBuddies.ini, Options, ShowOnlyOnline
IniRead, PurgeOldBuddies, FullTiltBuddies.ini, Options, PurgeOldBuddies
setSetting(ShowOnlyOnline, "OptionsMenu", "&Show Online Buddies Only")
Menu = &Purge Buddies After %Auto_Purge_If_Greater_Than_Days% Days
setSetting(PurgeOldBuddies, "OptionsMenu", Menu)
}
;
; rewrites the FullTiltBuddies.ini file
;
WriteIni()
{
global
names:=""
Loop, %BuddyArray_Length%
{
Gui, ListView, MyBuddyList
if BuddyArray%A_Index%_Last =
{
names := names . BuddyArray%A_Index% . "|" . A_Now . ","
}
else if !PurgeBuddy(BuddyArray%A_Index%_Last)
{
names := names . BuddyArray%A_Index% . "|" . BuddyArray%A_Index%_Last . ","
}
}
IniWrite, %names%, FullTiltBuddies.ini, BuddyList, Buddies
; write any options
IniWrite, %ShowOnlyOnline%, FullTiltBuddies.ini, Options, ShowOnlyOnline
IniWrite, %PurgeOldBuddies%, FullTiltBuddies.ini, Options, PurgeOldBuddies
}
;
; purges buddies if they are older than x days
;
PurgeBuddy(NumberOfDays)
{
global
if PurgeOldBuddies
{
Now := A_Now
EnvSub, NumberOfDays, Now, Days ; this does a date calc, in days
NumberOfDays := Abs(NumberOfDays)
If NumberOfDays > %Auto_Purge_If_Greater_Than_Days%
{
Return TRUE
}
}
Return FALSE
}
;
; populate the Buddy View List from the OpenTableArray
;
PopulateOpenTableList()
{
global
Gui, ListView, MyTablesList
LV_Delete()
Loop, % OpenTableArray_Length
{
name := OpenTableArray%A_Index%
LV_Add("",name)
; reselect the previously selected
IfInString, name, %SelectedTable%
{
LV_Modify(A_Index, "+Select")
FullTilt_GetPlayersForTable(SelectedTable)
}
}
PopulatePlayerList()
}
;
; populate the Player List with the PlayerArray
;
PopulatePlayerList()
{
global
Gui, ListView, MyPlayersList
LV_Delete()
Loop, % PlayerArray_Length
{
LV_Add("", PlayerArray%A_Index%)
}
}
;
; populate the Buddy View List by using the global BuddyArray
;
PopulateBuddyList()
{
global
Gui, ListView, MyBuddyList
;ImageListID := IL_Create(10) ; Create an ImageList to hold 10 small icons.
;LV_SetImageList(ImageListID) ; Assign the above ImageList to the current ListView.
LV_Delete()
;populate the list
Loop, %BuddyArray_Length%
{
;IL_Add(ImageListID, "C:\development\poker\Check.gif", 0xFFFFFF, 1)
Gui, ListView, MyBuddyList
Name := BuddyArray%A_Index%
LastSeen := BuddyArray%A_Index%_Last
if LastSeen =
{
LastSeen := "-"
}
else
{
FormatTime, TimeString, %LastSeen%, MM-dd-yyyy hh:mm:ss tt
LastSeen := TimeString
}
encName := Hex(Name)
if TableArray%encName% = Unscanned
{
LV_Add("", "-", Name, LastSeen)
}
else if TableArray%encName% = Offline
{
if NOT ShowOnlyOnline
LV_Add("", "No", Name, LastSeen)
}
else
{
LV_Add("", "Yes", Name, LastSeen)
}
}
LV_ModifyCol("Hdr") ; Auto-adjust the column widths.
return
}
;
; remove a buddy from the BuddyArray
;
RemoveBuddy(name)
{
global
;StringReplace, names, names, %Text%
newIndex := BuddyArray_Length
BuddyArray_Length := 0
Loop, %newIndex%
{
if BuddyArray%A_Index% = %name%
continue
BuddyArray_Length := BuddyArray_Length + 1
BuddyArray%BuddyArray_Length% := BuddyArray%A_Index%
}
PopulateBuddyList()
WriteIni()
}
;
; add a buddy to the BuddyArray
;
AddBuddy(name)
{
global
;make sure we don't have duplicates
Loop, %BuddyArray_Length%
{
if BuddyArray%A_Index% = %name%
{
MsgBox Buddy %name% already exists!
return
}
}
BuddyArray_Length := BuddyArray_Length + 1
BuddyArray%BuddyArray_Length% := name
encName := Hex(name)
TableArray%encName% = Unscanned
PopulateBuddyList()
WriteIni()
}
;
; a loop to wait for active windows
;
WaitForActiveFTWindows()
{
global
Loop
{
;wait 10 seconds
WinWait, ahk_group FT_OpenTables,, 10
FullTilt_FindOpenTables()
PopulateOpenTableList()
Sleep 5000
}
}
; toggle a setting by name and update the checkbox
toggleSetting(ByRef var, menuName, menuItem)
{
var := !var
If var = 0
prefix = Un
Menu, %menuName%, %prefix%Check, %menuItem%
}
; set a setting by name and update the checkbox
setSetting(ByRef var, menuName, menuItem)
{
If var = 0
prefix = Un
Menu, %menuName%, %prefix%Check, %menuItem%
}
; Converts full string from ASC to Hex
Hex(Inp,UC = 0)
{
OldFmt = %A_FormatInteger%
SetFormat, Integer, hex
Loop, Parse, Inp
{
TransForm, Asc, Asc, %A_LoopField%
Asc += 0
StringTrimLeft, Hex, Asc, 2
IfEqual, UC, 0
Result = %Result%%Hex%
Else
Result = %Result%%Hex%00
}
SetFormat, Integer, %OldFmt%
StringUpper, Result, Result
Return Result
}
;setup the gui shiet
;Gui, +Resize
;Gui, Add, StatusBar,,Hello
Gui, Add, GroupBox, w400 h230, Buddy List
Gui, Add, ListView, AltSubmit yp+20 xp+5 h180 w190 vMyBuddyList gMyBuddyList, Online|Buddy Name|Last Seen
Gui, Add, ListView, yp xp+200 h180 w190 vMyBuddiesTableList gMyBuddiesTableList, Tables
gui, add, text, section xm+5 y+8, Quick Add: ; Save this control's position and start a new section.
gui, add, edit, w100 ys-3 vQuickAdd ; Start a new column within this section.
Gui, Add, Button, ys-3 Default, OK
Gui, Add, GroupBox, xm w400 h210, My Current Tables
Gui, Add, ListView, AltSubmit yp+20 xp+5 h180 w190 vMyTablesList gMyTablesList, Table Name
Gui, Add, ListView, yp xp+200 h180 w190 vMyPlayersList gMyPlayersList, Players (Double Click to Add Buddy)
GuiControl, focus, Edit1
GroupAdd, FT_OpenTables, ahk_class FTC_TableViewFull
;menu
Menu, FileMenu, Add, &Find Buddies Ctrl+F, SearchForBuddies
Menu, FileMenu, Add, &Remove Selected Ctrl+R, RemoveSelected
Menu, MyMenuBar, Add, &Buddies, :FileMenu ; Attach the two sub-menus that were created above.
Menu, OptionsMenu, Add, &Show Online Buddies Only, ShowOnline
Menu, OptionsMenu, Add, &Purge Buddies After %Auto_Purge_If_Greater_Than_Days% Days, PurgeOld
Menu, MyMenuBar, Add, &Options, :OptionsMenu
Gui, Menu, MyMenuBar
Gui, Show, "", Full Tilt Buddy List
ReadIni()
PopulateBuddyList()
FullTilt_FindOpenTables()
PopulateOpenTableList()
;start our looping function
WaitForActiveFTWindows()
return
;exit on close
GuiClose:
WriteIni()
ExitApp
#IfWinActive Full Tilt Buddy List ahk_class AutoHotkeyGUI
^r:: ; The Ctrl+R hotkey.
RemoveSelected:
Gui, ListView, MyBuddyList
RowNumber := 0
RemovedLength := 0
Loop % LV_GetCount("Selected")
{
RowNumber := LV_GetNext(RowNumber)
if not RowNumber
break
RemovedLength := RemovedLength + 1
Removed%RemovedLength% := RowNumber
}
removedNumber := 0
Loop %RemovedLength%
{
RowNumber := Removed%A_Index% - removedNumber
LV_GetText(Text, RowNumber, 2)
RemoveBuddy(Text)
removedNumber += 1
}
return
; ok button
; TODO move this and the player list select into an addBuddy() call
ButtonOK:
ControlGetText, name, Edit1
AddBuddy(name)
ControlSetText, Edit1,
return
; a table was clicked
MyBuddiesTableList:
Gui, ListView, MyBuddiesTableList
if A_GuiEvent = DoubleClick
{
if A_EventInfo > 0
{
LV_GetText(Name, A_EventInfo, 1)
FullTilt_OpenTableByName(Name)
}
}
return
; buddy
MyBuddyList:
Gui, ListView, MyBuddyList
normal = Normal
IfInString, A_GuiEvent, normal
{
if A_EventInfo = 0
return
LV_GetText(Name, A_EventInfo, 2) ; Get the text of the first field.
encName := Hex(Name)
Gui, ListView, MyBuddiesTableList
LV_Delete()
if TableArray%encName% <> Offline
{
length := TableArray%encName%_Length
Loop, %length% {
LV_Add("", TableArray%encName%_%A_Index%)
}
}
}
return
; Add a player by double clicking
MyPlayersList:
Gui, ListView, MyPlayersList
if A_GuiEvent = DoubleClick
{
LV_GetText(Name, A_EventInfo, 1)
AddBuddy(PlayerArray%A_EventInfo%)
}
return
;an item in mytables was selected
MyTablesList:
Gui, ListView, MyTablesList
normal = Normal
IfInString, A_GuiEvent, normal
{
LV_GetText(TableName, A_EventInfo, 1)
FirstDashPos := InStr(TableName, "-")
StringLeft TableName, TableName, FirstDashPos-2
FullTilt_GetPlayersForTable(TableName)
SelectedTable := TableName
PopulatePlayerList()
}
return
ShowOnline:
toggleSetting(ShowOnlyOnline, "OptionsMenu", "&Show Online Buddies Only")
PopulateBuddyList()
return
PurgeOld:
Menu = &Purge Buddies After %Auto_Purge_If_Greater_Than_Days% Days
toggleSetting(PurgeOldBuddies, "OptionsMenu", Menu)
return
#IfWinActive Full Tilt Buddy List ahk_class AutoHotkeyGUI
^f:: ; The Ctrl+S hotkey.
SearchForBuddies:
FullTilt_FindPlayer(names)
PopulateBuddyList()
return