By PietM at 2+2 Forums.

Full Tilt Planner

This is a reworked copy of Dave's StarsPlanner. I took out all the unnecessary functions. Also, there is no auto-closing of any popup-windows, so please test this very carefully. I use it on NL Cashgames tables without problems, but haven't played a tournament with it yet.

Screenshot

http://img80.imageshack.us/img80/3526/fulltiltplanner02ce0.png

Instructions

If you check the "Enable Automatic Max Buy" option, you automatically rebuy-in for the max when you press the Get Chips button. If you use the FullTiltAutoReloader script, you don't need the first script anymore (FullTiltReloader.ahk). You'll need to edit the second script (FullTiltAutoReloader.ahk) too, so it doesn't run the first script anymore.

If you hit the Minimze Windows button, all Full Tilt tables will be minimized to the taskbar. If after that, you press the Restore Windows button, all tables will return to their original position. If you checked the Enable Arrange Tables box, it will be turned off when you minimize the tables, and turned on again if you press the Restore Windows button.

LIMIT AND CAPPED BUYIN PLAYERS - do not use the "Automatic Buy-In" option - unless you want to bring your whole roll to the table.

Enjoy!

Revision History

v0.4

Remember table sizes as well.

v0.2a

When the GUI opens, it checks first if it's visible on screen. If not, it gets centered.

v0.2

Added Minimze / Restore Windows button

v0.01

Initial release.

Code

/*
FullTilt Planner, by PietM at 2+2 forums
Version 0.4 30-March-2007

Derivation of:
Stars Planner, by _dave_ at 2+2 forums
Contributions by Roland, Jukofyork.


Mimics some of the layout behaviour of the fantastic PartyPlanner,
but for PokerStars table windows. Enjoy!

Version 0.03a 08-Nov-2006

*/



#NoEnv 
#SingleInstance, Force
SendMode Input

SysGet, border, 32
SysGet, caption, 4

PixTol := 10
PAdj := 0
ColTol := 4                           ; color tolerance in image searches     

slotcount := 0
w := 5
h := 6
x := 3
y := 345
Loop, 24
{
  Loop, 2
  {
    slotcount += 1
    slot%slotcount%w := w
    slot%slotcount%h := h
    slot%slotcount%x := x
    slot%slotcount%y := y
    slot%slotcount%id := ""
  }
}
slotcount := 0

customfillorder = 1,2,3,4

SetTimer, DoPlanning, 250
SetTimer, DoPlanning, Off

SetTimer, DoPlanningConfig, 250
SetTimer, DoPlanningConfig, Off


SetTimer, KillPopUps, 500
SetTimer, KillPopUps, Off

inifile := "FullTiltPlanner-v0.2.ini"
ChosenLayout := 0
AutoBuyInOn := 0
KillDialogsOn := 0
MinMaxWindows := 0
dummyPlanTables := 0
FileGetSize, inipresent, %inifile%
if (ErrorLevel)
{
  str := "[Layouts]`nnumlayouts=0`n`n[Defaults]`nPlanTablesOn=0`nAutoBuyInOn=0`nKillDialogsOn=0`nChosenLayout=0`ngx=0`ngy=0"
  FileAppend, %str%, %inifile%
}

Gui, Add, Checkbox, vPlanTables gPlanTables x10 y10, Enable Arrange Tables
Gui, Add, Checkbox, vSitInOut gSitInOut x10 y30, Sit Out on all tables (untick to return)
Gui, Add, Checkbox, vAutoBuyIn gAutoBuyIn x10 y50, Enable Automatic Max Buy
Gui, Add, Checkbox, vKillDialogs gKillDialogs x240 y10, Kill Dialogs
Gui, Add, ComboBox, vLayoutChoice gLayoutChoice w190 x240 y30 Limit AltSubmit
Gui, Add, Button, vCaptureLayout gCaptureLayout x240 y60 w60 h30 , Capture
Gui, Add, Button, vConfigureLayout gConfigureLayout x305 y60 w60 h30 , Configure
Gui, Add, Button, vDeleteLayout gDeleteLayout x370 y60 w60 h30 , Delete
Gui, Add, Button, Hidden vConfigSave gConfigSave x240 y60 w90 h30 , Save Layout
Gui, Add, Button, Hidden vConfigCancel gConfigCancel x340 y60 w90 h30 , Cancel
Gui, Add, Button, vMinMaxBtn gMinMaxBtn x10 y70 w110 h30, Minimize Windows

IniRead, gx, %inifile%, Defaults, gx
IniRead, gy, %inifile%, Defaults, gy

If (gx <= 0) Or (gx >= A_ScreenWidth )
  gx = Center
If (gy <= 0) Or (gy >= A_ScreenHeight )
  gy = Center

Gui, Show, x%gx% y%gy% h110 w440, Full Tilt Planner v0.4
IniRead, ChosenLayout, %inifile%, Defaults, ChosenLayout
refresh_layout()

IniRead, PlanTablesOn, %inifile%, Defaults, PlanTablesOn
if (PlanTablesOn)
{
  GuiControl, , PlanTables, %PlanTablesOn%
  GoSub PlanTables
}

IniRead, AutoBuyInOn, %inifile%, Defaults, AutoBuyInOn
if (AutoBuyInOn)
{
  GuiControl, , AutoBuyIn, %AutoBuyInOn%
  GoSub AutoBuyIn
}

IniRead, KillDialogsOn, %inifile%, Defaults, KillDialogsOn
if (KillDialogsOn)
{
  GuiControl, , KillDialogs, %KillDialogsOn%
  GoSub KillDialogs
}

SetTimer, KillPopUps, On
return

MinMaxBtn:
  if (MinMaxWindows)
  {
    GuiControl, , MinMaxBtn, Minimize Windows
    MinMaxWindows := 0
    tables := TableIDListFullTilt()
    Loop, Parse, tables, `,
    {
      WinRestore, ahk_id%A_LoopField%
    }
    if (dummyPlanTables) {
      GuiControl, , PlanTables, 1
      SetTimer, DoPlanning, On
    }
  } else 
  {
    GuiControl, , MinMaxBtn, Restore Windows
    MinMaxWindows := 1
    dummyPlanTables := PlanTables
    if (PlanTables)
    {
      GuiControl, , PlanTables, 0
      SetTimer, DoPlanning, Off
    }
    tables := TableIDListFullTilt()
    Loop, Parse, tables, `,
    {
      WinMinimize, ahk_id%A_LoopField%
    }
  }
  
return

GUIClose:
  Gui, Submit, NoHide
  IniDelete, %inifile%, Defaults
  IniWrite, %PlanTables%, %inifile%, Defaults, PlanTablesOn
  IniWrite, %AutoBuyIn%, %inifile%, Defaults, AutoBuyInOn
  IniWrite, %KillDialogs%, %inifile%, Defaults, KillDialogsOn
  IniWrite, %ChosenLayout%, %inifile%, Defaults, ChosenLayout
  WinGetPos, gx, gy, , , Full Tilt Planner v0.4
  IniWrite, %gx%, %inifile%, Defaults, gx
  IniWrite, %gy%, %inifile%, Defaults, gy
  ExitApp
return

PlanTables:
Gui, Submit, NoHide
if (PlanTables)
{
  GuiControl, Disable, CaptureLayout 
  GuiControl, Disable, ConfigureLayout
  GuiControl, Disable, DeleteLayout
  SetTimer, DoPlanning, On
}
else
{
  SetTimer, DoPlanning, Off
  GuiControl, Enable, CaptureLayout 
  GuiControl, Enable, DeleteLayout
  GuiControl, Enable, ConfigureLayout
}
return

KillDialogs:
Gui, Submit, NoHide
if (KillDialogs)
{
  KillDialogsOn := 1
} else {
  KillDialogsOn := 0
}
return

AutoBuyIn:
Gui, Submit, NoHide
if (AutoBuyIn)
{
  AutoBuyInOn := 1
}
else
{
  AutoBuyInOn := 0
}
return

SitInOut:
Gui, Submit, NoHide

tables := TableIDListFullTilt()
Loop, Parse, tables, `,
{
  ControlClick, FTCButton32, ahk_id%A_LoopField%
}  

return

LayoutChoice:
Gui, Submit, NoHide
ChosenLayout := LayoutChoice
refresh_layout()
return

DeleteLayout:
Gui, Submit, NoHide
Gui +OwnDialogs
IniRead, layoutname, %inifile%, Layouts, %LayoutChoice%

Msgbox, 4 , , You are about to delete the saved layout:`n`n%layoutname%`n`nAre You Sure?
IfMsgBox, Yes
{
  Critical
  IniRead, numlayouts, %inifile%, Layouts, numlayouts
  FileRead, file, %inifile%
  
  if not ErrorLevel
  {
    IniDelete, %inifile%, Layouts, %LayoutChoice%
    IniDelete, %inifile%, Layout%LayoutChoice%
    newnumlayouts := numlayouts - 1
    IniWrite, %newnumlayouts%, %inifile%, Layouts, numlayouts
    FileRead, file, %inifile%
    
    c := numlayouts - LayoutChoice
    needchanged := ""
    Loop, %c%
    {
      n := (numlayouts - A_Index) + 1
      needchanged := n . "," . needchanged
    }
    StringTrimRight, needchanged, needchanged, 1
    Loop, Parse, needchanged, `,
    {
      oldnum := "`n" . A_LoopField . "="""
      newnum := "`n" . (A_LoopField - 1) . "="""
      StringReplace, file, file, %oldnum%, %newnum%, A
      
      oldstr := "[Layout" . A_LoopField . "]"
      newstr := "[Layout" . (A_LoopField - 1) . "]"
      StringReplace, file, file, %oldstr%, %newstr%, A
      
    }
    FileDelete, %inifile%
    FileAppend, %file%, %inifile%
  }
  Critical, Off
  IniRead, numlayouts, %inifile%, Layouts, numlayouts
  if (ChosenLayout > numlayouts)
  {
    ChosenLayout -= 1
    ChosenLayout := IIf(ChosenLayout, ChosenLayout, 0)
    IniWrite, %ChosenLayout%, %inifile%, Defaults, %ChosenLayout%
  }
  refresh_layout()
}
return


CaptureLayout:
Gui +OwnDialogs
InputBox, newlayout, Layout Name, Please enter a name for this captured layout., , , , gx+10, gy+30, , ,
if (!ErrorLevel)
{
  tl := ""
  tl2 := ""
  if (newlayout = "")
  {
    Msgbox, Please enter a name for the new layout
    return
  }
  tables := TableIDListFullTilt()
  numtables := 0
  Loop, Parse, tables, `,
  {
    numtables += 1
  }
  t := 0
  tl := ""
  if (numtables > 0)
  {
    Loop, Parse, tables, `,
    {
      t += 1
      WinGetPos, l%t%x, l%t%y, l%t%w, l%t%h, ahk_id%A_LoopField%
      tl := tl . "," . t
    }
    StringTrimLeft, tl, tl, 1
    
    Msgbox, Found %t% Full Tilt tables
    order := ""
    if (t > 0)
    {
      Loop, %t%
      {
        order := order . "," . l%A_Index%x . "." . l%A_Index%y
      }
      StringTrimLeft, order, order, 1
      Sort, order, N D,
      
      Loop
      {
        Loop, Parse, order, `,
        {
          
          StringTrimRight, x, A_LoopField, (StrLen(A_LoopField) - InStr(A_LoopField, "."))+1
          StringTrimLeft, y, A_LoopField, InStr(A_LoopField, ".")
          Loop, Parse, tl, `,
          {
            if (l%A_LoopField%x = x && l%A_LoopField%y = y)
            {
              tmp := A_LoopField
              tl := RemoveFromList(tl,tmp)
              tl2 := tl2 . "," . tmp
              break
            }
          }
        }
        if (tl = "")
        {
          break
        }
      }
      StringTrimLeft, tl2, tl2, 1
      sect := numlayouts + 1
      cl := ""
      Loop, Parse, tl2, `,
      {
        x := l%a_loopfield%x
        y := l%a_loopfield%y
        w := l%a_loopfield%w
        h := l%a_loopfield%h
        IniWrite, %x%, %inifile%, Layout%sect%, %A_Index%x
        IniWrite, %y%, %inifile%, Layout%sect%, %A_Index%y
        IniWrite, %w%, %inifile%, Layout%sect%, %A_Index%w
        IniWrite, %h%, %inifile%, Layout%sect%, %A_Index%h
        cl := cl . "," . A_Index
      }
      StringTrimLeft, cl, cl, 1
      
      IniDelete, %inifile%, Layouts, numlayouts
      IniWrite, %sect%, %inifile%, Layouts, numlayouts
      IniWrite, "%newlayout%", %inifile%, Layouts, %sect%
      IniWrite, %t%, %inifile%, Layout%sect%, slotcount
      IniWrite, %cl%, %inifile%, Layout%sect%, customfillorder
      ChosenLayout := sect
      refresh_layout()
    }
  }
}
return

ConfigureLayout:
Gui, Submit, NoHide
ChosenLayout := LayoutChoice
GuiControl, Disable, PlanTables
GuiControl, Disable, LayoutChoice
GuiControl, Hide, CaptureLayout
GuiControl, Hide, ConfigureLayout
GuiControl, Hide, DeleteLayout

filename := "FullTiltPlannerConfigureLayoutGUI.ahk"
FileDelete, %filename%

guinum := 10
Loop, %slotcount%
{
  x := slot%A_Index%x
  y := slot%A_Index%y
  w := slot%A_Index%w
  h := slot%A_Index%h
  w := w - (2*border)
  h := h - (2*border) - caption
  guinum += 1
  str := "Gui " . guinum . ": -Resize -SysMenu`n"
  FileAppend, %str%, %filename%
  str := "Gui " . guinum . ": Font, c0000ff s40 bold, Arial`n"
  FileAppend, %str%, %filename%
  str := "Gui " . guinum . ": Add, Text, , Slot " . A_Index . "`n"
  FileAppend, %str%, %filename%
  str := "Gui " . guinum . ": Show , w" . w . " h" . h . " x" . x . " y" . y . " , Full Tilt Planner Slot #" . A_Index . "`n"
  FileAppend, %str%, %filename%
  

}
Run "AutoHotkey.exe" "/f" "%filename%"
SetTitleMatchMode, 3
Loop, %slotcount%
{
  WinWait, Full Tilt Planner Slot #%A_Index%
  WinGet, id, id, Full Tilt Planner Slot #%A_Index%
  s := ExFromList(customfillorder,A_Index)
  slot%s%id := id
}
SetTimer, DoPlanningConfig, On
Sleep, 2000
GuiControl, Show, ConfigSave
GuiControl, Show, ConfigCancel

FileDelete, %filename%
  

return

ConfigSave:
  filename := "FullTiltPlannerConfigureLayoutGUI.ahk"
  GuiControl, Hide, ConfigSave
  GuiControl, Hide, ConfigCancel
  GuiControl, Show, CaptureLayout
  GuiControl, Show, ConfigureLayout
  GuiControl, Show, DeleteLayout
  
  order := ""
  SetTitleMatchMode 3
  Loop, %slotcount%
  {
    title := "Full Tilt Planner Slot #" . A_Index
    WinGet, id, id, %title%
    s := 0
    Loop, %slotcount%
    {
      s += 1
      if (slot%s%id = id)
      {
        order := order . "," . s
        break
      }
    }
  }
  
  StringTrimLeft, order, order, 1
  SetTitleMatchMode 2
  DetectHiddenWindows, On
  WinGet, list, list, %filename%
  Loop, %list%
  {
    id := list%A_Index%
    WinClose, ahk_id%id%
  }
  DetectHiddenWindows, Off
  SetTimer, DoPlanningConfig, Off
  
  IniDelete, %inifile%, Layout%ChosenLayout%, customlayout
  IniWrite, %order%, %inifile%, Layout%ChosenLayout%, customfillorder
  GuiControl, Enable, LayoutChoice
  GuiControl, Enable, PlanTables
  refresh_layout()

  
return

ConfigCancel:
  GuiControl, Hide, ConfigSave
  GuiControl, Hide, ConfigCancel
  GuiControl, Show, CaptureLayout
  GuiControl, Show, ConfigureLayout
  GuiControl, Show, DeleteLayout
  SetTitleMatchMode 2
  DetectHiddenWindows, On
  WinGet, list, list, %filename%
  Loop, %list%
  {
    id := list%A_Index%
    WinClose, ahk_id%id%
  }
  DetectHiddenWindows, Off
  SetTimer, DoPlanningConfig, Off
  GuiControl, Enable, LayoutChoice
  GuiControl, Enable, PlanTables
  
return



refresh_layout()
{
  global
  SetTimer, DoPlanning, Off
  IniRead, numlayouts, %inifile%, Layouts, numLayouts
  layoutlist := ""
  Loop, %numLayouts%
  {
    IniRead, tmp, %inifile%, Layouts, %A_Index%
    layoutlist := layoutlist . tmp
    if (A_Index < numlayouts)
    {
      layoutlist := layoutlist . "|"
    }
  }
  GuiControl,, LayoutChoice, |%layoutlist%
  GuiControl, Choose, LayoutChoice, %ChosenLayout%
  
  IniRead, slotcount, %inifile%, Layout%ChosenLayout%, slotcount
  Loop, %slotcount%
  {
    IniRead, slot%A_Index%x, %inifile%, Layout%ChosenLayout%, %A_Index%x
    IniRead, slot%A_Index%y, %inifile%, Layout%ChosenLayout%, %A_Index%y
    IniRead, slot%A_Index%w, %inifile%, Layout%ChosenLayout%, %A_Index%w
    IniRead, slot%A_Index%h, %inifile%, Layout%ChosenLayout%, %A_Index%h
    slot%A_Index%id := ""
  }
  IniRead, customfillorder, %inifile%, Layout%ChosenLayout%, customfillorder
  
  if (PlanTables)
  {
    SetTimer, DoPlanning, On
  }

}

TableIDListFullTilt()
{
  SetTitleMatchMode 2
  WinGet, id, id, Full Tilt Poker - Logged In
  WinGet, pid, PID, ahk_id%id%
  WinGet, list, list, ahk_class FTC_TableViewFull
  Loop %list%
  {
    this_id := list%a_index%
    If (this_id != id)
    {
      ids = %ids%,%this_id%
    }
  }
  StringTrimLeft, ids, ids, 1
  return ids
}


fixtables()
{
  global slotcount
  global customfillorder
  
  tables := TableIDListFullTilt()
  t := ""
  
  
  GetKeyState, state, LButton
  if (state = "D")
  {
    MouseGetPos, , , id
    if (InStr(tables, id))
    {
      Sleep, 70
      GetKeyState, state, LButton
      if (state = "D")
      {
        Loop
        {
          Sleep, 10
          GetKeyState, state, LButton
          if (state = "U")
          {
            MouseGetPos, , , id
            if (InStr(tables, id, true, 0))
            {
              WinGetPos, x, y, this_w, this_h, ahk_id%id%
              
              o := 0
              Loop, %slotcount%
              {
                o += 1
                if (slot%o%id = id )
                {
                  oldslot := o
                  break
                }
              }
              
              
              c := slotcount + 1
              Loop, %slotcount%
              {
                c -= 1
                newslot := c
                if (slot%c%x  > (x) )
                {
                  continue
                }
                else if (slot%c%y  > (y) )
                {
                  continue
                }
                else if (slot%c%x + this_w < (x) )
                {
                  continue
                }
                else if (slot%c%y + this_h < (y) )
                {
                  continue
                }
                else
                {
                  break
                }
              }
              t := slot%newslot%id
              slot%newslot%id := slot%oldslot%id 
              slot%oldslot%id := t
            }
          break
          }
        }
      }
    }
    else
    {
      ;do nothing
    }
  }
  
  
  
  c := 0
  Loop, %slotcount%
  {
    c += 1
    if (slot%c%id = "")
    {
      ;do nothing
    }
    else if (InStr(tables, slot%c%id, true, 0))
    {
      ;do nothing
    }
    else
    {
      slot%c%id := ""
    } 
  }
  
  
  Loop, parse, tables, `,
  {
    id := A_LoopField
    c := 0
    has_slot := 0
    custom := 1
    first_available := slotcount+1
    Loop, %slotcount%
    {
      c += 1
      c1 := c
      if (customfillorder)
      {
        c := IIf(ExFromList(customfillorder,c),ExFromList(customfillorder,c), c)
        if (slot%c%id = "" && GetItemPos(customfillorder,c) < first_available )
        {
          first_available := GetItemPos(customfillorder, c)
          custom := 1
        }
      }
      else if (slot%c%id = "" && c < first_available )
      {
        first_available := c
      }
      
      if (slot%c%id = id)
      {
        has_slot := 1
      }
      c := c1
    }
    
    if (first_available > slotcount && has_slot=0)
    {
      TrayTip, FullTiltPlanner, Too many tables, not enough slots, 10
      WinClose, ahk_id%id%
    }
    else if (has_slot=0)
    {
      if (custom)
      {
        first_available := ExFromList(customfillorder,first_available)
      }
      slot%first_available%id := id
    }
      
    c := 0
    Loop, %slotcount%
    {
      c += 1
      if (slot%c%id = id)
      {
        IfWinExist, ahk_id%id%
        {
          WinGetPos, , , this_w, this_h, ahk_id%id%
          if ((this_w > slot%c%w) || (this_w < slot%c%w) )
          {
            WinMove, ahk_id%id%, , 0, 0, slot%c%w, slot%c%h
            WinActivate,ahk_id%id%
            Sleep, 40
          }
          WinGetPos, x, y, , , ahk_id%id%
          if (x != slot%c%x || y != slot%c%y)
          {
            WinMove, ahk_id%id%, , slot%c%x, slot%c%y, slot%c%w, slot%c%h
          }
        }
        Else
        {
          slot%c%id := ""
        }
      }
    }
  }
}


fixtables_config()
{
  global slotcount
  global customfillorder
  WinGet, list, list, Full Tilt Planner Slot #
  tables := ""
  Loop, %list%
  {
    tables := tables . "," . list%A_Index%
  }
  StringTrimLeft, tables, tables, 1
  t := ""
  
  
  GetKeyState, state, LButton
  if (state = "D")
  {
    MouseGetPos, , , id
    if (InStr(tables, id))
    {
      Sleep, 70
      GetKeyState, state, LButton
      if (state = "D")
      {
        Loop
        {
          Sleep, 10
          GetKeyState, state, LButton
          if (state = "U")
          {
            MouseGetPos, , , id
            if (InStr(tables, id, true, 0))
            {
              WinGetPos, x, y, this_w, this_h, ahk_id%id%
              
              o := 0
              Loop, %slotcount%
              {
                o += 1
                if (slot%o%id = id )
                {
                  oldslot := o
                  break
                }
              }
              
              
              c := slotcount + 1
              Loop, %slotcount%
              {
                c -= 1
                newslot := c
                if (slot%c%x  > (x) )
                {
                  continue
                }
                else if (slot%c%y  > (y) )
                {
                  continue
                }
                else if (slot%c%x + this_w < (x) )
                {
                  continue
                }
                else if (slot%c%y + this_h < (y) )
                {
                  continue
                }
                else
                {
                  break
                }
              }
              t := slot%newslot%id
              slot%newslot%id := slot%oldslot%id 
              slot%oldslot%id := t
            }
          break
          }
        }
      }
    }
    else
    {
      ;do nothing
    }
  }
  
  
  
  c := 0
  Loop, %slotcount%
  {
    c += 1
    if (slot%c%id = "")
    {
      ;do nothing
    }
    else if (InStr(tables, slot%c%id, true, 0))
    {
      ;do nothing
    }
    else
    {
      slot%c%id := ""
    } 
  }
  
  
  Loop, parse, tables, `,
  {
    id := A_LoopField
    c := 0
    has_slot := 0
    custom := 1
    first_available := slotcount+1
    Loop, %slotcount%
    {
      c += 1
      c1 := c
      if (customfillorder)
      {
        c := IIf(ExFromList(customfillorder,c),ExFromList(customfillorder,c), c)
        if (slot%c%id = "" && GetItemPos(customfillorder,c) < first_available )
        {
          first_available := GetItemPos(customfillorder, c)
          custom := 1
        }
      }
      else if (slot%c%id = "" && c < first_available )
      {
        first_available := c
      }
      
      if (slot%c%id = id)
      {
        has_slot := 1
      }
      c := c1
    }
    
    if (first_available > slotcount && has_slot=0)
    {
      TrayTip, FullTiltPlanner, Too many tables, not enough slots, 10
      WinClose, ahk_id%id%
    }
    else if (has_slot=0)
    {
      if (custom)
      {
        first_available := ExFromList(customfillorder,first_available)
      }
      slot%first_available%id := id
      
    }
      
    c := 0
    Loop, %slotcount%
    {
      c += 1
      if (slot%c%id = id)
      {
        IfWinExist, ahk_id%id%
        {
          WinGetPos, , , this_w, this_h, ahk_id%id%
          if ((this_w > slot%c%w) || (this_w < slot%c%w) )
          {
            WinMove, ahk_id%id%, , slot%c%x, slot%c%y, slot%c%w, slot%c%h
          }
          WinGetPos, x, y, , , ahk_id%id%
          
          if (x != slot%c%x || y != slot%c%y)
          {
            WinMove, ahk_id%id%, , slot%c%x, slot%c%y
          }
        }
        Else
        {
          slot%c%id := ""
        }
      }
    }
  }
}

;###########################################
;################# Lists ####################
;###########################################

;adds said item to the end of said list
AddToList(list,item,del=""){
del := IIf(del="",",",del)
If list =
 return item
return list . del . item
}

;return item at said position in said list
ExFromList(list,pos=1,del="") {
del := IIf(del,del,",")
StringSplit, item, list, %del%
return item%pos%
}

;removes said item from said list
RemoveFromList(list,item=1,del="") {
del := IIf(del,del,",")
If InStr(list, item . del)
 return StrRep(list, item . del, "", 0)
else if InStr(list, del . item, "", 0)
 return StrRep(list, del . item, "", 0)
else if (item = list)
 return
else
 return list
}

;removes the nth item from said list
RemoveItemNFromList(list,n,del="") {
del := IIf(del,del,",")
return RemoveFromList(list, ExFromList(list,n,del))
}

;returns the position of said item in said list
;(0 if not in list)
GetItemPos(list,item,del="") {
del := IIf(del,del,",")
StringSplit, array, list, %del%
Loop %array0% {
        If array%a_index% = %item%
                return a_index
 }
return 0
}

;inserts said item at said position in said list
InsertItem(list,item,pos,del="") {
del := IIf(del="",",",del)
StringSplit,array,list,%del%
Loop % IIf( ( pos < array0 ), array0, pos ) {
        thisItem := array%a_index%
        If ( a_index != pos )
                newList = %newList%%del%%thisItem%
        else
                newList = %newList%%del%%item%%del%%thisItem%
 }
If ( InStr(newList, ",",0,0) = StrLen(newList) )
 StringTrimRight, newList, newList, 1
StringTrimLeft, newList, newList, 1
return newList
}

;removes empty items (and trailing delimiters)
CleanList(list, del="") {
If del =
 del = `,
Loop {
  StringReplace, list, list, %del%%del%, %del%, UseErrorLevel
  If ! ErrorLevel
   break
 }
If InStr(list, del) = 1
 StringTrimLeft, list, list, 1
If InStr(list, del,0,0) = StrLen(list)
 StringTrimRight, list, list, 1
return list
}

List_longest(list, del="") {
del := IIf( del="", ",", del)
longest = 0
Loop, Parse, list, %del%
 {
        If (longest < StrLen(a_loopfield))
                longest := StrLen(a_loopfield)
 }
return longest
}


IIf(_boolExpr, _exprTrue, _exprFalse) {
If _boolExpr
 Return _exprTrue
else
 return _exprFalse
}

StrRep(str,char,rep_char="",all=1) {
StringReplace,str,str,%char%,%rep_char%,%all%
return str
}


DoPlanning:
  fixtables()
return

DoPlanningConfig:
  fixtables_config()
return

KillPopUps:
  SetTitleMatchMode, 2
  
  if (AutoBuyInOn)
  {
    IfWinExist, Get Chips
    {
      WinGet, idlist, list, Get Chips
      Loop, %idlist%
      {
        id := idlist%A_Index%
        ControlFocus, Button2, ahk_id%id%
        ControlGetFocus, focusCTRL, ahk_id%id%
        if (focusCTRL = "Button2")
        {
          ControlSend, Button2, {SPACE}, ahk_id%id%
          ControlFocus, FTCSkinButton1, ahk_id%id%
          ControlSend, FTCSkinButton1, {SPACE}, ahk_id%id%
        }
        else
        {
          ControlFocus, FTCSkinButton2, ahk_id%id%
          ControlSend, FTCSkinButton2, {SPACE}, ahk_id%id%
        }
      }
    }
  }
  
  if (KillDialogsOn)
  {
    WinGet, vDialogIdList, List, ahk_class #32770

    Loop, %vDialogIdList%
    {
      ; find the next ID of the next open dialog box
      StringTrimRight, vWinId, vDialogIdList%A_Index%, 0
  
      ; if it is a FT notes dialog box, then ignore it
      IfWinExist, ahk_id%vWinId% ahk_group FTPNotes
        continue
  
      CloseLeaveTableDialog(vWinId)
      CloseLeaveSeatDialog(vWinId)
      CloseAutoPostBlindsDialog(vWinId)
    }
  }
  
return

; check if the pesky "leave table" dialog box is present... if so close it
CloseLeaveTableDialog(pWinId)
{
   global PixTol, ColTol, PAdj 
   ;local vX, vY
   
   ; get the position of the dialog box
   WinGetPos, vX, vY,,, ahk_id%pWinId%
   
   ; search for the image-dialog-leavetable.bmp image (position is 65,57)(size is 194,9 pixels)
   CoordMode,Pixel,Screen
   ImageSearch, ,, vX+65-PixTol,vY+57-PixTol + PAdj,vX+258+PixTol * 2 ,vY+65+PixTol * 2  + PAdj, *%ColTol% image-dialog-leavetable.bmp
   ; if we don't see the proper text, then return
   If ( errorLevel )
      Return

   ; Send enter to the Yes button to get rid of dialog box
   ControlFocus, FTCSkinButton1, ahk_id %pWinId%
   Sleep, -1
   ControlSend, FTCSkinButton1, {ENTER}, ahk_id %pWinId%
}


; check if the pesky "leave seat" dialog box is present... if so close it
CloseLeaveSeatDialog(pWinId)
{
   global PixTol, ColTol, PAdj
   ;local vX, vY
   
   ; get the position of the dialog box
   WinGetPos, vX, vY,,, ahk_id%pWinId%

   ; search for the image-dialog-leavetable.bmp image (position is 65,57)(size is 190,9 pixels)
   CoordMode,Pixel,Screen
   ImageSearch, ,, vX+65-PixTol,vY+57-PixTol + PAdj,vX+254+PixTol * 2 ,vY+65+PixTol * 2  + PAdj, *%ColTol% image-dialog-leaveseat.bmp
   ; if we don't see the proper text, then return
   If ( errorLevel )
      Return

   ; Send enter to the Yes button to get rid of dialog box
   ControlFocus, FTCSkinButton1, ahk_id %pWinId%
   Sleep, -1
   ControlSend, FTCSkinButton1, {ENTER}, ahk_id %pWinId%
}


; check if the pesky "auto post blinds" dialog box is present... if so, say yes
;     to auto post the blinds, unless we are in AutoSitModeEnabled (then say no)
CloseAutoPostBlindsDialog(pWinId)
{
   global PixTol, ColTol, PAdj
   ;local vX, vY
   
   ; get the position of the dialog box
   WinGetPos, vX, vY,,, ahk_id%pWinId%
   
   ; search for the image-dialog-leavetable.bmp image (position is 66,57)(size is 114,9 pixels)
   CoordMode,Pixel,Screen
   ImageSearch, ,, vX+66-PixTol,vY+57-PixTol + PAdj,vX+179+PixTol * 2 ,vY+65+PixTol * 2  + PAdj, *%ColTol% image-dialog-autopostblinds.bmp
   ; if we don't see the proper text, then return
   If ( errorLevel )
      Return
   
   ; Send enter to the Yes button to get rid of dialog box
   ControlFocus, FTCSkinButton1, ahk_id %pWinId%
   Sleep, -1
   ControlSend, FTCSkinButton1, {ENTER}, ahk_id %pWinId%
}

ExitSub:
  
return

CategoryAutoHotkey

FullTiltPlanner (last edited 2008-05-06 18:42:59 by MogobuTheFool)