Resizeable Tables

By _dave_ at 2+2 forums. The corresponding thread on 2+2 is here.

Much credit to Roland for the excellent functions, and Jukofyork for the technique suggestion (long time ago, unrelated post I remember)

This script creates resizeable windows for sites that do not provide them - Full Tilt Poker is currently the only supported site, but I see no reason why I can't add more as time goes on.

There may be errors, problems etc. with this script - Please let me know about them so I may fix them - I can't fix a problem I do not know about :)

I suggest the use of both BetPot script and StarsPlanner to assist in the use of resized Full Tilt tables.

Enjoy!

dave.

Full Tilt

ftrqx6

Full support at this room. The only thing not working is the Slider - use number keys or BetPot to enter betting amounts.

Download Here

Table_Resizer-v0.2.ahk

Instructions

Save the script from the download link above, or copy/paste from the code listing below.

If you like, edit the script in notepad. There are a few global variables (settings) right at the start of the script - these should be self explanitory.

Version History

0.01

0.2

Code - Version 0.2



#NoEnv
#Persistent
#SingleInstance, Force
SendMode Input


pahud := 1
update_period   = 500
std_w := 522
std_h := std_w / 1.45155

movetox := -10000
movetoy := -10000

pt := 0
Process, Exist, ptrack2.exe
if (ErrorLevel)
{
  ptrack2 := ErrorLevel
  Process, Priority, %ptrack2%, BelowNormal
  pt := 1
}

Process, Exist, pto.exe
if (ErrorLevel)
{
  pto := ErrorLevel
  Process, Priority, %ptrack2%, BelowNormal
  pt := 1
}

if (!pt)
{
  Msgbox, Poker Tracker is not open.`n`n`nManually Set ptrack2.exe (or pto.exe) to BELOW NORMAL Priority if you run it while using this script.
}

Process, Exist, FullTiltPoker.exe
if (ErrorLevel)
{
  FTP := ErrorLevel
  Process, Priority, %FTP%, High
  SetAffinity(FTP)
}
Else
{
  Msgbox, Full Tilt Poker is not open.`n`n`nManually Set FullTiltPoker.exe to HIGH Priority to use this script.`n`nIf you have a dual-core or HT CPU, set Affinity to CPU 0 only.
}


SetTimer, move_dialogs, 333
SetTimer, check_tables, 333 

SysGet, border, 32
SysGet, caption, 4
return

move_dialogs:
  WinGet, pid, pid, ahk_class FTCLobby
  WinGet, idlist, list, ahk_pid%pid% ahk_class #32770
  Loop, %idlist%
  {
    id := idlist%A_Index%
    WinSet, AlwaysOnTop, On, ahk_id%id%
    WinMove, ahk_id%id%, , 0,0
  }
return



check_tables:
  WinGet, ids, list,ahk_class FTC_TableViewFull
  
  
  Loop, %ids%
  {
    id := ids%a_index%
    spawn_gui(id)
  }
   
return  





spawn_gui(table)
{
  global update_period
  global caption
  global border
  global movetox
  global movetoy
  global std_w
  global pahud
  
  w := std_w - (border*2)
  h := Round((w / 1.45155),0)
  
  WinGet, alreadyopen, list, MiniFT ahk_class AutoHotkeyGUI
  Loop, %alreadyopen%
  {
    id := alreadyopen%a_index%
    WinGetTitle, t, ahk_id%id%
    StringTrimLeft, t, t, Instr(t, "hwnd:", true, 0)+4
    if (table = t)
    {
      return
    }
  }
  
  WinMove, ahk_id%table%, ,%movetox%,%movetoy% 
  
  filename := "FT_Resize_" . table . ".ahk"
  FileDelete, %filename%
  str := "SysGet, border, 32`nSysGet, caption, 4`ntable := " . table . "`nhud := """"`n"
  str := str . "#NoTrayIcon`n"
  str := str . "Process, Exist`n"
  str := str . "SetAffinity(ErrorLevel)`n"
  str := str . "OnExit, CleanUp`n"
  str := str . "WinGetTitle, title , ahk_id %table%`n"
  str := str . "Gui +Resize `n"
  str := str . "Gui Show, w" . w . " h" . h . ", MiniFT - %title% || hwnd:%table%`n"
  str := str . "OnMessage(0x201, ""WM_LBUTTONDOWN"")`n"
  str := str . "OnMessage(0x102, ""WM_CHAR"")`n"
  str := str . "WinWait, MiniFT - %title% || hwnd:%table%`n"
  str := str . "WinGet, hw_frame, id, MiniFT - %title% || hwnd:%table%`n"
  str := str . "hdc_frame := DllCall( ""GetDC"", UInt, hw_frame)`n"
  str := str . "hdc_buffer := DllCall( ""gdi32.dll\CreateCompatibleDC"", UInt, hdc_frame)`n"
  str := str . "hbm_buffer := DllCall( ""gdi32.dll\CreateCompatibleBitmap"", UInt, hdc_frame, Int, A_ScreenWidth, Int, A_ScreenHeight)`n"
  str := str . "DllCall( ""gdi32.dll\SelectObject"", UInt, hdc_buffer, UInt, hbm_buffer)`n"
  str := str . "DllCall(""gdi32.dll\SetStretchBltMode"", UInt, hdc_frame, Int, 4)`n"

  str := str . "SetTimer, UpdateTable, " . update_period . "`n"
  str := str . "SetTimer, MoveTable, " . Round(((update_period / 2) + 43),0) . "`n"
  if (pahud)
  {
    str := str . "SetTimer, UpdateHUD, 3000`n"
    str := str . "SetTimer, DestroyHUD, 120000`n"
  }
  str := str . "return`n"
  str := str . "GuiClose:`n"
  str := str . "  ExitApp`n"
  str := str . "CleanUp:`n"
  str := str . "  WinClose, ahk_id%table%, , 10`n"
  str := str . "  WinWaitClose, ahk_id%table%, , 10`n"
  str := str . "  if (errorlevel)`n"
  str := str . "  {`n"
  str := str . "    return`n"
  str := str . "  }`n"
  str := str . "  DllCall( ""gdi32.dll\DeleteDC"", UInt, hdc_frame)`n"
  str := str . "  DllCall( ""gdi32.dll\DeleteDC"", UInt, hdc_buffer)`n"
  str := str . "  DllCall( ""gdi32.dll\DeleteObject"", UInt, hbm_buffer)`n"
  if (pahud)
  {
    str := str . "  DllCall( ""gdi32.dll\DeleteDC"", UInt, hdc_frame2)`n"
    str := str . "  DllCall( ""gdi32.dll\DeleteDC"", UInt, hdc_buffer2)`n"
    str := str . "  DllCall( ""gdi32.dll\DeleteObject"", UInt, hbm_buffer2)`n"
  }
  str := str . "  ExitApp`n"
  str := str . "MoveTable:`n"
  str := str . "  WinGetPos, x, y, , , ahk_id%table%`n"
  str := str . "  if ((x != " . movetox . ") || (y != " . movetoy . "))`n"
  str := str . "  {`n"
  str := str . "     WinMove, ahk_id%table%, ," . movetox . ", " . movetoy . " `n"
  str := str . "  }`n"
  str := str . "  return`n"
  str := str . "UpdateTable:`n"
  str := str . "  IfWinNotExist, ahk_id %table%`n"
  str := str . "  {`n"
  str := str . "    ExitApp`n"
  str := str . "  }`n"
  str := str . "  WinGetPos,,,p_w,p_h, ahk_id %hw_frame%`n"
  str := str . "  p_w := p_w - (2*border)`n"
  str := str . "  p_h := p_h - (caption +(2*border))`n"
  str := str . "  p_x := border`n"
  str := str . "  p_y := caption + border`n"
  str := str . "  Critical, On`n"
  str := str . "  WinGetPos, x, y, w, h, ahk_id %table%`n"
  str := str . "  w := w - (2*border)`n"
  str := str . "  h := h - (caption +(2*border))`n"
  str := str . "  DllCall(""PrintWindow"", UInt, table ,UInt, hdc_buffer, UInt, 0)`n"
  str := str . "  DllCall(""gdi32.dll\StretchBlt"", UInt, hdc_frame, Int, 0, Int, 0, Int, p_w, Int, p_h, UInt, hdc_buffer, Int, p_x, Int, p_y, Int, w, Int, h ,UInt, 0x00CC0020)`n"
  str := str . "  Critical, Off`n"
  str := str . "  return`n"
  
  if (pahud)
  {
    str := str . "DestroyHud:`n"
    str := str . "  Critical, On`n"
    str := str . "  DllCall( ""gdi32.dll\DeleteDC"", UInt, hdc_frame2)`n"
    str := str . "  DllCall( ""gdi32.dll\DeleteDC"", UInt, hdc_buffer2)`n"
    str := str . "  DllCall( ""gdi32.dll\DeleteObject"", UInt, hbm_buffer2)`n"
  
    str := str . "  hud := """"`n"
    str := str . "  Critical, Off`n"
    str := str . "  `n"
    str := str . "  `n"
    str := str . "  return`n"
    str := str . "UpdateHud:`n"
    str := str . "  IfWinNotExist, PokerAce Hud`n"
    str := str . "  {`n"
    str := str . "    return`n"
    str := str . "  }`n"
    str := str . "  if (hud)`n"
    str := str . "  {`n"
    str := str . "    WinGetPos,x7,y7,p_w,p_h, ahk_id %hw_frame2%`n"
    
    str := str . "    WinGetPos,x6,y6,w6,h6, ahk_id %hw_frame%`n"
    
    str := str . "    x6 := x6 + border`n"
    str := str . "    y6 := y6 + border + caption`n"
    str := str . "    w6 := w6 - (2*border)`n"
    str := str . "    h6 := h6 - ((2*border)+ caption)`n"
    str := str . "    if ( (x6 != x7) || (y6 != y7) || (w6 != p_w) || (h6 != p_h) )`n" 
    str := str . "    {`n"
    str := str . "      Gui 2: Show, x%x6% y%y6% w%w6% h%h6%`n"
    str := str . "      WinGetPos,,,p_w,p_h, ahk_id %hw_frame2%`n"
    str := str . "    }`n"
    str := str . "    p_x := 0`n"
    str := str . "    p_y := 0`n"
    str := str . "    WinGetPos, x, y, w, h, ahk_id %hud%`n"
    str := str . "    DllCall(""PrintWindow"", UInt, hud ,UInt, hdc_buffer2, UInt, 0)`n"
    str := str . "    DllCall(""gdi32.dll\StretchBlt"", UInt, hdc_frame2, Int, 0, Int, 0, Int, p_w, Int, p_h, UInt, hdc_buffer2, Int, p_x, Int, p_y, Int, w, Int, h ,UInt, 0x00CC0020)`n"
    str := str . "    `n"
    str := str . "    `n"
    str := str . "    `n"
    str := str . "    return`n"
    str := str . "  }`n"
    str := str . "  else`n"
    str := str . "  {`n"
    str := str . "    WinGet, pa_id, id, PokerAce Hud`n"
    str := str . "    WinGetTitle, tablename, ahk_id%table%`n"
    str := str . "    StringTrimRight, tablename, tablename, (StrLen(tablename) - InStr(tablename, "" - ""))+1`n"
    str := str . "    ControlGet, hudlist, List, , SysListView321, ahk_id%pa_id%`n"
    str := str . "    Loop, Parse, hudlist, ``n`n"
    str := str . "    {`n"
    str := str . "      row := A_LoopField`n"
    
    str := str . "      if (InStr(row, ""Full Tilt"") && InStr(row, tablename))`n"
    str := str . "      {`n"
    str := str . "        WinGet, hud, id, PokerAceHudTableCover %tablename%`n"
    str := str . "      }`n"
    str := str . "    }`n"
    str := str . "  }`n"
    str := str . "  if (hud)`n"
    str := str . "  {`n"
    str := str . "    setup_hud_gui()`n"
    str := str . "  }`n"
    str := str . "  return`n"
  }
  if (pahud)
  {
    str := str . "setup_hud_gui()`n"
    str := str . "{`n"
    str := str . "  global`n"
    str := str . "  WinGetPos,x,y,w,h, ahk_id%hw_frame%`n"
    str := str . "  Gui 2: -Resize +Owner1 +ToolWindow -Caption`n"
    str := str . "  x := x + border`n"
    str := str . "  y := y + border + caption`n"
    str := str . "  w := w - (2*border)`n"
    str := str . "  h := h - ((2*border)+ caption)`n"
    str := str . "  Gui 2: Color, DEDE00`n"
    str := str . "  Gui 2: Show, w%w% h%h% x%x% y%y% NoActivate, MinihudFT || hwnd:%hud%`n"
    str := str . "  WinWait, MinihudFT || hwnd:%hud%`n"
    str := str . "  WinGet, hw_frame2, id, MinihudFT || hwnd:%hud%`n"
    str := str . "  WinSet, TransColor, DEDE00, ahk_id%hw_frame2%`n"
    str := str . "  hdc_frame2 := DllCall(""GetDC"", UInt, hw_frame2)`n"
    str := str . "  hdc_buffer2 := DllCall(""gdi32.dll\CreateCompatibleDC"", UInt, hdc_frame2)`n"
    str := str . "  hbm_buffer2 := DllCall(""gdi32.dll\CreateCompatibleBitmap"", UInt, hdc_frame2, Int, A_ScreenWidth, Int, A_ScreenHeight)`n"
    str := str . "  DllCall(""gdi32.dll\SelectObject"", UInt, hdc_buffer2, UInt, hbm_buffer2)`n"
    str := str . "  DllCall(""gdi32.dll\SetStretchBltMode"", UInt, hdc_frame2, Int, 4)`n"
    str := str . "}`n"
  }

  
  str := str . "relFTPClientPoint(id, ByRef x, ByRef y)`n"
  str := str . "{`n"
  str := str . "  global border`n"
  str := str . "  global caption`n"
  str := str . "  rw := 794`n"
  str := str . "  rh := 547`n"
  str := str . "  WinGetPos, , , w, h, ahk_id%id%`n"
  str := str . "  w := w - (2*border)`n"
  str := str . "  h := h - (2*border) - caption`n"
  str := str . "  x := Floor( (x / w ) * rw )`n"
  str := str . "  y := Floor( (y / h) * rh  )`n"
  str := str . "}`n"
  
  str := str . "PostLeftClick(x, y, table_id, activate=1)`n"
  str := str . "{`n"
  str := str . "  If activate`n"
  str := str . "    WinActivate, ahk_id%table_id%`n"
  str := str . "  PostMessage, 0x201, 0x0001, ((y<<16)^x), , ahk_id%table_id%`n"
  str := str . "  PostMessage, 0x202 , 0, ((y<<16)^x), , ahk_id%table_id%`n"
  str := str . "}`n"

  str := str . "PostFTPClick(x, y, id)`n"
  str := str . "{`n"
  str := str . "  relFTPClientPoint(id, x, y)`n"
  str := str . "  PostLeftClick(x, y, id)`n"
  str := str . "}`n"

  str := str . "WM_LBUTTONDOWN(wParam, lParam)`n"
  str := str . "{`n"
  str := str . "  global hw_frame`nglobal table`nglobal border`nglobal caption`n"
  str := str . "  x := lParam & 0xFFFF`n"
  str := str . "  y := lParam >> 16`n"
  str := str . "  relFTPClientPoint(hw_frame, x, y)`n"
  str := str . "  CoordMode, Mouse, Relative`n"
  str := str . "  mx := x + border`n"
  str := str . "  my := y + caption + border`n"
  str := str . "  clicked := """"`n"
  str := str . "  WinGet, ControlList, ControlList, ahk_id%table%`n"
  str := str . "  Loop, Parse, ControlList, ``n`n"
  str := str . "  {`n"
  str := str . "    ControlGet, v, Visible, , %A_LoopField%  , ahk_id%table%`n"
  str := str . "    if (v)`n"
  str := str . "    {`n"
  str := str . "      ControlGetPos, cx, cy, cw, ch, %A_LoopField%, ahk_id%table%`n"
  str := str . "      cx2 := (cx+cw)`n"
  str := str . "      cy2 := (cy+ch)`n"
  ;str := str . "      Msgbox, %mx% %my%``n``n%cx% %cy% %cx2% %cy2%``n``n %A_LoopField%`n"
  str := str . "      if (IsInRect(mx, my, cx, cy, cx2, cy2))`n"
  str := str . "      {`n"
  str := str . "        WinActivate, ahk_id%table%`n"
  str := str . "        ControlFocus, %A_LoopField%, ahk_id%table%`n"
  str := str . "        Sleep, -1`n"
  str := str . "        ControlClick, %A_LoopField%, ahk_id%table%`n"
  str := str . "        clicked := A_LoopField`n"
  str := str . "        break`n"
  str := str . "      }`n"
  str := str . "    }`n"  
  str := str . "  }`n"
  str := str . "  if (! clicked)`n"
  str := str . "  {`n"
  str := str . "    WinActivate, ahk_id%table%`n"
  str := str . "    PostLeftClick(x, y, table, 0)`n"
  str := str . "    PostMessage, 0x201, 0x0001, ((y<<16)^x), , ahk_id%table%`n"
  str := str . "  }`n"
  str := str . "}`n"

  str := str . "WM_CHAR(wParam, lParam)`n"
  str := str . "{`n"
  str := str . "  ctr := ""Edit2""`n"
  str := str . "  global hw_frame`nglobal table`n"
  str := str . "  ControlGet, v, Visible, , Edit1, ahk_id%table%`n"
  str := str . "  if (v)`n"
  str := str . "  {`n"
  str := str . "    ctr := ""Edit1""`n"
  str := str . "  }`n"
  str := str . "  ControlFocus, %ctr%, ahk_id%table%`n"
  str := str . "  PostMessage, 0x102 , %wParam%, %lParam%, %ctr%, ahk_id%table%`n" 
  str := str . "  `n"
  str := str . "}`n"
  
  str := str . " `n"
  str := str . "  `n"
  str := str . " `n" 
  str := str . " `n" 
  str := str . " `n" 
  

  str := str . "IsInRect(x,y, x1,y1,x2,y2)`n"
  str := str . "{`n"
  str := str . "  if ((x >= x1) && (x <= x2) && (y >= y1) && (y <= y2))`n"
  str := str . "  {`n"
  str := str . "    return 1`n"
  str := str . "  }`n"
  str := str . "  return 0`n"
  str := str . "}`n"
  str := str . "SetAffinity(pid, cpu=1)`n"
  str := str . "{`n"
  str := str . "  h := DllCall(""OpenProcess"", ""UInt"", 0x1F0FFF, ""Int"", false, ""UInt"", pid)`n"
  str := str . "  DllCall(""SetProcessAffinityMask"", ""UInt"", h, ""UInt"", cpu)`n"
  str := str . "  DllCall(""CloseHandle"", ""UInt"" h)`n"
  str := str . "  return`n"
  str := str . "}`n"

  
  FileAppend, %str%, %filename%
  Run "AutoHotkey.exe" "/f" "%filename%", , , pid
  WinWait, ahk_pid%pid%
  FileDelete, %filename%
  return
}

SetAffinity(pid, cpu=1)
{
  h := DllCall("OpenProcess", "UInt", 0x1F0FFF, "Int", false, "UInt", pid)
  DllCall("SetProcessAffinityMask", "UInt", h, "UInt", cpu)
  DllCall("CloseHandle", "UInt" h)
  return
}



CategoryAutoHotKey

ResizeableTables (last edited 2006-12-13 02:56:26 by Dave)