Open Side Menu Go to the Top
Register
FTCash - free script for FullTilt cash players. FTCash - free script for FullTilt cash players.

03-08-2010 , 02:52 PM
Quote:
Originally Posted by Max1mums
Do you mean that you press fold/call/raise and next table with action doesn't get activated? Are other scripts/programs running along?
Yes, that is exactly what I'm saying.

I'm not running any other AHK scripts, but I do have Hold'em Manager and HUD running.

I have desktop composition turned off on full tilt.

I generally play stars, but I mess around on FT from time to time and just got a bonus on FT so I'm grinding a bit there now to clear it.
FTCash - free script for FullTilt cash players. Quote
03-08-2010 , 03:26 PM
Is "Display table on action" option checked in FT client and is everything working fine without FTCash?
FTCash - free script for FullTilt cash players. Quote
03-08-2010 , 04:27 PM
I know "Display table on Action" is checked. As far as everything working fine, well, I'm not sure. I'm running FTCash to use my gamepad, otherwise I'm using a mouse so I guess I'm not sure how to tell?

One thing I did try last night was to over lap the tables some. When a table needed action, it actually moved to the top of the zorder of windows, but the red active square stayed on the old table as well as input.

I do not have move mouse or activate table under mouse on.

I can try the run as admin on the ft client later tonight when I'm home.

Sometimes it works just fine, others I have to manually move the focus. Could it be some strange timing issue? On stars I use your modified StarsHotkeys script and I think it uses a loop vs FTCash looks like it uses all timer functions.
FTCash - free script for FullTilt cash players. Quote
03-08-2010 , 05:26 PM
Quote:
One thing I did try last night was to over lap the tables some. When a table needed action, it actually moved to the top of the zorder of windows, but the red active square stayed on the old table as well as input.
That can happen if you switch from non FT table window to FT table window and should work fine if you switch between FT tables only.
FTCash - free script for FullTilt cash players. Quote
03-08-2010 , 11:09 PM
I may have figured out another difference. Haven't had a problem tonight so far, and the difference is I don't have that little bonus window up all of the time.
FTCash - free script for FullTilt cash players. Quote
03-12-2010 , 06:35 PM
Hi,

Cool script.

I am having one issue though... the Sit Out All and Deal Me In All hotkeys only work for tables of the same stakes. For instance, if I'm at two $1/2 tables and two $2/4 tables and I use the Sit Out All hotkey, it only sits me out on the $1/2 tables, but I'm still sitting in at the $2/4 tables.

Any way to fix this?

Thanks
FTCash - free script for FullTilt cash players. Quote
03-14-2010 , 03:00 AM
If you can fix the problem I described above, I'd happily ship you a donation on FTP... basically I want to be able to sit out on all tables across multiple limits (NL/PLO cash games).

If it's easy, I'd also like to optimize the script so nothing else is in it besides the Sit Out All and Deal Me In All functionality, so the script isn't scanning the tables or consuming more resources than necessary for those features.

PM me if you're interested in helping Max1mums, thanks
FTCash - free script for FullTilt cash players. Quote
03-14-2010 , 06:48 AM
Check if this version is working correctly on nl400+ and nl400- tables at the same time. Deal me in and timebank options are most resource taking so using any other options won't affect script work alot and you can always uncheck all options you don't need.
Code:
; #### FTCash ####

; AHK version: 1.0.48.05
; date: March 14,2010
  version := "1.02a"
; author: Max1mums (max1mums@overcards.com)

#SingleInstance, Force
#NoEnv
#Persistent
Settitlematchmode, 2
OnExit exitSub

StringTrimRight, thisahk, A_ScriptName, 4
SetWorkingDir %A_ScriptDir%

Menu, Tray, NoStandard
Menu, Tray, Add, Settings, menugui
Menu, Tray, Add 
Menu, Tray, Add, Reload, reload
Menu, Tray, Default, Settings
Menu, Tray, Add 
Menu, Tray, Add, Suspend, Suspend
Menu, Tray, Add, Pause, TogglePause
Menu, Tray, Add 
Menu, Tray, Add, Edit, Edit 
Menu, Tray, Add 
Menu, Tray, Add, Exit, ExitSub

OnMessage(0x112,"WM_SYSCOMMAND")
WM_SYSCOMMAND(wParam)
{
  if (A_Gui && wParam = 0xF020) ; SC_MINIMIZE
  {
    Gui, destroy
    return 0
  }
}

boost:=false
; Border of the "Highlighter"
border_color := "ff0000"
border_size := 5
trans := 255

debug:=0

SetBatchLines,-1
SetWinDelay,-1
SendMode Input

SysGet, xbord, 32
SysGet, ybord, 33
SysGet, cap, 4
SysGet, border, 32
SysGet, caption, 4

time_x:=0.9093
time_y:=0.7200
time_x1:=0.8808
t1:=0xdedbde
v:=25
back_x:=0.6534
back_y:=0.9862
back_x1:=0.5859
back1:=0x181818
v1:=5
join_x:=0.6158
join_y:=0.9292
join_x1:=0.8261
join:=0xffffff
v2:=5
once:=true
tablequeue=
ddlist=
Loop 14
ddlist:=ddlist . A_index . "|"

ddlist1=
ddlist1.="ssnl" . "|"
ddlist1.="trny" . "|"
ddlist1.="mix" . "|"
ddlist1.="----" . "|"
gosub,getini

ifwinnotexist,FullTiltPoker ahk_class QWidget
{
if flicker1
{
winwait,Logged In ahk_class QWidget
Process, Exist, FullTiltPoker.exe
if (ErrorLevel)
{
  FTP := ErrorLevel
  Process, Priority, %FTP%, High
}
}
else
{
Process, Exist, FullTiltPoker.exe
if (ErrorLevel)
{
  FTP := ErrorLevel
  Process, Priority, %FTP%, Normal
}
}
if flicker2
{
winwait,Logged In ahk_class QWidget
Process, Exist, AutoHotkey.exe
if (ErrorLevel)
{
  Ahk := ErrorLevel
;  SetAffinity(Ahk,0)
 SetAffinity(Ahk)
}
Process, Exist, FullTiltPoker.exe
if (ErrorLevel)
{
  FTP := ErrorLevel
;  SetAffinity(FTP,0)
 SetAffinity(FTP)
}
}
}
else
winwaitclose,FullTiltPoker ahk_class QWidget



;;;;;;;;;;;;End of init;;;;;;;;;;;;;;

if Timebank
settimer,clickwithdelay,100
if autopot OR Highlight 
settimer,act,55
if Highlight
settimer,Highlighter,43
if dealmein OR Timebank
settimer,check,639
settimer,Colorinit,187
if MoveMouse
settimer,MouseMove,119
settimer,BetPot,87
settimer,onFTclose,1078
if activatetableundermouse
settimer,activateundermouse,133

return

;-----------------------------------------------------------------------------------------------------
onFTclose:
Settitlematchmode, 3
ifwinexist,FullTiltPoker ahk_class QWidget
{
exitapp
}
Settitlematchmode, 2
return
;-----------------------------------------------------------------------------------------------------
FoldFT(id)
{
  PostclickFT(0.6834,0.9358,id)
}
CallFT(id)
{
  PostclickFT(0.8032,0.9358,id)
}
RaiseFT(id)
{
  PostclickFT(0.9356,0.9358,id)
}
Fold2anyFT(id)
{
global Racetrack
  if Racetrack
  PostclickFT(0.4325,0.8937,id)
  else
  PostclickFT(0.0088,0.7472,id)
}

Fold2anyFT400(id)
{
global Racetrack
  if Racetrack
  PostclickFT(0.4193,0.9169,id)
}
;-----------------------------------------------------------------------------------------------------
fold:
sendmode event
If ActOnActiveTable
WinGet, Id, ID, A
else
MousegetPos,,,ID
wingetclass,class,ahk_id%id%
if class=QWidget
{
 FoldFT(id)
}
else
{
;ControlGetFocus,ctrl,ahk_id%id%
;ControlSend,%ctrl%,%fold%,ahk_id%id%
send {%fold%}
}
sendmode input
return



call:
sendmode event
If ActOnActiveTable
WinGet, Id, ID, A
else
MousegetPos,,,ID
wingetclass,class,ahk_id%id%
if class=QWidget
{
 callFT(id)
}
else
{
;ControlGetFocus,ctrl,ahk_id%id%
;ControlSend,%ctrl%,%call%,ahk_id%id%
send {%call%}
}
sendmode input
return

raise:
sendmode event
If ActOnActiveTable
WinGet, Id, ID, A
else
MousegetPos,,,ID
wingetclass,class,ahk_id%id%
if class=QWidget
{
 raiseFT(id)
}
else
{
;ControlGetFocus,ctrl,ahk_id%id%
;ControlSend,%ctrl%,%raise%,ahk_id%id%
send {%raise%}
}
sendmode input
return

fold2any:
sendmode event
If ActOnActiveTable
WinGet, Id, ID, A
else
MousegetPos,,,ID
wingetclass,class,ahk_id%id%
if class=QWidget
{
 fold2anyFT(id)
}
else
{
;ControlGetFocus,ctrl,ahk_id%id%
;ControlSend,%ctrl%,%fold2any%,ahk_id%id%
send {%fold2any%}
}
sendmode input
return

fold2any400:
sendmode event
If ActOnActiveTable
WinGet, Id, ID, A
else
MousegetPos,,,ID
wingetclass,class,ahk_id%id%
if class=QWidget
{
 fold2anyFT400(id)
}
else
{
;ControlGetFocus,ctrl,ahk_id%id%
;ControlSend,%ctrl%,%fold2any%,ahk_id%id%
send {%fold2any400%}
}
sendmode input
return
;-----------------------------------------------------------------------------------------------------
pot1:
If ActOnActiveTable
WinGet, id, id, A
else
MousegetPos,,,id
if Round1
Roundsb:="smallblind"
else
Roundsb:=0.2
Pot(id,Pot1Pre A_space Pot1Flop A_space Pot1Turn A_space Pot1River, Roundsb, Open1, fix1)
if autobet
raiseFT(id)
return

pot2:
If ActOnActiveTable
WinGet, id, id, A
else
MousegetPos,,,id
if Round2
Roundsb:="smallblind"
else
Roundsb:=0.2
Pot(id,Pot2Pre A_space Pot2Flop A_space Pot2Turn A_space Pot2River, Roundsb, Open2, fix2)
if autobet
raiseFT(id)
return

pot3:
If ActOnActiveTable
WinGet, id, id, A
else
MousegetPos,,,id
if Round3
Roundsb:="smallblind"
else
Roundsb:=0.2
Pot(id,Pot3Pre A_space Pot3Flop A_space Pot3Turn A_space Pot3River, Roundsb, Open3, fix3)
if autobet
raiseFT(id)
return

alt1:
If ActOnActiveTable
WinGet, id, id, A
else
MousegetPos,,,id
if sb1
sb:="sb"
else
sb:=""
AlterAmount(id,"up", incr1, sb)
return

alt2:
If ActOnActiveTable
WinGet, id, id, A
else
MousegetPos,,,id
if sb2
sb:="sb"
else
sb:=""
AlterAmount(id,"down", incr2, sb)
return

alt3:
If ActOnActiveTable
WinGet, id, id, A
else
MousegetPos,,,id
if sb3
sb:="sb"
else
sb:=""
AlterAmount(id,"up", incr3, sb)
return

alt4:
If ActOnActiveTable
WinGet, id, id, A
else
MousegetPos,,,id
if sb4
sb:="sb"
else
sb:=""
AlterAmount(id,"down", incr4, sb)
return
;-----------------------------------------------------------------------------------------------------
BetPot:
GroupAdd, FullTiltTables,Logged In ahk_class QWidget,,,Full Tilt
if autopot
{
isbetboxnew()
}
return
;-----------------------------------------------------------------------------------------------------
IsBetBoxNew()
{
global oldid,PotDefPre,PotDefFlop,PotDefTurn,PotDefRiver,RoundDef,OpenDef,FixDef
winget winid,id,A
betboxX:=0.9687
betboxY:=0.8000
relFTclientpoint(winid,betboxX,betboxY,0)
pixelgetcolor,bet,betboxX,betboxY,ahk_id%winid%
if (winid<>oldid)
{
 if bet=0xffffff
 {
  oldid:=winid
  if RoundDef
  Roundsb:="smallblind"
  else
  Roundsb:=0.2
  Pot(winid,PotDefPre A_space PotDefFlop A_space PotDefTurn A_space PotDefRiver, Roundsb, OpenDef, FixDef)
 }
 else
 oldid=
 }
else
{ 
 if bet!=0xffffff
 oldid=
}
}
return
;-----------------------------------------------------------------------------------------------------
act:
id:=act()
 wingetclass,class,A
wingettitle,title,A
 ifwinnotactive,ahk_id%id%
 if class=QWidget
if (instr(title, "Logged In") & instr(title, "/"))
 winactivate,ahk_id%id%
return

act()
{
winget,list,list, Logged In ahk_class QWidget,,Full Tilt
return list1
}
;-----------------------------------------------------------------------------------------------------
activateundermouse:
activatetableundermouse()
return

activatetableundermouse()
{
    MousegetPos,,,WinID
    WinGetClass, class, ahk_id %WinID%
    WinGetTitle, title, ahk_id %WinID%
    if (class="QWidget")
    winactivate, ahk_id %WinID%
}
return
;-----------------------------------------------------------------------------------------------------
ActivateBottomWindow:
GroupActivate, FullTiltTables
return
;-----------------------------------------------------------------------------------------------------
SitOutNextAll:
;ClickImBack:=false
settimer,Check,off

WinGet, list, List,Logged In ahk_class QWidget,,Full Tilt
Loop, %list%
{
 Z:=list%A_Index%
 WinGetTitle, title, ahk_id%Z%
 StringMid, bb, title, InStr(title, "/") + 1, InStr(title, a_space,"", InStr(title, "/")) - InStr(title, "/") - 1
 StringReplace,bb,bb,$,,1
 if Racetrack
 {
  if bb<4
  {
   sitx:=0.4263
   sity:=0.9264
  }
  else
  {
   sitx:=0.4125
   sity:=0.9345
  }
 }
 else
 {
  if bb<4
  {
   sitx:=0.0031
   sity:=0.7770
  }
  else
  {
   sitx:=0.0031
   sity:=0.7857
  }
 }
 click_x:=sitx+0.0070
 click_y:=sity+0.0070
 WinGetPos,,, W, H, ahk_id %Z%
 if w>1000
 Sittingout:=PixelColorA(0,0,0,sity,sitx,Z,1,15,15)
 else
 Sittingout:=PixelColorA(0,0,0,sity,sitx,Z,1,10,10)
 if !(instr(Sittingout,"-0-")) & !(instr(Sittingout,"1710618"))  ; & !(instr(Sittingout,"16777215"))
 {
  PostClickFT(click_x, click_y, Z, 0) 
 }       
}
return
;-----------------------------------------------------------------------------------------------------
RemoveSitout:
;ClickImBack:=true
if dealmein OR Timebank
settimer,Check,639
if Racetrack
{
sitx:=0.4278
sity:=0.9287
}
else
{
sitx:=0.0031
sity:=0.7770
}
click_x:=sitx+0.0070
click_y:=sity+0.0070
WinGet, list, List,Logged In ahk_class QWidget,,Full Tilt
Loop, %list%
{
 Z:=list%A_Index%
 WinGetPos,,, W, H, ahk_id %Z%
 if w>1000
 Sittingout:=PixelColorA(0,0,0,sity,sitx,Z,1,15,15)
 else
 Sittingout:=PixelColorA(0,0,0,sity,sitx,Z,1,10,10)
; FileAppend, %Sittingout%`n`n, test.txt
 if (instr(Sittingout,"-0-")) || (instr(Sittingout,"1710618"))  ; & !(instr(Sittingout,"16777215"))
  {
  PostClickFT(click_x, click_y, Z, 0) 
 }       
}
return
;-----------------------------------------------------------------------------------------------------
Layout1:
ifwinactive,Logged In ahk_class QWidget,,Full Tilt
WinGet, WinId, ID, A
else
MousegetPos,,,WinID
wingetclass,class,ahk_id %WinID%
wingettitle,title,ahk_id %WinID%
if class=QWidget
if !instr(title,"Full Tilt")
{
CX:=0.8261
CY:=0.0155
wingetpos,x1,y1,w,h,ahk_id%winid%
coordmode,mouse,screen
mousegetpos,x,y
coordmode,mouse,relative
DllCall("SetCursorPos", int, x1+w+10, int, y1+h+10)
PostclickFT(cx,cy,winid,1)
sleep 100
critical,6
send {Tab 7}
sleep,25
Send {Enter}
critical,off
sleep,-1
DllCall("SetCursorPos", int, x, int, y)
}
return
;-----------------------------------------------------------------------------------------------------
Layout2:
ifwinactive,Logged In ahk_class QWidget,,Full Tilt
WinGet, WinId, ID, A
else
MousegetPos,,,WinID
wingetclass,class,ahk_id %WinID%
wingettitle,title,ahk_id %WinID%
if class=QWidget
if !instr(title,"Full Tilt")
{
CX:=0.8261
CY:=0.0155
wingetpos,x1,y1,w,h,ahk_id%winid%
coordmode,mouse,screen
mousegetpos,x,y
coordmode,mouse,relative
DllCall("SetCursorPos", int, x1+w+10, int, y1+h+10)
PostclickFT(cx,cy,winid,1)
sleep 100
critical,6
send {Tab 8}
sleep,25
Send {Enter}
critical,off
sleep,-1
DllCall("SetCursorPos", int, x, int, y)
}
return
;-----------------------------------------------------------------------------------------------------
Layout3:
ifwinactive,Logged In ahk_class QWidget,,Full Tilt
WinGet, WinId, ID, A
else
MousegetPos,,,WinID
wingetclass,class,ahk_id %WinID%
wingettitle,title,ahk_id %WinID%
if class=QWidget
if !instr(title,"Full Tilt")
{
CX:=0.8261
CY:=0.0155
wingetpos,x1,y1,w,h,ahk_id%winid%
coordmode,mouse,screen
mousegetpos,x,y
coordmode,mouse,relative
DllCall("SetCursorPos", int, x1+w+10, int, y1+h+10)
PostclickFT(cx,cy,winid,1)
sleep 100
critical,6
send {Tab 9}
sleep,25
Send {Enter}
critical,off
sleep,-1
DllCall("SetCursorPos", int, x, int, y)
}
return
;-----------------------------------------------------------------------------------------------------
HighLighter:
HighLighter(1)
return

HighLighter(Highlight=1)  ;x_mouse=0.75, y_mouse=0.75 
{
global OldX,OldY,OldW,OldH
global highlighthero,last_table_id
global border_color
global border_size
global trans
global xbord,ybord
global cap

;act()
foldx:=0.6534
foldy:=0.9662
foldx1:=0.5859
foldy1:=0.9662

back_x:=0.6534
back_y:=0.9862
back_x1:=0.5859
back_y1:=0.9862

join_y:=0.9292
join_x:=0.8261

fold1:=0x181818
v:=15
; id:=act()
; wingetclass,class,A
; wingettitle,title,A
; ifwinnotactive,ahk_id%id%
; if class=QWidget
; if (instr(title, "Logged In") & instr(title, "/"))
; winactivate,ahk_id%id%
; winget,id,id,A
ifwinactive, Logged In ahk_class QWidget,,Full Tilt
{  
 winget,id,id,A
 WinGetActiveStats,ActiveTitle, ActiveW, ActiveH, ActiveX, ActiveY
  relFTclientpoint(id,foldx,foldy,0)
  pixelgetcolor,fold,foldx,foldy,ahk_id%id%
  relFTclientpoint(id,foldx1,foldy1,0)
  pixelgetcolor,bacgr,foldx1,foldy1,ahk_id%id%
  relFTclientpoint(id,back_x,back_y,0)
  pixelgetcolor,deal,back_x,back_y,ahk_id%id%
  relFTclientpoint(id,back_x1,back_y1,0)
  pixelgetcolor,deal1,back_x1,back_y1,ahk_id%id%
 ; relFTclientpoint(id,join_x,join_y,0)
 ; pixelgetcolor,join,join_x,join_y,ahk_id%id%

 if (id != last_table_id) || ((OldX <> ActiveX || OldY <> ActiveY || OldW <> ActiveW || OldH <> ActiveH))    
 {
  OldX := ActiveX
  OldY := ActiveY
  OldW := ActiveW
  OldH := ActiveH
  mouse_last:=last_table_id
  last_table_id := id  
  if(!id)
  {
   Gui, 2: Cancel
   Gui, 3: Cancel
   Gui, 4: Cancel
   Gui, 5: Cancel
   return
  }  
  WinGetPos, x, y, w, h, ahk_id%id%
  x := x + xbord
  y := y + xbord + cap
  w := w - (2*xbord)
  h := h - (2*xbord) - cap
 
  ;Makes Border around urgent table
;  if ( Highlight = 1 )
  if (highlighthero=0) || ((highlighthero=1) & (comparecolors(fold,bacgr,v)=0) & (comparecolors(fold,fold1,v)=0) & (comparecolors(deal,deal1,v)=1))  ; & (comparecolors(join,deal1,v)=1))
  { 
   ;top
   guinum := 2
   Gui, %guinum%: +Alwaysontop +Lastfound +Owner
   Gui, %guinum%: Color, %border_color%
   WinSet, Transparent, %trans%
   Gui, %guinum%: -Caption
   Gui, %guinum%: Show, w%w% h%border_size% x%x% y%y% NoActivate    
   ;left
   guinum++
   Gui, %guinum%: +Alwaysontop +Lastfound +Owner
   Gui, %guinum%: Color, %border_color%
   WinSet, Transparent, %trans%
   Gui, %guinum%: -Caption
   Gui, %guinum%: Show, w%border_size% h%h% x%x% y%y% NoActivate    
   ;bottom
   guinum++
   Gui, %guinum%: +Alwaysontop +Lastfound +Owner
   Gui, %guinum%: Color, %border_color%
   WinSet, Transparent, %trans%
   Gui, %guinum%: -Caption
   y2 := y + h - border_size
   Gui, %guinum%: Show, w%w% h%border_size% x%x% y%y2% NoActivate    
   ;right
   guinum++
   Gui, %guinum%: +Alwaysontop +Lastfound +Owner
   Gui, %guinum%: Color, %border_color%
   WinSet, Transparent, %trans%
   Gui, %guinum%: -Caption
   x2 := x + w - border_size
   Gui, %guinum%: Show, w%border_size% h%h% x%x2% y%y% NoActivate  
  }
  else 
  if highlighthero=1
 ; if comparecolors(fold,bacgr,v)=1
 ; {
 ;  Gui, 2: Cancel
 ;  Gui, 3: Cancel
 ;  Gui, 4: Cancel
 ;  Gui, 5: Cancel
   last_table_id=
 ; }          
 }
 else
 if highlighthero=1
 if comparecolors(fold,bacgr,v)=1
 {
  Gui, 2: Cancel
  Gui, 3: Cancel
  Gui, 4: Cancel
  Gui, 5: Cancel
  last_table_id=
 }
}
else
{
   Gui, 2: Cancel
   Gui, 3: Cancel
   Gui, 4: Cancel
   Gui, 5: Cancel
   last_table_id=
}
}
return
;-----------------------------------------------------------------------------------------------------
MouseMove:
MoveMouse()
return

MoveMouse(x_mouse=0.7468, y_mouse=0.8735)
{
if IsWindowNew()
{ 
wingetclass,class,A
wingetactivetitle,title
if class=QWidget 
if !instr(title,"Full Tilt") 
{
 winget,id,id,A
 relFTClientPoint(id, x_mouse, y_mouse,0,1)
 DllCall("SetCursorPos", int, x_mouse, int, y_mouse)
}  
}
}
return
;-----------------------------------------------------------------------------------------------------
IsWindowNew()
{
global oldwinid,stealfocus
winget,id,id,A
wingetclass,class,ahk_id%oldwinid%
if id!=%oldwinid%
{
 oldwinid:=id
 if stealfocus
 return 1
 else
 {
  if class=QWidget
  return 1
  else
  return 0
 }
}
else
return 0
}
;-----------------------------------------------------------------------------------------------------
Colorinit:
if once
Colorinit()
return

Colorinit()
{
local id,t,col,v1
v1:=15
id:=WinExist("Logged In ahk_class QWidget","","Full Tilt")
if id
{
once:=false
settimer,Colorinit,off
t:=PixelColorA(time_x,time_y,time_x1,time_y,join_x,id)
stringsplit,col,t,-
if (CompareColors(col1,col2,v1)=false)
{
t2:=col2
once:=true
settimer,Colorinit,87
}
else
t2:=col1
t:=PixelColorA(back_x,back_y,back_x1,back_y,join_x,id)
stringsplit,col,t,-
if (CompareColors(col1,col2,v1)=false)
{
back2:=col2
once:=true
settimer,Colorinit,87
}
else
back2:=col1
}
}
return
;-----------------------------------------------------------------------------------------------------
check:
check()
return

check()
{
local listft,id,t,col
winget,listft,list,Logged In ahk_class QWidget,,Full Tilt
loop %listft%
{
id:=listft%A_index%
t:=PixelColorA(time_x,time_y,back_x,back_y,join_x,id)
stringsplit,col,t,-
if (CompareColors(col1,t1,v)=false) & (CompareColors(col1,t2,v)=false)
{
if !InStr(tablequeue,id)
movetolist(id,A_TickCount)
}
else
if InStr(tablequeue,id)
removefromlist(id)
if dealmein
if (CompareColors(col2,back1,v1)=false) & (CompareColors(col2,back2,v1)=false) & (CompareColors(col3,back2,v)=true)
PostclickFT(back_x,back_y,id,0)
}
}
return
;-----------------------------------------------------------------------------------------------------
relFTClientPoint(id, ByRef x, ByRef y, client=1, screen=0)
{
global xbord,ybord,cap
WinGetPos,x1,y1,w,h,ahk_id%id%
w-=2*xbord
h-=(2*ybord)+cap
x:=floor(W*x)
y:=floor(H*y)
if !client
{
x+=xbord
y+=ybord+cap
}
if screen
{
x+=x1
y+=y1
}
}
return
;-----------------------------------------------------------------------------------------------------
PostLeftDoubleClick(x, y, table_id, activate=1) {
; ### Max1mums: Send the double left click, then the mouse-up messages,
; some windows can get activated on the down left click so we will use
; left doubleclick instead, don't use on objects which have any functions
; binded to doubleclick unless you want to make doubleclick on them
; NOTE: This is relative to the top left of the client area and NOT the top left of the
;       window (ie: It *doesn't* include the title-bar like AHK's MouseClick does!!!).
If activate
 WinActivate, ahk_id%table_id%
critical,6
PostMessage, 0x203 , 0, ((y<<16)^x), , ahk_id%table_id% ; without 0x001 as lparam which is Lbutton down
PostMessage, 0x202 , 0, ((y<<16)^x), , ahk_id%table_id%
PostMessage, 0x202 , 0, ((y<<16)^x), , ahk_id%table_id%
critical,off
sleep,-1
}
return
;-----------------------------------------------------------------------------------------------------
PostclickFT(x,y,winid,activate=1,client=1)
{
relFTClientPoint(winid, x, y,client)
DllCall("SetCapture","Uint",winid)
PostLeftDoubleClick(x, y, winid, activate)
DllCall("ReleaseCapture")
}
return
;-----------------------------------------------------------------------------------------------------
clickwithdelay:
Loop, Parse, tablequeue, `,
{
interval:=interval1*1000
stringsplit,tab,A_loopfield,-
if abs(tab2-A_TickCount)>interval
{
PostclickFT(time_x,time_y,tab1,0)
listDelItem(tablequeue, A_Loopfield) 
}
}
return
;-----------------------------------------------------------------------------------------------------
PixelColorA(colx,coly,backx,backy,joinx,id,region=0,regionw=70,regionh=15)
{
global boost,xbord,ybord,cap
if boost
critical,6
setwindelay, -1
hdc_frame := DllCall( "GetDC", "UInt", id )
hdc_buffer := DllCall("gdi32.dll\CreateCompatibleDC", "UInt",  hdc_frame)
WinGetPos,,,W,H,ahk_id %id%
hbm_buffer := DllCall("gdi32.dll\CreateCompatibleBitmap", "UInt",hdc_frame, "Int",w, "Int",h)
DllCall( "gdi32.dll\SelectObject", "UInt",hdc_buffer, "UInt",hbm_buffer)
DllCall( "PrintWindow", "UInt" , id , "UInt" , hdc_buffer , "UInt" , 0 )
DllCall("RedrawWindow","UInt",id,"UInt",0,"UInt",0,"UInt", 1|16|32|64|1024) 
x:=floor(((W-2*xbord)*colx) + xbord)
y:=floor(((H-(2*ybord)-cap)*coly) + ybord + cap)
pix1=
pix1 := DllCall("GetPixel", "UInt", hdc_buffer, "Int", x, "Int", y) 
x:=floor(((W-2*xbord)*backx) + xbord)
y:=floor(((H-(2*ybord)-cap)*backy) + ybord + cap)
pix2:=DllCall("GetPixel", "UInt", hdc_buffer, "Int", x, "Int", y) 
x:=floor(((W-2*xbord)*joinx) + xbord)
pix3:=DllCall("GetPixel", "UInt", hdc_buffer, "Int", x, "Int", y) 
SetFormat, IntegerFast, hex
pix1 += 0
pix1 .= ""
pix2 += 0
pix2 .= ""
pix3 += 0
pix3 .= ""
SetFormat, IntegerFast, d
pix1.="-" . pix2 . "-" . pix3
if region
{
x:=floor(((W-2*xbord)*joinx) + xbord)
y:=floor(((H-(2*ybord)-cap)*backy) + ybord + cap)
pix1.="*"
loop %regionw%
{
delta:=A_index
loop %regionh%
{
delta1:=A_index
p := DllCall("GetPixel", "UInt", hdc_buffer, "Int", x+delta , "Int", y+delta1)
;p1:=p
;SetFormat, IntegerFast, hex
;p += 0
;p .= ""
;SetFormat, IntegerFast, d
;pix1.=p . "*" . p1 . "-"
pix1.=p . "-"
}
}
}
sleep,1
DllCall( "gdi32.dll\DeleteObject", "Uint", hbm_buffer )
DllCall( "gdi32.dll\ReleaseDC", "Uint", hdc_frame )
DllCall( "gdi32.dll\DeleteDC", "Uint", hdc_frame )
DllCall( "gdi32.dll\ReleaseDC", "Uint", hdc_buffer )
DllCall( "gdi32.dll\DeleteDC", "Uint", hdc_buffer )
if boost
{
critical,off
sleep,-1
}
return pix1
}
;-----------------------------------------------------------------------------------------------------
CompareColors(ByRef bgr1, ByRef bgr2, ByRef variation) {
	c1 := bgr1 & 0xff
	c2 := bgr2 & 0xff
	if (abs(c1 - c2) > variation)
		return false
	c1 := (bgr1 >> 8) & 0xff
	c2 := (bgr2 >> 8) & 0xff
	if (abs(c1 - c2) > variation)
		return false
	c1 := (bgr1 >> 16) & 0xff
	c2 := (bgr2 >> 16) & 0xff
	if (abs(c1 - c2) > variation)
		return false
	return true
}
;-----------------------------------------------------------------------------------------------------
listAdd( byRef list, item, del="," ) {
  list:=( list!="" ? ( list . del . item ) : item )
  return list
}
;-----------------------------------------------------------------------------------------------------
listDelItem( byRef list, item, del=",") {
  ifEqual, item,, return list
  list:=del . list . del
  StringReplace, list, list, %item%%del%
  StringTrimLeft, list, list, 1
  StringTrimRight, list, list, 1
  return list
}
;-----------------------------------------------------------------------------------------------------
movetolist(winid,time)
{
global tablequeue
listAdd(tablequeue, winid . "-" . time)
}
return
;-----------------------------------------------------------------------------------------------------
removefromlist(winid)
{
global tablequeue
Loop, Parse, tablequeue, `,
{
if InStr(A_loopfield,winid)
listDelItem(tablequeue, A_Loopfield)
}
}
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
}
;-----------------------------------------------------------------------------------------------------
register:
ifwinactive, ahk_class QWidget
{
winget,id,id, A
wingettitle,title,ahk_id%id%
if instr(title,"Full Tilt Poker -")
{
reg_x :=0.9080
reg_y :=0.7357
PostclickFT(reg_x,reg_y,id,0)
winwait,Tournament Buy-in ahk_class QWidget,,4
if !errorlevel
{
sleep,50
winget,id,id,Tournament Buy-in ahk_class QWidget
wingetpos,,,,h,ahk_id%id%
reg_x :=0.3608
if h<240
reg_y :=0.4876
else
reg_y :=0.4193
PostclickFT(reg_x,reg_y,id,0)
ifwinExist,Full Tilt Poker - Tournament ahk_class QWidget
winclose,Full Tilt Poker - Tournament ahk_class QWidget
}
}
}
return
;-----------------------------------------------------------------------------------------------------
unregister:
ifwinactive, ahk_class QWidget
{
winget,id,id, A
wingettitle,title,ahk_id%id%
if instr(title,"Full Tilt Poker -")
{
reg_x:=0.9080
reg_y:=0.6709
PostclickFT(reg_x,reg_y,id,0)
winwait,Full Tilt Poker - Tournament ahk_class QWidget,,4
if not errorlevel
{
winget,id,id, Full Tilt Poker - Tournament ahk_class QWidget
reg_x :=0.8876
reg_y :=0.0776
PostclickFT(reg_x,reg_y,id,0)
winwait,Tournament Buy-in ahk_class QWidget,,0.5
if not errorlevel
{
winclose,Tournament Buy-in ahk_class QWidget
ifwinexist, Full Tilt Poker - Tournament ahk_class QWidget
winclose, Full Tilt Poker - Tournament ahk_class QWidget
}
else
{
settitlematchmode,3
winwait, Full Tilt Poker ahk_class QWidget,,4
if not errorlevel
winclose,Full Tilt Poker ahk_class QWidget
settitlematchmode,2
ifwinexist, Full Tilt Poker - Tournament ahk_class QWidget
winclose, Full Tilt Poker - Tournament ahk_class QWidget
}
}
}
}
return
;-----------------------------------------------------------------------------------------------------
Toggledealmein:
If (dealmein=true) {
	dealmein:=false
	T=Off
}
else {
	dealmein:=true
	T=On
}
Gui, 12:Add, Text,, Auto Deal me in: %T%
Gui, 12:+ToolWindow
Gui, 12:Show, w150 h20
Sleep, 1000
Gui, 12:Destroy
return
;-----------------------------------------------------------------------------------------------------
Joinwaitlist:
winget,listft,list,Logged In ahk_class QWidget,,Full Tilt
loop %listft%
{
id:=listft%A_index%
t:=PixelColorA(join_x,back_y,back_x,join_y,join_x1,id,1)
stringsplit,st,t,*
stringsplit,col,st1,-
if (CompareColors(col1,back1,v1)=false) & (CompareColors(col1,back2,v1)=false)
if !instr(st2,"16777215") & !instr(st2,"67284200") & !instr(st2,"111670350") & !instr(st2,"148766710")
PostclickFT(back_x,back_y,id,0)
}
return
;-----------------------------------------------------------------------------------------------------
Unjoinwaitlist:
winget,listft,list,Logged In ahk_class QWidget,,Full Tilt
loop %listft%
{
id:=listft%A_index%
t:=PixelColorA(join_x,back_y,join_x1,join_y,join_x1,id,1)
stringsplit,st,t,*
stringsplit,col,st1,-
if (CompareColors(col1,back1,v1)=false) & (CompareColors(col1,back2,v1)=false)
if instr(st2,"16777215")  or instr(st2,"67284200") or instr(st2,"111670350") or instr(st2,"148766710")
PostclickFT(back_x,back_y,id,0)
}
return
;-----------------------------------------------------------------------------------------------------
AlterAmount(id, dir="", frac=1, unit="")
{
  WinGetTitle, title, ahk_id%id%
  amount := 0
  StringTrimRight, tablename, title, ( StrLen(title) - (InStr(title, " - ")-1) )
  IfWinExist, ahk_id%id% ahk_group FullTiltTables
  {
    StringMid, bb, title, InStr(title, "/") + 1, InStr(title, a_space,"", InStr(title, "/")) - InStr(title, "/") - 1
  }   
  StringReplace,bb,bb,$,,1
  StringReplace,bb,bb,Ј,,1
  StringReplace,bb,bb,Ђ,,1
  StringReplace,bb,bb,€,,1 

 ; bb++
 ; bb--
  sb := sb(bb)
;listvars
  If (unit = "" or unit = "bb")
  {
    unit := bb
  }
  Else If (unit = "sb")
  {
    unit := sb
  }
  Else If (unit = "pot")
  {
    pot := 0
    call := 0
    hero_bet := 0
    street := "pre"
    hero_position := ""
    open := 0
    max := 10000000
    IfWinExist, ahk_id%id% ahk_group FullTiltTables
    {
        PotSizeFullTilt2(id, pot, call, sb, bb, hero_bet, street, hero_position, open, max)
    }
    pot := ((pot + call + hero_bet) )+ call
    unit := pot
  }
  amount := unit * frac
  if (dir="down")
  {
    amount := amount - (2*amount)
  }
  a:=floor(amount)
  if amount-a=0
  amount:=a
  
  IfWinExist, ahk_id%id% ahk_group FullTiltTables
  {
      oldClipboard = %clipboard%
      clipboard =
      PostStarsClick(767, 440, id)
      Send ^a
      Send ^c
      ClipWait, 0.3
      If !ErrorLevel
      t := clipboard
      clipboard = %oldClipBoard%
      t := t + amount
      if (t < 0)
      {
        t := 0
      }
    t2 := Round(t, 0)
    t1 := Round(t, 2)
    t := Round(t, 3)
    if t-t1=0
    t:=t1
    if t-t2=0
    t:=t2
      PostStarsClick(767, 440, id)
      Send ^a
      Send %t%
  }
}

Pot(id, frac=1, round_bet=0.2, open_adjust="", fixblinds=0)
{
  global debug
  global attempts

  if attempts<=0
  attempts:=1
  pot := 0
  call := 0
  sb := 0
  bb := 0
  hero_bet := 0
  street := ""
  hero_position := ""
  open := 1
  max := 10000000

  IfWinExist, ahk_id%id% ahk_group FullTiltTables
  {
    loop %attempts%
    {
     PotSizeFullTilt2(id, pot, call, sb, bb, hero_bet, street, hero_position, open, max)
     if pot>0
     break
     sleep,20 
    }
    }
  Else
  {
    return
  }
 
  StringSplit, fr, frac, %A_SPACE%
  if (fr0 < 4)
  {
    times := 4 - fr0
    Loop, %times%
    {
      n := 5 - A_Index
      fr%n% := fr%fr0% 
    }
  }
  
  if (street = "pre")
  {
    frac:= Round(fr1/100,2)
  }
  else if (street = "flop")
  {
    frac:= Round(fr2/100,2)
  }
  else if (street = "turn")
  {
    frac:= Round(fr3/100,2)
  }
  else if (street = "river")
  {
    frac:= Round(fr4/100,2)
  }
  if (debug)
  {
    TrayTip, BetPot, Pot:`t`t%pot%`nCall:`t`t%call%`nHero_bet:`t%hero_bet%`n`nPosition:`t%hero_position%`n`nBlinds:`t$%sb%/$%bb%`n`nStreet:`t%street%`n`n%fr0%`n%fr1% %fr2% %fr3% %fr4%`n`n%frac%,10,17
  }
   ; listvars
  if (fixblinds AND open AND street="pre")
  {
    if (hero_position = "sb" )
    {
      pot := pot - sb
      call := call + sb
    }
    else if (hero_position = "bb")
    {
      pot := pot - bb
      call := call + bb
    }
  }

  pot := ((pot + call + hero_bet)* (frac)) + call  

  if (open=1 AND open_adjust="ssnl" )
  {
    pot := pot + bb - sb
  }
  else if (open=1 AND open_adjust="trny" )
  {
    pot := pot - bb
  }
  else if (open=1 AND open_adjust="mix" )
  {
    if (bb=2)
    {
      pot := pot + bb - sb
    }
  ;  pot := pot + bb + sb
  }
  
  if(round_bet = "smallblind")
  {
   ; if sb<1
    pot := Round((Floor((pot / sb)) * sb),2)
   ; else
   ; pot := Round((Floor((pot / sb)) * sb),0)
  }
  else if(round_bet = "bigblind")
  {
    pot := Round((Floor((pot / bb)) * bb),2)
  }
  else if (round_bet < 1)
  {
    places := round_bet*10
    pot := Round(pot, (places))
  }
  else if (round_bet >= 1)
  {
    pot := Floor(pot / round_bet) * round_bet
  }
 
  p:=floor(pot)
  if pot-p=0
  pot:=p
    
  IfWinExist, ahk_id%id% ahk_group FullTiltTables
  {
    PostStarsClick(767, 440, id)
    Send ^a
    Send %pot%
  }
}

PotSizeFullTilt2(id, ByRef pot, ByRef call, ByRef sb, ByRef bb, ByRef hero_bet, ByRef street, ByRef hero_position, ByRef open, ByRef max)
{
  global deduct_rake,Racetrack
  rake := 0
  notraked := 0
  maxrake := 3
  max := 7654321
  
  
  WinGetTitle, title, ahk_id%id%
  StringMid, bb, title, InStr(title, "/") + 1, InStr(title, a_space,"", InStr(title, "/")) - InStr(title, "/") - 1
  StringReplace,bb,bb,$,,1
  sb := sb(bb)
  
TotalPotDigitsPosX=393
TotalPotDigitsPosY=277
if Racetrack
{
MainPotDigitsPosX=334
MainPotDigitsPosY=183
}
else
{
MainPotDigitsPosX=285
MainPotDigitsPosY=335
}
;PotDigitsPos6X=338
;PotDigitsPos6Y=340
PotDigitsPosW=80
PotDigitsPosH=14
 

pot:=DigitSearchByPixelCount(TotalPotDigitsPosX,TotalPotDigitsPosY,PotDigitsPosW,PotDigitsPosH,Id)
if pot is not number
pot:=DigitSearchByPixelCount(MainPotDigitsPosX,MainPotDigitsPosY,PotDigitsPosW,PotDigitsPosH,Id)

;oldClipboard=%clipboard%
oldClipboard:=clipboard
 clipboard =
PostStarsClick(707, 418, id) ;hit min
PostStarsClick(707, 418, id) ;hit min
PostStarsClick(707, 418, id) ;hit min
;PostStarsClick(707, 418, id) ;hit min
;PostStarsClick(707, 418, id) ;hit min
;PostStarsClick(707, 418, id) ;hit min
PostStarsClick(767, 440, id)

min := sb
Send ^a
Send ^c
ClipWait, 0.3
If !ErrorLevel
 {
  min := clipboard
  clipboard = %oldClipBoard%
 }
 else
 {
 min := 2*bb 
 }
   
  street := "pre" 
  street := GetStreetFT(id)
   
  if (min = bb)
  {
    call := 0
  }
  else if (min > bb)
  {
    call := min / 2
  }
  else if (street != "pre")
  {
    call := bb
  }
  
    call2 := Round(call, 0)
    call1 := Round(call, 2)
    call := Round(call, 3)
    if call-call1=0
    call:=call1
    if call-call2=0
    call:=call2

  if (call != bb || street != "pre")
  {
    open := 0
  }
 pot := Round((Floor((pot / sb)) * sb),2) 
 ;pot := pot - (2 * call)

if call is not number
call:=0
if hero_bet is not number
hero_bet:=0 
return
}

GetStreetFT(id)
{
  CoordMode, Pixel, Screen

  street := "pre"
  
  x1 := 485
  y1 := 214
  x2 := 520
  y2 := 260
  relStarsScreenPoint(id, x1, y1)
  relStarsScreenPoint(id, x2, y2)
  
  If ( GetPixelCount(x1, y1, x2, y2, 0xffffff) > 5 )
  {
    street := "river"
    return street
  }
  
  x1 := 431
  y1 := 214
  x2 := 461
  y2 := 260
  relStarsScreenPoint(id, x1, y1)
  relStarsScreenPoint(id, x2, y2)

  If ( GetPixelCount(x1, y1, x2, y2, 0xffffff) > 5 )
  {
    street := "turn"
    return street
  }

  x1 := 378
  y1 := 214
  x2 := 414
  y2 := 260
  relStarsScreenPoint(id, x1, y1)
  relStarsScreenPoint(id, x2, y2)

  If ( GetPixelCount(x1, y1, x2, y2, 0xffffff) > 5 )
  {
    street := "flop"
    return street
  }
  return street
}

; finds number of specified pixels in a region
GetPixelCount(x1, y1, x2, y2, color, options="")
{
  CoordMode, Pixel, Screen
  pixels := (x2 - x1 + 1)*(y2 - y1 + 1)
  If ( pixels <= 0 )
  {
    ErrorLevel = 1
    return
  }
  count = 0
  x = %x1%
  Loop
  {
    If ( x > x2 )
    {
      break
    }
    y = %y1%
    Loop
    {
      If ( y > y2 )
      {
        break
      }
      PixelGetColor, c, x, y, %options%
      If ( c = color )
      {
        count++
      }
      y++
    }
    x++
  }
  return count
}

sb(bb) {
If bb = .25
 sb := .10
else if bb = 15
 sb = 10
else if bb = 0.05
 sb = 0.02
else
 sb := bb/2
if (sb > 1)
{
  sb := Round(sb, 0)
}
else
{
  sb := Round(sb, 2)
}
return sb
}

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

StrMid(str,str1,str2,startPos1=1,startPos2=1,caseSense=0){
If startPos1 =
 startPos1 = 1
If startPos2 =
 startPos2 = 1
StringTrimLeft,o,str,InStr(str,str1,cS,startPos1) + StrLen(str1) - 1
StringLeft,o,o,InStr(o,str2,caseSense,startPos2)-1
return o
}

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

relStarsClientPoint(id, ByRef x, ByRef y)
{
  global border
  global caption
  rw := 792
  rh := 546
  WinGetPos, , , w, h, ahk_id%id%
  w := w - (2*border)
  h := h - (2*border) - caption
  
  x := Floor( (x / rw ) * w )
  y := Floor( (y / rh) * h  )
  
}

relStarsWindowPoint(id, ByRef x, ByRef y)
{
  global border
  global caption
  relStarsClientPoint(id, x, y)
  x := x + border
  y := y + border + caption
}

relStarsScreenPoint(id, ByRef x, ByRef y)
{
  relStarsWindowPoint(id, x, y)
  WinGetPos, x1, y1, , , ahk_id%id%
  x += x1
  y += y1
}


reverse_calc_stars_client_area(cw, ByRef w, ByRef h)
{
  global border
  global caption
  w := cw + (2*border) 
  h := Floor(cw / 1.45) + (2*border) + caption
}

client_area(id, ByRef x, Byref y, ByRef w, Byref h)
{
  WinGetPos, x, y, w, h, ahk_id%id%
  global border
  global caption
  x := x + border
  y := y + border + caption
  w := w - (2*border)
  h := h - (2*border) - caption
  return
}

PostStarsClick(x, y, id)
{
  relStarsClientPoint(id, x, y)
;listvars
  PostLeftClick(x, y, id)
}

PostLeftClick(x, y, table_id, activate=1) {
; ### JUK: Send the down left click, then the mouse-up messages.
; NOTE: This is relative to the top left of the client area and NOT the top left of the
;       window (ie: It *doesn't* include the title-bar like AHK's MouseClick does!!!).
If activate
 WinActivate, ahk_id%table_id%
PostMessage, 0x201, 0x0001, ((y<<16)^x), , ahk_id%table_id%
PostMessage, 0x202 , 0, ((y<<16)^x), , ahk_id%table_id%
}


;;;;;;;;;;;;;;;;;;;;PixelCount function source taken from PokerShortCuts;;;;;;;;;;;;;;;;;;;;;

/*
DigitsByPixelCountGetValue()
   Purpose: This function looks for digits by counting pixels in each column of a digit and tries to find a match for those counts
               when a column of 0 pixels is found. we search the client area xywh
   Returns:
      DigitString - the numbers found
         A for All In
         S for Sitting Out
         "" if no digits found
   Parameters:
      X - x poistion in standard client area to search for digits
      Y - y "
      W - standardized width of search area
      H - standardized height of search area
      DigitsType - e.g. Bet, Stack or Pot. This var is used to get the colors and tolerances from the global variables
      ByRef PixelCountForAllDigitsStringReturned: for test purposes... this is the long pixel count string
      WinId: window id

Notes:
      1. I was having problems with the alternate color not reading the digits correctly on FT. This is black digits on white background.
      There sometimes seems to be a black pixel in the area below the stack numbers, and this would cause one of the columns to read incorrectly.
      To fix it, I had to reduce the Height parameter that it was checking from 15 down to 12. This seems to be reliable for all table sizes.

      2. Full Tilt on small tables does not have a blank row of pixels above the stack digits if the user's name has a decender character in it.
      I had to change the software to allow for a few pixels in this row for it to be considered a blank row. I suppose this could be a problem if
      the user only has a stack size of 1, in which case the blank row at the top would be intrepreted as the stack digit with on (since it might only have 1 pixel in the row.)
      The "y" has one pixel that is right above the stack numbers, and the "g" character has 2 pixels...  so we will allow for 2 pixels in the row.
      If the user's name has more than 2 pixels in the decenders, then this code won't work at the smallest of table sizes (need a table size that puts in a blank row of pixels.)

      3. On small full tilt tables, you can't position the initial starting position too far to the left, else the software doesn't read the stack size correctly.
      I have found that just to the left of the "Sitting Out" words is about right. for some reason it picks up a number of decimal point characters if
      X is too far to the left.

      4. At the larger table sizes, Stars tables go to a stack font that is not one solid color. It has the shading of the digits.
      But it does have one dominant color, and that is what I use to do the pixel count with. The color variation seems to be at
      least 10 for the other colors. So I captured the pixel counts setting the color variation to 1.
      This should work, unless there are some computers that show the color with more variation. I know that my alternate sony
      laptop has doesn't show the colors the same as my main sony laptop. So we need some color variation in there. So I'll try setting the variation
      to about 5.
      It may be that if this doesn't work, then we'll just have to tell users that have too much color variation in their font digits,
      that they can't use the larger table sizes on stars.

      5. One good testing method is to outputdebug the Y paramater to let you know if the software is finding the blank line above the digits.
      Also, output the digitstring and alternate and pixel count strings at the end of this function.
      In the debug, you can use a mouse position to look for the digit characters.


*/
DigitSearchByPixelCount(X,Y,W,H,WinId)
{  
DigitsColor=0xFFFFFF
DigitsColorTolerance=0

FTMinimumPixelCountPerColumn := 2               ; when counting pixels in a column, this is the minimum number to be a valid column (else it is a spacer column)
FTMaximumAllowedNumPixelsInRowToBeBlank:=2                                                   ; FT has some columns with one pixel in them next to a decimal point that we need to say these are spacer columns.
                                                   ;    Like the 4 digit has one column on the right with one pixel, and this will be right next to the decimal point.
                                                ;    Fortunately the decimal point has 2 pixels in it, so that it can be detected as a dp.

   ; FT Pixel Count Digits for table (client width) 472-563
   PixelCountDigits52254 := 0
   PixelCountDigits276 := 1
   PixelCountDigits35335 := 2
   PixelCountDigits33335 := 2
   PixelCountDigits23344 := 3
   PixelCountDigits22276 := 4
   PixelCountDigits53335 := 5
   PixelCountDigits53321 := 6
   PixelCountDigits23321 := 7
   PixelCountDigits43344 := 8
   PixelCountDigits23354 := 9
   PixelCountDigits21 := "."
   PixelCountDigits3333332 := "A"
   PixelCountDigits333335 := "S"


   ; FT Pixel Count Digits for table (client width) 564-682
   PixelCountDigits622265 := 0
   PixelCountDigits287 := 1
   PixelCountDigits333336 := 2
   PixelCountDigits223355 := 3
   PixelCountDigits22287 := 4
   PixelCountDigits533346 := 5
   PixelCountDigits533332 := 6
   PixelCountDigits33321 := 7
   PixelCountDigits533355 := 8
   PixelCountDigits333354 := 9
   PixelCountDigits21 := "."
   PixelCountDigits3433432 := "A"
   PixelCountDigits333346 := "S"

   ; FT Pixel Count Digits for table (client width) 683-841
   PixelCountDigits6822865 := 0
   PixelCountDigits2887 := 1
   PixelCountDigits3544536 := 2
   PixelCountDigits2433855 := 3
   PixelCountDigits222787 := 4
   PixelCountDigits653646 := 5
   PixelCountDigits6833632 := 6
   PixelCountDigits47521 := 7
   PixelCountDigits5833855 := 8
   PixelCountDigits3633865 := 9
   PixelCountDigits221 := "."
   PixelCountDigits36636632 := "A"
   PixelCountDigits4644646 := "S"

   ; FT Pixel Count Special situation below 842-881 - looks like only the 2 digit is different here
   PixelCountDigits23444647 := 2

   ; FT Pixel Count Digits for table (client width) 842-960
   PixelCountDigits79222976 := 0
   PixelCountDigits22998 := 1
   PixelCountDigits33444647 := 2

   PixelCountDigits22333966 := 3
   PixelCountDigits2222998 := 4
   PixelCountDigits5533757 := 5
   PixelCountDigits68433743 := 6
   PixelCountDigits465421 := 7
   PixelCountDigits69333966 := 8
   PixelCountDigits47334865 := 9
   PixelCountDigits221 := "."
   PixelCountDigits2555355521 := "A"
   PixelCountDigits56333656 := "S"

   ; FT Pixel Count Digits for table (client width) 961-1040
   PixelCountDigits684224865 := 0
   PixelCountDigits22AA9 := 1
   PixelCountDigits354435647 := 2
   PixelCountDigits463337735 := 3
   PixelCountDigits22222AA9 := 4
   PixelCountDigits275335647 := 5
   PixelCountDigits685335632 := 6
   PixelCountDigits3555421 := 7
   PixelCountDigits7A3333A77 := 8
   PixelCountDigits365335865 := 9
   PixelCountDigits332 := "."
   PixelCountDigits3556365532 := "A"
   PixelCountDigits475445746 := "S"

   ; FT Pixel Count Digits for table (client width) 1041-1119
   PixelCountDigits8A42224A87 := 0
   PixelCountDigits22CCB := 1
   PixelCountDigits3544445649 := 2
   PixelCountDigits4623337957 := 3
   PixelCountDigits222222CCB := 4
   PixelCountDigits2863335759 := 5
   PixelCountDigits7954335743 := 6
   PixelCountDigits35555421 := 7
   PixelCountDigits5973337957 := 8
   PixelCountDigits4753345976 := 9
   PixelCountDigits332 := "."
   PixelCountDigits355653565532 := "A"
   PixelCountDigits5864446858 := "S"


   coordmode, pixel, Screen
   WindowScaledPos(X, Y, ClientScaleFactor, "Screen", WinId)
   W := Round(W * ClientScaleFactor)
   H := Round(H * ClientScaleFactor)
   PixelGetColor, ColorRGB,X,Y,RGB
      CheckPrimaryColorFlag := 1
      CheckAlternateColorFlag := 0
   Y += Round(H/2)
   TopRowFound := 0
   loop, % Round(H)
   {
      Xpos := X
      PixelCountInRow := 0
      ScanWidth := Round(W*3/4)
      loop,% ScanWidth
      {
         Xpos += 1
         PixelGetColor, ColorRGB,Xpos,Y,RGB
         if (CheckPrimaryColorFlag AND (ColorWithinTolerance(ColorRGB, DigitsColor, DigitsColorTolerance)))
         {
            PixelCountInRow++
            if (PixelCountInRow > FTMaximumAllowedNumPixelsInRowToBeBlank)
               break
         }
      } 
      if (Xpos == (X + ScanWidth))
      {
         TopRowFound := 1
         Y += 1                  ; move back down to the top row of the font
         break
      }
      Y -= 1
   } 
   if NOT TopRowFound
   {
      return ""
   }
   DigitString:=""
   PixelCountForAllDigitsString := ""
   PixelCountForThisDigitString := ""
   loop, %W%
   {
      ColumnNum:= A_Index
      PixelCountInColumn:=0
      FirstPixelPosition := 0
      LastPixelPosition := 0
      loop, %H%
      {
         RowNum:=A_Index
         PixelGetColor, ColorRGB,X+ColumnNum-1,Y+RowNum-1,RGB

         if (ColorWithinTolerance(ColorRGB, DigitsColor, DigitsColorTolerance))
         {
            if (!FirstPixelPosition)
               FirstPixelPosition := RowNum
            LastPixelPosition := RowNum
            PixelCountInColumn++
         }
      }
      if (PixelCountInColumn >= FTMinimumPixelCountPerColumn)
      {
         LastMinusFirstPixelPosition := LastPixelPosition  - FirstPixelPosition
         if (PixelCountInColumn > 9)
         {
            PixelCountInColumn := chr(64 + PixelCountInColumn - 9)
         }
         if PixelCountInColumn is alnum
            PixelCountForThisDigitString .= PixelCountInColumn
      }
      else
      {
         if (PixelCountForThisDigitString != "")
         {

            if (LastMinusFirstPixelPosition > 9)
               LastMinusFirstPixelPosition := chr(64 + LastMinusFirstPixelPosition - 9)
            if LastMinusFirstPixelPosition is alnum
               PixelCountForThisDigitString .= LastMinusFirstPixelPosition
            Temp := "PixelCountDigits"
            DigitString .= %Temp%%PixelCountForThisDigitString%
            PixelCountForAllDigitsString .= PixelCountForThisDigitString . A_Space
            PixelCountForThisDigitString := ""
         }
      }
   }
   Loop,
   {
      StringPosition := instr(DigitString,".")    ; find the first decimal point
      if StringPosition
      {
         if ((strlen(DigitString) - StringPosition) > 2)
            StringReplace, DigitString, DigitString,.,,
         else
            break
      }
      else
         break
   }
   if (DigitString)
   {
      PixelCountForAllDigitsStringReturned := PixelCountForAllDigitsString
      return DigitString
   }
}

ColorWithinTolerance(SampleColor, TestColor, Tolerance) {

   if (SampleColor == TestColor)
      return 1
   If (Tolerance == 0)
      return (SampleColor == TestColor)

    SampleColorRed := SampleColor >> 16
    TestColorRed := TestColor >> 16
    SampleColorGreen:= SampleColor >> 8 & 0xff
    TestColorGreen := TestColor >> 8 & 0xff
    SampleColorBlue := SampleColor & 0xff
    TestColorBlue := TestColor & 0xff
    return (    ( (SampleColorRed + Tolerance >= TestColorRed)     && (SampleColorRed - Tolerance <= TestColorRed) )
        &&      ( (SampleColorGreen + Tolerance >= TestColorGreen) && (SampleColorGreen - Toleranc <= TestColorGreene) )
        &&      ( (SampleColorBlue + Tolerance >= TestColorBlue)   && (SampleColorBlue - Tolerance <= TestColorBlue) )           )
}

WindowScaledPos(ByRef PosX, ByRef PosY, ByRef ClientScaleFactor, ScaleType="Screen", WinId="")
{
   local TitleBarHeight, WindowBottomBorder, WindowSideBorder, WindowTopBorder ,WindowX,WindowY,WindowWidth,WindowHeight
   local ClientWidth, ClientHeight , ClientWidthScaleFactor, ClientHeightScaleFactor

   StandardClientWidth=794
   StandardClientHeight=547

   SysGet, TitleBarHeight, 4
   SysGet, WindowBottomBorder, 32
   SysGet, WindowSideBorder, 33

   WindowTopBorder := TitleBarHeight + WindowBottomBorder
   WinGetPos,WindowX,WindowY,WindowWidth,WindowHeight,ahk_id%WinId%

  ; if this is a poker table, then scale the XY position based on the size of the current table to a standard table size
  ; ifWinExist, ahk_id%WinId%  ahk_group Tables
  ; {
      ClientWidth := WindowWidth - 2 * WindowSideBorder
      ClientHeight := WindowHeight - TitleBarHeight - 2 * WindowBottomBorder
      ClientWidthScaleFactor := ClientWidth / StandardClientWidth
      ClientHeightScaleFactor := ClientHeight / StandardClientHeight 
      ClientScaleFactor := ClientWidthScaleFactor     ; pass back the scaling factor in case the calling function needs it
      PosX := Round(PosX * ClientWidthScaleFactor)
      PosY := Round(PosY * ClientHeightScaleFactor)
  ; }
   
    if (ScaleType == "Client")
   {
      return
   }
   else if (ScaleType == "Window")
   {
      PosX += WindowSideBorder
      PosY += WindowTopBorder
   }

   else if (ScaleType == "Screen")
   {
      PosX += WindowX + WindowSideBorder
      PosY += WindowY + WindowTopBorder
   }
}


BuildGui:
Gui, color, white
Gui, add, tab, h490 w300, General|Global hotkeys|BetPot|Table hotkeys|Time
Gui, Tab, General

Gui, Add, Radio, x36 y70 w180 h20 Checked%ClassicTheme% vClassicTheme, Classic
Gui, Add, Radio, x36 y90 w180 h20 Checked%Racetrack% vRacetrack, Racetrack

Gui, add, text,cRed y125 x85, Use these options
Gui, add, text,cRed y140 x50, if you experience flicker problem
Gui, add, Checkbox, y160 x60 Checked%flicker1% Vflicker1
Gui, add, text, y175 x25,set FullTilt process
Gui, add, text, y190 x25,priority to high
Gui, add, Checkbox, y160 x180 Checked%flicker2% Vflicker2
Gui, add, text, y175 x125,set affinity to cpu1 only
Gui, add, text, y190 x125,for FullTilt process 
Gui, add, text, y205 x125,(Dual-core/HT cpu) 
Gui, add, text,cGreen y235 x25,Turning aero theme off (Vista/W7) might help
Gui, add, text,cGreen y250 x25,if these settings don't work.
Gui, add, text,cGreen y270 x25,It is vital to turn aero off for BetPot function.
Gui, Add, Radio, x26 y300 w220 h15 Checked%ActOnActiveTable% vActOnActiveTable, Send actions to active table
Gui, Add, Radio, x26 y315 w220 h15 Checked%sendundermouse% vsendundermouse, Send actions to table under mouse
Gui, add, text, y335 x25, Activate table under mouse
Gui, add, Checkbox, y335 x220 Checked%activatetableundermouse% Vactivatetableundermouse

Gui, add, text, y365 x25, Highlight table
Gui, add, Checkbox, y365 x100 Checked%Highlight% VHighlight
Gui, Add, Radio, x126 y360 w120 h15 Checked%highlightactive% vhighlightactive, Active
Gui, Add, Radio, x126 y375 w120 h15 Checked%highlighthero% vhighlighthero, With action on hero
Gui, add, text, y405 x25, Move mouse to action buttons
Gui, add, Checkbox, y405 x220 Checked%MoveMouse% VMoveMouse
Gui, add, text, y425 x65, Move mouse from nonfulltilt app
Gui, add, Checkbox, y425 x220 Checked%stealfocus% Vstealfocus

Gui, Add, Button, x75 y455 w55 h20 gSave,Submit
Gui, Add, Button, x135 y455 w55 h20 gCancel,Cancel

Gui, Tab, Global hotkeys

Gui, Add, Text, x25 y75 ,Register
Gui, Add, Edit, x220 y72 w50 h20 vregister, %register%
Gui, Add, Text, x25 y92 ,(join/unjoin waiting list for cash tables)
Gui, Add, Text, x25 y115 ,Unregister
Gui, Add, Edit, x220 y112 w50 h20 vunregister, %unregister%
Gui, Add, Text, x25 y140 ,Join waiting list on all tables
Gui, Add, Edit, x220 y137 w50 h20 vjoinwaitlist, %joinwaitlist%
Gui, Add, Text, x25 y165 ,Unjoin waiting list on all tables
Gui, Add, Edit, x220 y162 w50 h20 vunjoinwaitlist, %unjoinwaitlist%

Gui, Add, Text, x25 y215 ,Activate next table
Gui, Add, Edit, x220 y212 w50 h20 vActivateBottomWindow, %ActivateBottomWindow%
Gui, Add, Text, x25 y245 ,Custom layout 1
Gui, Add, Edit, x220 y242 w50 h20 vlayout1, %layout1%
Gui, Add, Text, x25 y265 ,Custom layout 2
Gui, Add, Edit, x220 y262 w50 h20 vlayout2, %layout2%
Gui, Add, Text, x25 y285 ,Custom layout 3
Gui, Add, Edit, x220 y282 w50 h20 vlayout3, %layout3%

Gui, Add, Text, x25 y315 ,Suspend all hotkeys
Gui, Add, Edit, x220 y312 w50 h20 vsuspend, %suspend%
Gui, Add, Text, x25 y335 ,Pause/unpause
Gui, Add, Edit, x220 y332 w50 h20 vTogglePause, %TogglePause%


Gui, Add, Button, x75 y415 w55 h20 gSave,Submit
Gui, Add, Button, x135 y415 w55 h20 gCancel,Cancel

Gui, Tab, Time

Gui, add, Checkbox, y75 x200 Checked%Timebank% VTimebank
Gui, add, text, y75 x25,Click Timebank automatically
Gui, add, Text, w200 y95 x25, Time delay for pressing Time button 
Gui, add, DropDownList, w40 y90 x220  vInterval1, %ddlist%
Gui, add, text, y135 x25, Click "Deal me in" automatically 
Gui, add, Checkbox, y135 x200 Checked%dealmein% Vdealmein
Gui, Add, Text, x25 y155 w120 h20 , Toggle Deal me in
Gui, Add, Edit, x220 y152 w50 h20 vToggledealmein, %Toggledealmein%
Gui, Add, Text, x25 y180 ,Sitout on all tables
Gui, Add, Edit, x180 y177 w50 h20 vSitOutNextAll, %SitOutNextAll%
Gui, Add, Text, x25 y205 ,Remove sitout on all tables
Gui, Add, Edit, x180 y202 w50 h20 vRemoveSitout, %RemoveSitout%

Gui, Add, Button, x75 y415 w55 h20 gSave,Submit
Gui, Add, Button, x135 y415 w55 h20 gCancel,Cancel

Gui, Tab, Table hotkeys

Gui, Add, Edit, x180 y67 w50 h20 vfold, %fold%
Gui, Add, Text, x25 y70 ,Fold
Gui, Add, Edit, x180 y87 w50 h20 vcall, %call%
Gui, Add, Text, x25 y90 ,Check/Call
Gui, Add, Edit, x180 y107 w50 h20 vraise, %raise%
Gui, Add, Text, x25 y110 ,Bet/Raise
Gui, Add, Edit, x180 y127 w50 h20 vfold2any, %fold2any%
Gui, Add, Text, x25 y130 ,Fold to any
Gui, Add, Edit, x180 y147 w50 h20 vfold2any400, %fold2any400%
Gui, Add, Text, x25 y150 ,Fold to any nl400

Gui, Add, Button, x75 y315 w55 h20 gSave,Submit
Gui, Add, Button, x135 y315 w55 h20 gCancel,Cancel


Gui, Tab, BetPot

Gui, add, Checkbox, y55 x180 Checked%autopot% Vautopot
Gui, add, text, y55 x25,Auto put bet into bet box
Gui, Add, Text, x15 y70 ,Pre*
Gui, Add, Edit, x15 y85 w25 h20 vPotDefPre, %PotDefPre%
Gui, Add, Text, x45 y70 ,Flop*
Gui, Add, Edit, x45 y85 w25 h20 vPotDefFlop, %PotDefFlop%
Gui, Add, Text, x75 y70 ,Turn*
Gui, Add, Edit, x75 y85 w25 h20 vPotDefTurn, %PotDefTurn%
Gui, Add, Text, x105 y70 ,River*
Gui, Add, Edit, x105 y85 w25 h20 vPotDefRiver, %PotDefRiver%
Gui, Add, Text, x140 y70 ,Open
Gui, add, DropDownList, w45 y85 x140  vOpenDef, %ddlist1%
Gui, Add, Text, x175 y70 ,Round(sb)
Gui, add, Checkbox, y85 x200 Checked%RoundDef% VRoundDef
Gui, Add, Text, x230 y70 ,Fix blinds
Gui, add, Checkbox, y85 x250 Checked%FixDef% VFixDef

Gui, Add, Edit, x60 y107 w80 h20 vpot1, %pot1%
Gui, Add, Text, x15 y110 ,Pot1
Gui, Add, Text, x15 y130 ,Pre*
Gui, Add, Edit, x15 y145 w25 h20 vPot1Pre, %Pot1Pre%
Gui, Add, Text, x45 y130 ,Flop*
Gui, Add, Edit, x45 y145 w25 h20 vPot1Flop, %Pot1Flop%
Gui, Add, Text, x75 y130 ,Turn*
Gui, Add, Edit, x75 y145 w25 h20 vPot1Turn, %Pot1Turn%
Gui, Add, Text, x105 y130 ,River*
Gui, Add, Edit, x105 y145 w25 h20 vPot1River, %Pot1River%
Gui, Add, Text, x140 y130 ,Open
Gui, add, DropDownList, w45 y145 x140  vOpen1, %ddlist1%
Gui, Add, Text, x175 y130 ,Round(sb)
Gui, add, Checkbox, y145 x200 Checked%Round1% VRound1
Gui, Add, Text, x230 y130 ,Fix blinds
Gui, add, Checkbox, y145 x250 Checked%Fix1% VFix1

Gui, Add, Edit, x60 y167 w80 h20 vpot2, %pot2%
Gui, Add, Text, x15 y170 ,Pot2
Gui, Add, Edit, x15 y190 w25 h20 vPot2Pre, %Pot2Pre%
Gui, Add, Edit, x45 y190 w25 h20 vPot2Flop, %Pot2Flop%
Gui, Add, Edit, x75 y190 w25 h20 vPot2Turn, %Pot2Turn%
Gui, Add, Edit, x105 y190 w25 h20 vPot2River, %Pot2River%
Gui, add, DropDownList, w45 y190 x140  vOpen2, %ddlist1%
Gui, add, Checkbox, y190 x200 Checked%Round2% VRound2
Gui, add, Checkbox, y190 x250 Checked%Fix2% VFix2

Gui, Add, Edit, x60 y212 w80 h20 vpot3, %pot3%
Gui, Add, Text, x15 y215 ,Pot3
Gui, Add, Edit, x15 y235 w25 h20 vPot3Pre, %Pot3Pre%
Gui, Add, Edit, x45 y235 w25 h20 vPot3Flop, %Pot3Flop%
Gui, Add, Edit, x75 y235 w25 h20 vPot3Turn, %Pot3Turn%
Gui, Add, Edit, x105 y235 w25 h20 vPot3River, %Pot3River%
Gui, add, DropDownList, w45 y235 x140  vOpen3, %ddlist1%
Gui, add, Checkbox, y235 x200 Checked%Round3% VRound3
Gui, add, Checkbox, y235 x250 Checked%Fix3% VFix3

Gui, add, Checkbox, y260 x210 Checked%autobet% Vautobet
Gui, add, text, y260 x55,Additionally press bet button

Gui, Add, Edit, x80 y282 w40 h20 vincr1, %incr1%
Gui, Add, Text, x15 y285 ,Increase by
Gui, Add, Radio, x125 y280 w40 h15 Checked%bb1% vbb1,bb
Gui, Add, Radio, x125 y295 w40 h15 Checked%sb1% vsb1,sb
Gui, Add, Edit, x190 y282 w80 h20 valt1, %alt1%

Gui, Add, Edit, x80 y312 w40 h20 vincr2, %incr2%
Gui, Add, Text, x15 y315 ,Decrease by
Gui, Add, Radio, x125 y310 w40 h15 Checked%bb2% vbb2,bb
Gui, Add, Radio, x125 y325 w40 h15 Checked%sb2% vsb2,sb
Gui, Add, Edit, x190 y312 w80 h20 valt2, %alt2%

Gui, Add, Edit, x80 y342 w40 h20 vincr3, %incr3%
Gui, Add, Text, x15 y345 ,Increase by
Gui, Add, Radio, x125 y340 w40 h15 Checked%bb3% vbb3,bb
Gui, Add, Radio, x125 y355 w40 h15 Checked%sb3% vsb3,sb
Gui, Add, Edit, x190 y342 w80 h20 valt3, %alt3%

Gui, Add, Edit, x80 y372 w40 h20 vincr4, %incr4%
Gui, Add, Text, x15 y375 ,Decrease by
Gui, Add, Radio, x125 y370 w40 h15 Checked%bb4% vbb4,bb
Gui, Add, Radio, x125 y385 w40 h15 Checked%sb4% vsb4,sb
Gui, Add, Edit, x190 y372 w80 h20 valt4, %alt4%

Gui, Add, Text, x15 y400 ,Attempts to read Pot amount from screen
Gui, Add, Edit, x230 y397 w25 h20 vattempts, %attempts%

Gui, Add, Text, x15 y420 ,* Pot percent

Gui, add, text,cRed y440 x35,BetPot function won't be efficient with aero theme on

Gui, Add, Button, x75 y460 w55 h20 gSave,Submit
Gui, Add, Button, x135 y460 w55 h20 gCancel,Cancel

Gosub, GetIni
Gui, show, w316, %thisahk%
Return
;-----------------------------------------------------------------------------------------------------
GetIni:
Settitlematchmode,2
IfNotExist, %thisahk%.ini
gosub, CreateIni
IniRead, ClassicTheme,%thisahk%.ini, Options, ClassicTheme,0
IniRead, Racetrack,%thisahk%.ini, Options, Racetrack,0
IniRead, ActOnActiveTable, %thisahk%.ini, Options, ActOnActiveTable, 0
IniRead, sendundermouse, %thisahk%.ini, Options, sendundermouse, 0
IniRead, activatetableundermouse, %thisahk%.ini, Settings, activatetableundermouse, 0
IniRead, Highlight, %thisahk%.ini, Settings, Highlight, 0
IniRead, highlighthero, %thisahk%.ini, Options, highlighthero, 0
IniRead, highlightactive, %thisahk%.ini, Options, highlightactive, 0
IniRead, MoveMouse, %thisahk%.ini, Settings, MoveMouse, 0
IniRead, stealfocus, %thisahk%.ini, Settings, stealfocus, 0

IniRead, Interval1, %thisahk%.ini, Settings, Interval1
StringReplace, ddlist, ddlist, %interval1%, %Interval1%|
GuiControl, , Interval1, |%ddlist%
StringReplace, ddlist, ddlist, %interval1%|, %Interval1%
IniRead, flicker1, %thisahk%.ini, Settings, flicker1, 0
IniRead, flicker2, %thisahk%.ini, Settings, flicker2, 0
IniRead, dealmein, %thisahk%.ini, Settings, dealmein, 0
IniRead, Toggledealmein, %thisahk%.ini, Settings, Toggledealmein,%A_Space%
If Toggledealmein
{
HotKey, IfWinActive, ahk_class QWidget
Hotkey, %Toggledealmein%, Toggledealmein
}
IniRead, Timebank, %thisahk%.ini, Settings, Timebank, 0
IniRead, SitOutNextAll, %thisahk%.ini, Hotkeys, SitOutNextAll,%A_Space%
IniRead, RemoveSitout, %thisahk%.ini, Hotkeys, RemoveSitout,%A_Space%
if SitOutNextAll
Hotkey, %SitOutNextAll%,SitOutNextAll
if RemoveSitout
Hotkey, %RemoveSitout%,RemoveSitout

IniRead, register, %thisahk%.ini, Settings, register,%A_Space%
IniRead, unregister, %thisahk%.ini, Settings, unregister,%A_Space%
IniRead, joinwaitlist, %thisahk%.ini, Settings, joinwaitlist,%A_Space%
IniRead, Unjoinwaitlist, %thisahk%.ini, Settings, Unjoinwaitlist,%A_Space%
if register
Hotkey, %register%,register
if unregister
Hotkey, %unregister%,unregister
if joinwaitlist
Hotkey, %joinwaitlist%,joinwaitlist
if Unjoinwaitlist
Hotkey, %Unjoinwaitlist%,Unjoinwaitlist
IniRead, ActivateBottomWindow, %thisahk%.ini, Hotkeys, ActivateBottomWindow,%A_Space%
if ActivateBottomWindow
Hotkey, %ActivateBottomWindow%,ActivateBottomWindow
IniRead, suspend, %thisahk%.ini, Hotkeys, suspend,%A_Space%
if suspend
Hotkey, %suspend%,suspend
IniRead, TogglePause, %thisahk%.ini, Hotkeys, TogglePause,%A_Space%
if TogglePause
Hotkey, %TogglePause%,TogglePause
IniRead, layout1, %thisahk%.ini, Hotkeys, layout1,%A_Space%
if layout1
Hotkey, %layout1%,layout1
IniRead, layout2, %thisahk%.ini, Hotkeys, layout2,%A_Space%
if layout2
Hotkey, %layout2%,layout2
IniRead, layout3, %thisahk%.ini, Hotkeys, layout3,%A_Space%
if layout3
Hotkey, %layout3%,layout3


IniRead, fold, %thisahk%.ini, Hotkeys, fold,%A_Space%
IniRead, call, %thisahk%.ini, Hotkeys, call,%A_Space%
IniRead, raise, %thisahk%.ini, Hotkeys, raise,%A_Space%
IniRead, fold2any, %thisahk%.ini, Hotkeys, fold2any,%A_Space%
IniRead, fold2any400, %thisahk%.ini, Hotkeys, fold2any400,%A_Space%
if fold
{
;HotKey, IfWinActive, ahk_class QWidget
HotKey, IfWinActive
Hotkey, %fold%,fold
}
if call
{
;HotKey, IfWinActive, ahk_class QWidget
HotKey, IfWinActive
Hotkey, %call%,call
}
if raise
{
;HotKey, IfWinActive, ahk_class QWidget
HotKey, IfWinActive
Hotkey, %raise%,raise
}
if fold2any
{
;HotKey, IfWinActive, ahk_class QWidget
HotKey, IfWinActive
Hotkey, %fold2any%,fold2any
}
if fold2any400
{
;HotKey, IfWinActive, ahk_class QWidget
HotKey, IfWinActive
Hotkey, %fold2any400%,fold2any400
}

IniRead, OpenDef, %thisahk%.ini, BetPotSettings, OpenDef
StringReplace, ddlist1, ddlist1, %OpenDef%, %OpenDef%|
GuiControl, , OpenDef, |%ddlist1%
StringReplace, ddlist1, ddlist1, %OpenDef%|, %OpenDef%
IniRead, RoundDef, %thisahk%.ini, BetPotSettings, RoundDef, 0
IniRead, FixDef, %thisahk%.ini, BetPotSettings, FixDef, 0
IniRead, PotDefPre, %thisahk%.ini, BetPotSettings, PotDefPre, 0
IniRead, PotDefFlop, %thisahk%.ini, BetPotSettings, PotDefFlop, 0
IniRead, PotDefTurn, %thisahk%.ini, BetPotSettings, PotDefTurn, 0
IniRead, PotDefRiver, %thisahk%.ini, BetPotSettings, PotDefRiver, 0

IniRead, Open1, %thisahk%.ini, BetPotSettings, Open1
StringReplace, ddlist1, ddlist1, %Open1%, %Open1%|
GuiControl, , Open1, |%ddlist1%
StringReplace, ddlist1, ddlist1, %Open1%|, %Open1%
IniRead, Round1, %thisahk%.ini, BetPotSettings, Round1, 0
IniRead, Fix1, %thisahk%.ini, BetPotSettings, Fix1, 0
IniRead, Pot1Pre, %thisahk%.ini, BetPotSettings, Pot1Pre, 0
IniRead, Pot1Flop, %thisahk%.ini, BetPotSettings, Pot1Flop, 0
IniRead, Pot1Turn, %thisahk%.ini, BetPotSettings, Pot1Turn, 0
IniRead, Pot1River, %thisahk%.ini, BetPotSettings, Pot1River, 0
IniRead, pot1, %thisahk%.ini, BetPotHotkeys, pot1,%A_Space%
if pot1
{
;HotKey, IfWinActive,ahk_class QWidget
HotKey, IfWinActive
Hotkey, %pot1%,pot1
}
IniRead, Open2, %thisahk%.ini, BetPotSettings, Open2
StringReplace, ddlist1, ddlist1, %Open2%, %Open2%|
GuiControl, , Open2, |%ddlist1%
StringReplace, ddlist1, ddlist1, %Open2%|, %Open2%
IniRead, Round2, %thisahk%.ini, BetPotSettings, Round2, 0
IniRead, Fix2, %thisahk%.ini, BetPotSettings, Fix2, 0
IniRead, Pot2Pre, %thisahk%.ini, BetPotSettings, Pot2Pre, 0
IniRead, Pot2Flop, %thisahk%.ini, BetPotSettings, Pot2Flop, 0
IniRead, Pot2Turn, %thisahk%.ini, BetPotSettings, Pot2Turn, 0
IniRead, Pot2River, %thisahk%.ini, BetPotSettings, Pot2River, 0
IniRead, pot2, %thisahk%.ini, BetPotHotkeys, pot2,%A_Space%
if pot2
{
;HotKey, IfWinActive,ahk_class QWidget
HotKey, IfWinActive
Hotkey, %pot2%,pot2
}
IniRead, Open3, %thisahk%.ini, BetPotSettings, Open3
StringReplace, ddlist1, ddlist1, %Open3%, %Open3%|
GuiControl, , Open3, |%ddlist1%
StringReplace, ddlist1, ddlist1, %Open3%|, %Open3%
IniRead, Round3, %thisahk%.ini, BetPotSettings, Round3, 0
IniRead, Fix3, %thisahk%.ini, BetPotSettings, Fix3, 0
IniRead, Pot3Pre, %thisahk%.ini, BetPotSettings, Pot3Pre, 0
IniRead, Pot3Flop, %thisahk%.ini, BetPotSettings, Pot3Flop, 0
IniRead, Pot3Turn, %thisahk%.ini, BetPotSettings, Pot3Turn, 0
IniRead, Pot3River, %thisahk%.ini, BetPotSettings, Pot3River, 0
IniRead, pot3, %thisahk%.ini, BetPotHotkeys, pot3,%A_Space%
if pot3
{
;HotKey, IfWinActive,ahk_class QWidget
HotKey, IfWinActive
Hotkey, %pot3%,pot3
}

IniRead, incr1, %thisahk%.ini, BetPotSettings, incr1, 0
IniRead, bb1, %thisahk%.ini, BetPotSettings, bb1, 0
IniRead, sb1, %thisahk%.ini, BetPotSettings, sb1, 0
IniRead, alt1, %thisahk%.ini, BetPotHotkeys, alt1, %A_Space%
if alt1
{
HotKey, IfWinActive, ahk_class QWidget
Hotkey, %alt1%,alt1
}
IniRead, incr2, %thisahk%.ini, BetPotSettings, incr2, 0
IniRead, bb2, %thisahk%.ini, BetPotSettings, bb2, 0
IniRead, sb2, %thisahk%.ini, BetPotSettings, sb2, 0
IniRead, alt2, %thisahk%.ini, BetPotHotkeys, alt2, %A_Space%
if alt2
{
HotKey, IfWinActive, ahk_class QWidget
Hotkey, %alt2%,alt2
}
IniRead, incr3, %thisahk%.ini, BetPotSettings, incr3, 0
IniRead, bb3, %thisahk%.ini, BetPotSettings, bb3, 0
IniRead, sb3, %thisahk%.ini, BetPotSettings, sb3, 0
IniRead, alt3, %thisahk%.ini, BetPotHotkeys, alt3, %A_Space%
if alt3
{
HotKey, IfWinActive, ahk_class QWidget
Hotkey, %alt3%,alt3
}
IniRead, incr4, %thisahk%.ini, BetPotSettings, incr4, 0
IniRead, bb4, %thisahk%.ini, BetPotSettings, bb4, 0
IniRead, sb4, %thisahk%.ini, BetPotSettings, sb4, 0
IniRead, alt4, %thisahk%.ini, BetPotHotkeys, alt4, %A_Space%
if alt4
{
HotKey, IfWinActive, ahk_class QWidget
Hotkey, %alt4%,alt4
}

IniRead, autopot, %thisahk%.ini, BetPotSettings, autopot, 0
IniRead, autobet, %thisahk%.ini, BetPotSettings, autobet, 0
IniRead, attempts, %thisahk%.ini, BetPotVariables, attempts, 0
Return
;-----------------------------------------------------------------------------------------------------
MakeIni:
If ClassicTheme
IniWrite, %ClassicTheme%, %thisahk%.ini, Options, ClassicTheme
If Racetrack
IniWrite, %Racetrack%, %thisahk%.ini, Options, Racetrack
if ActOnActiveTable
IniWrite, %ActOnActiveTable%, %thisahk%.ini, Options, ActOnActiveTable
if sendundermouse
IniWrite, %sendundermouse%, %thisahk%.ini, Options, sendundermouse
IniWrite, %activatetableundermouse%, %thisahk%.ini, Settings, activatetableundermouse
IniWrite, %Highlight%, %thisahk%.ini, Settings, Highlight
if highlighthero
IniWrite, %highlighthero%, %thisahk%.ini, Options, highlighthero
if highlightactive
IniWrite, %highlightactive%, %thisahk%.ini, Options, highlightactive
IniWrite, %MoveMouse%, %thisahk%.ini, Settings, MoveMouse
IniWrite, %stealfocus%, %thisahk%.ini, Settings, stealfocus
IniWrite, %Interval1%, %thisahk%.ini, Settings, Interval1
IniWrite, %flicker1%, %thisahk%.ini, Settings, flicker1
IniWrite, %flicker2%, %thisahk%.ini, Settings, flicker2
IniWrite, %dealmein%, %thisahk%.ini, Settings, dealmein
if Toggledealmein
IniWrite, %Toggledealmein%, %thisahk%.ini, Settings, Toggledealmein
IniWrite, %Timebank%, %thisahk%.ini, Settings, Timebank
if SitOutNextAll
IniWrite, %SitOutNextAll%, %thisahk%.ini, Hotkeys, SitOutNextAll
if RemoveSitout
IniWrite, %RemoveSitout%, %thisahk%.ini, Hotkeys, RemoveSitout

if register
IniWrite, %register%, %thisahk%.ini, Settings, register
if unregister
IniWrite, %unregister%, %thisahk%.ini, Settings, unregister
if joinwaitlist
IniWrite, %joinwaitlist%, %thisahk%.ini, Settings, joinwaitlist
if Unjoinwaitlist
IniWrite, %Unjoinwaitlist%, %thisahk%.ini, Settings, Unjoinwaitlist
if ActivateBottomWindow
IniWrite, %ActivateBottomWindow%, %thisahk%.ini, Hotkeys, ActivateBottomWindow
if suspend
IniWrite, %suspend%, %thisahk%.ini, Hotkeys, suspend
if TogglePause
IniWrite, %TogglePause%, %thisahk%.ini, Hotkeys, TogglePause
if layout1
IniWrite, %layout1%, %thisahk%.ini, Hotkeys, layout1
if layout2
IniWrite, %layout2%, %thisahk%.ini, Hotkeys, layout2
if layout3
IniWrite, %layout3%, %thisahk%.ini, Hotkeys, layout3


if fold
IniWrite, %fold%, %thisahk%.ini, Hotkeys, fold
if call
IniWrite, %call%, %thisahk%.ini, Hotkeys, call
if raise
IniWrite, %raise%, %thisahk%.ini, Hotkeys, raise
if fold2any
IniWrite, %fold2any%, %thisahk%.ini, Hotkeys, fold2any
if fold2any400
IniWrite, %fold2any400%, %thisahk%.ini, Hotkeys, fold2any400

IniWrite, %OpenDef%, %thisahk%.ini, BetPotSettings, OpenDef
IniWrite, %RoundDef%, %thisahk%.ini, BetPotSettings, RoundDef
IniWrite, %FixDef%, %thisahk%.ini, BetPotSettings, FixDef
IniWrite, %PotDefPre%, %thisahk%.ini, BetPotSettings, PotDefPre
IniWrite, %PotDefFlop%, %thisahk%.ini, BetPotSettings, PotDefFlop
IniWrite, %PotDefTurn%, %thisahk%.ini, BetPotSettings, PotDefTurn
IniWrite, %PotDefRiver%, %thisahk%.ini, BetPotSettings, PotDefRiver

IniWrite, %Open1%, %thisahk%.ini, BetPotSettings, Open1
IniWrite, %Round1%, %thisahk%.ini, BetPotSettings, Round1
IniWrite, %Fix1%, %thisahk%.ini, BetPotSettings, Fix1
IniWrite, %Pot1Pre%, %thisahk%.ini, BetPotSettings, Pot1Pre
IniWrite, %Pot1Flop%, %thisahk%.ini, BetPotSettings, Pot1Flop
IniWrite, %Pot1Turn%, %thisahk%.ini, BetPotSettings, Pot1Turn
IniWrite, %Pot1River%, %thisahk%.ini, BetPotSettings, Pot1River
if pot1
IniWrite, %pot1%, %thisahk%.ini, BetPotHotkeys, pot1

IniWrite, %Open2%, %thisahk%.ini, BetPotSettings, Open2
IniWrite, %Round2%, %thisahk%.ini, BetPotSettings, Round2
IniWrite, %Fix2%, %thisahk%.ini, BetPotSettings, Fix2
IniWrite, %Pot2Pre%, %thisahk%.ini, BetPotSettings, Pot2Pre
IniWrite, %Pot2Flop%, %thisahk%.ini, BetPotSettings, Pot2Flop
IniWrite, %Pot2Turn%, %thisahk%.ini, BetPotSettings, Pot2Turn
IniWrite, %Pot2River%, %thisahk%.ini, BetPotSettings, Pot2River
if pot2
IniWrite, %pot2%, %thisahk%.ini, BetPotHotkeys, pot2

IniWrite, %Open3%, %thisahk%.ini, BetPotSettings, Open3
IniWrite, %Round3%, %thisahk%.ini, BetPotSettings, Round3
IniWrite, %Fix3%, %thisahk%.ini, BetPotSettings, Fix3
IniWrite, %Pot3Pre%, %thisahk%.ini, BetPotSettings, Pot3Pre
IniWrite, %Pot3Flop%, %thisahk%.ini, BetPotSettings, Pot3Flop
IniWrite, %Pot3Turn%, %thisahk%.ini, BetPotSettings, Pot3Turn
IniWrite, %Pot3River%, %thisahk%.ini, BetPotSettings, Pot3River
if pot3
IniWrite, %pot3%, %thisahk%.ini, BetPotHotkeys, pot3


IniWrite, %incr1%, %thisahk%.ini, BetPotSettings, incr1
if bb1
IniWrite, %bb1%, %thisahk%.ini, BetPotSettings, bb1
if sb1
IniWrite, %sb1%, %thisahk%.ini, BetPotSettings, sb1
if alt1
IniWrite, %alt1%, %thisahk%.ini, BetPotHotkeys, alt1

IniWrite, %incr2%, %thisahk%.ini, BetPotSettings, incr2
if bb2
IniWrite, %bb2%, %thisahk%.ini, BetPotSettings, bb2
if sb2
IniWrite, %sb2%, %thisahk%.ini, BetPotSettings, sb2
if alt2
IniWrite, %alt2%, %thisahk%.ini, BetPotHotkeys, alt2

IniWrite, %incr3%, %thisahk%.ini, BetPotSettings, incr3
if bb3
IniWrite, %bb3%, %thisahk%.ini, BetPotSettings, bb3
if sb3
IniWrite, %sb3%, %thisahk%.ini, BetPotSettings, sb3
if alt3
IniWrite, %alt3%, %thisahk%.ini, BetPotHotkeys, alt3

IniWrite, %incr4%, %thisahk%.ini, BetPotSettings, incr4
if bb4
IniWrite, %bb4%, %thisahk%.ini, BetPotSettings, bb4
if sb4
IniWrite, %sb4%, %thisahk%.ini, BetPotSettings, sb4
if alt4
IniWrite, %alt4%, %thisahk%.ini, BetPotHotkeys, alt4


IniWrite, %autopot%, %thisahk%.ini, BetPotSettings, autopot
IniWrite, %autobet%, %thisahk%.ini, BetPotSettings, autobet
IniWrite, %attempts%, %thisahk%.ini, BetPotVariables, attempts

Return
;-----------------------------------------------------------------------------------------------------
CreateIni:
Racetrack:=0
ClassicTheme:=1
ActOnActiveTable:=1
sendundermouse:=0
activatetableundermouse:=0
Highlight:=0
highlighthero:=0
highlightactive:=1
MoveMouse:=0
stealfocus:=1

flicker1:=1
flicker2:=0
Interval1:=1
dealmein:=0
Timebank:=0

register=^r
unregister=^u

autopot:=0
autobet:=0
OpenDef=ssnl
Open1=ssnl
Open2=trny
Open3=----
RoundDef:=1
Round1:=1
Round2:=1
Round3:=1
fixDef:=1
fix1:=1
fix2:=1
fix3:=1
PotDefPre:=75
PotDefFlop:=75
PotDefTurn:=66
PotDefRiver:=66
Pot1Pre:=75
Pot1Flop:=75
Pot1Turn:=66
Pot1River:=66
Pot2Pre:=100
Pot2Flop:=80
Pot2Turn:=80
Pot2River:=80
Pot3Pre:=999
Pot3Flop:=100
Pot3Turn:=100
Pot3River:=100
Pot1=mbutton
Pot2=xbutton1
Pot3=xbutton2
incr1:=1
incr2:=1
incr3:=1
incr4:=1
bb1:=1
sb1:=0
bb2:=1
sb2:=0
bb3:=0
sb3:=1
bb4:=0
sb4:=1
alt1=wheelup
alt2=wheeldown
alt3=^wheelup
alt4=^wheeldown
attempts:=1

gosub, MakeIni
gosub, buildgui
return
;-----------------------------------------------------------------------------------------------------
GuiClose:
gosub, cancel
return
;-----------------------------------------------------------------------------------------------------
menuGui:
gosub, getini
winget,id,id, %thisahk% ahk_class AutoHotkeyGUI
if !DllCall( "IsWindowVisible", "UInt",id)
gosub, buildgui
else
winactivate,ahk_id%id%
Gui, Submit,nohide
return
;-----------------------------------------------------------------------------------------------------
reload:
reload
return
;-----------------------------------------------------------------------------------------------------
Save:
Gui, Submit
FileDelete, %thisahk%.ini
gosub, MakeIni
Reload
return
;-----------------------------------------------------------------------------------------------------
Cancel:
Gui, Destroy
Return
;-----------------------------------------------------------------------------------------------------
TogglePause:
pause,toggle
return
;-----------------------------------------------------------------------------------------------------
Suspend:
suspend
if A_IsSuspended=0
{
 T=Off
}
else
{
 T=On
}
Gui, 13:Add, Text,,Suspend: %T%
Gui, 13:+ToolWindow
Gui, 13:Show, w150 h20
Sleep, 1500
Gui, 3:Destroy
return
;-----------------------------------------------------------------------------------------------------
Edit:
edit
return
;-----------------------------------------------------------------------------------------------------
exitSub:
if flicker1
{
Process, Exist, FullTiltPoker.exe
if (ErrorLevel)
{
  FTP := ErrorLevel
  Process, Priority, %FTP%, Normal
;  SetAffinity(FTP)
}
}
;FileDelete, %thisahk%.ini
;gosub, makeini
exitApp
return
;-----------------------------------------------------------------------------------------------------

Last edited by Max1mums; 03-14-2010 at 06:53 AM.
FTCash - free script for FullTilt cash players. Quote
03-14-2010 , 03:29 PM
Hmm, that version kind of works, but it's doing weird things. I sat at two 2/4 tables and two 1/2 tables and used the Sit Out All hotkey, and it only sat out on 3. Then the Deal Me In All hotkey wouldn't work. It's acting strangely.

What's even more strange is AutoHotKey randomly keeps disappearing from my system tray and the process is gone (crashed?) from Task Manager.

Will this work if I sit higher than 2/4? I'd need it to work across multiple stakes, up to 5/10 at least.
FTCash - free script for FullTilt cash players. Quote
03-14-2010 , 04:05 PM
Quote:
What's even more strange is AutoHotKey randomly keeps disappearing from my system tray and the process is gone (crashed?) from Task Manager.

Will this work if I sit higher than 2/4? I'd need it to work across multiple stakes, up to 5/10 at least.
Script is supposed to get closed when you close FT client to avoid lags, checkboxes are being placed differently on nl400 and higher tables compared to lower stakes tables.
Quote:
Hmm, that version kind of works, but it's doing weird things. I sat at two 2/4 tables and two 1/2 tables and used the Sit Out All hotkey, and it only sat out on 3. Then the Deal Me In All hotkey wouldn't work. It's acting strangely.
I've made some changes in this version check if it helps.
Code:
; #### FTCash ####

; AHK version: 1.0.48.05
; date: January 12,2010
  version := "1.02"
; author: Max1mums (max1mums@overcards.com)

#SingleInstance, Force
#NoEnv
#Persistent
Settitlematchmode, 2
OnExit exitSub

StringTrimRight, thisahk, A_ScriptName, 4
SetWorkingDir %A_ScriptDir%

Menu, Tray, NoStandard
Menu, Tray, Add, Settings, menugui
Menu, Tray, Add 
Menu, Tray, Add, Reload, reload
Menu, Tray, Default, Settings
Menu, Tray, Add 
Menu, Tray, Add, Suspend, Suspend
Menu, Tray, Add, Pause, TogglePause
Menu, Tray, Add 
Menu, Tray, Add, Edit, Edit 
Menu, Tray, Add 
Menu, Tray, Add, Exit, ExitSub

OnMessage(0x112,"WM_SYSCOMMAND")
WM_SYSCOMMAND(wParam)
{
  if (A_Gui && wParam = 0xF020) ; SC_MINIMIZE
  {
    Gui, destroy
    return 0
  }
}

boost:=false
; Border of the "Highlighter"
border_color := "ff0000"
border_size := 5
trans := 255

debug:=0

SetBatchLines,-1
SetWinDelay,-1
SendMode Input

SysGet, xbord, 32
SysGet, ybord, 33
SysGet, cap, 4
SysGet, border, 32
SysGet, caption, 4

time_x:=0.9093
time_y:=0.7200
time_x1:=0.8808
t1:=0xdedbde
v:=25
back_x:=0.6534
back_y:=0.9862
back_x1:=0.5859
back1:=0x181818
v1:=5
join_x:=0.6158
join_y:=0.9292
join_x1:=0.8261
join:=0xffffff
v2:=5
once:=true
tablequeue=
ddlist=
Loop 14
ddlist:=ddlist . A_index . "|"

ddlist1=
ddlist1.="ssnl" . "|"
ddlist1.="trny" . "|"
ddlist1.="mix" . "|"
ddlist1.="----" . "|"
gosub,getini

ifwinnotexist,FullTiltPoker ahk_class QWidget
{
if flicker1
{
winwait,Logged In ahk_class QWidget
Process, Exist, FullTiltPoker.exe
if (ErrorLevel)
{
  FTP := ErrorLevel
  Process, Priority, %FTP%, High
}
}
else
{
Process, Exist, FullTiltPoker.exe
if (ErrorLevel)
{
  FTP := ErrorLevel
  Process, Priority, %FTP%, Normal
}
}
if flicker2
{
winwait,Logged In ahk_class QWidget
Process, Exist, AutoHotkey.exe
if (ErrorLevel)
{
  Ahk := ErrorLevel
;  SetAffinity(Ahk,0)
 SetAffinity(Ahk)
}
Process, Exist, FullTiltPoker.exe
if (ErrorLevel)
{
  FTP := ErrorLevel
;  SetAffinity(FTP,0)
 SetAffinity(FTP)
}
}
}
else
ifwinnotexist,Full Tilt Poker - ahk_class QWidget
winwaitclose,FullTiltPoker ahk_class QWidget



;;;;;;;;;;;;End of init;;;;;;;;;;;;;;

if Timebank
settimer,clickwithdelay,100
if autopot OR Highlight 
settimer,act,55
if Highlight
settimer,Highlighter,43
if dealmein OR Timebank
settimer,check,639
settimer,Colorinit,187
if MoveMouse
settimer,MouseMove,119
settimer,BetPot,87
settimer,onFTclose,1078
if activatetableundermouse
settimer,activateundermouse,133

return

;-----------------------------------------------------------------------------------------------------
onFTclose:
Settitlematchmode, 3
ifwinexist,FullTiltPoker ahk_class QWidget
ifwinnotexist,Full Tilt Poker - ahk_class QWidget
{
exitapp
}
Settitlematchmode, 2
return
;-----------------------------------------------------------------------------------------------------
FoldFT(id)
{
  PostclickFT(0.6834,0.9358,id)
}
CallFT(id)
{
  PostclickFT(0.8032,0.9358,id)
}
RaiseFT(id)
{
  PostclickFT(0.9356,0.9358,id)
}
Fold2anyFT(id)
{
global Racetrack
  if Racetrack
  PostclickFT(0.4325,0.8937,id)
  else
  PostclickFT(0.0088,0.7472,id)
}

Fold2anyFT400(id)
{
global Racetrack
  if Racetrack
  PostclickFT(0.4193,0.9169,id)
}
;-----------------------------------------------------------------------------------------------------
fold:
sendmode event
If ActOnActiveTable
WinGet, Id, ID, A
else
MousegetPos,,,ID
wingetclass,class,ahk_id%id%
if class=QWidget
{
 FoldFT(id)
}
else
{
;ControlGetFocus,ctrl,ahk_id%id%
;ControlSend,%ctrl%,%fold%,ahk_id%id%
send {%fold%}
}
sendmode input
return



call:
sendmode event
If ActOnActiveTable
WinGet, Id, ID, A
else
MousegetPos,,,ID
wingetclass,class,ahk_id%id%
if class=QWidget
{
 callFT(id)
}
else
{
;ControlGetFocus,ctrl,ahk_id%id%
;ControlSend,%ctrl%,%call%,ahk_id%id%
send {%call%}
}
sendmode input
return

raise:
sendmode event
If ActOnActiveTable
WinGet, Id, ID, A
else
MousegetPos,,,ID
wingetclass,class,ahk_id%id%
if class=QWidget
{
 raiseFT(id)
}
else
{
;ControlGetFocus,ctrl,ahk_id%id%
;ControlSend,%ctrl%,%raise%,ahk_id%id%
send {%raise%}
}
sendmode input
return

fold2any:
sendmode event
If ActOnActiveTable
WinGet, Id, ID, A
else
MousegetPos,,,ID
wingetclass,class,ahk_id%id%
if class=QWidget
{
 fold2anyFT(id)
}
else
{
;ControlGetFocus,ctrl,ahk_id%id%
;ControlSend,%ctrl%,%fold2any%,ahk_id%id%
send {%fold2any%}
}
sendmode input
return

fold2any400:
sendmode event
If ActOnActiveTable
WinGet, Id, ID, A
else
MousegetPos,,,ID
wingetclass,class,ahk_id%id%
if class=QWidget
{
 fold2anyFT400(id)
}
else
{
;ControlGetFocus,ctrl,ahk_id%id%
;ControlSend,%ctrl%,%fold2any%,ahk_id%id%
send {%fold2any400%}
}
sendmode input
return
;-----------------------------------------------------------------------------------------------------
pot1:
If ActOnActiveTable
WinGet, id, id, A
else
MousegetPos,,,id
if Round1
Roundsb:="smallblind"
else
Roundsb:=0.2
Pot(id,Pot1Pre A_space Pot1Flop A_space Pot1Turn A_space Pot1River, Roundsb, Open1, fix1)
if autobet
raiseFT(id)
return

pot2:
If ActOnActiveTable
WinGet, id, id, A
else
MousegetPos,,,id
if Round2
Roundsb:="smallblind"
else
Roundsb:=0.2
Pot(id,Pot2Pre A_space Pot2Flop A_space Pot2Turn A_space Pot2River, Roundsb, Open2, fix2)
if autobet
raiseFT(id)
return

pot3:
If ActOnActiveTable
WinGet, id, id, A
else
MousegetPos,,,id
if Round3
Roundsb:="smallblind"
else
Roundsb:=0.2
Pot(id,Pot3Pre A_space Pot3Flop A_space Pot3Turn A_space Pot3River, Roundsb, Open3, fix3)
if autobet
raiseFT(id)
return

alt1:
If ActOnActiveTable
WinGet, id, id, A
else
MousegetPos,,,id
if sb1
sb:="sb"
else
sb:=""
AlterAmount(id,"up", incr1, sb)
return

alt2:
If ActOnActiveTable
WinGet, id, id, A
else
MousegetPos,,,id
if sb2
sb:="sb"
else
sb:=""
AlterAmount(id,"down", incr2, sb)
return

alt3:
If ActOnActiveTable
WinGet, id, id, A
else
MousegetPos,,,id
if sb3
sb:="sb"
else
sb:=""
AlterAmount(id,"up", incr3, sb)
return

alt4:
If ActOnActiveTable
WinGet, id, id, A
else
MousegetPos,,,id
if sb4
sb:="sb"
else
sb:=""
AlterAmount(id,"down", incr4, sb)
return
;-----------------------------------------------------------------------------------------------------
BetPot:
GroupAdd, FullTiltTables,Logged In ahk_class QWidget,,,Full Tilt
if autopot
{
isbetboxnew()
}
return
;-----------------------------------------------------------------------------------------------------
IsBetBoxNew()
{
global oldid,PotDefPre,PotDefFlop,PotDefTurn,PotDefRiver,RoundDef,OpenDef,FixDef
winget winid,id,A
betboxX:=0.9687
betboxY:=0.8000
relFTclientpoint(winid,betboxX,betboxY,0)
pixelgetcolor,bet,betboxX,betboxY,ahk_id%winid%
if (winid<>oldid)
{
 if bet=0xffffff
 {
  oldid:=winid
  if RoundDef
  Roundsb:="smallblind"
  else
  Roundsb:=0.2
  Pot(winid,PotDefPre A_space PotDefFlop A_space PotDefTurn A_space PotDefRiver, Roundsb, OpenDef, FixDef)
 }
 else
 oldid=
 }
else
{ 
 if bet!=0xffffff
 oldid=
}
}
return
;-----------------------------------------------------------------------------------------------------
act:
id:=act()
 wingetclass,class,A
wingettitle,title,A
 ifwinnotactive,ahk_id%id%
 if class=QWidget
if (instr(title, "Logged In") & instr(title, "/"))
 winactivate,ahk_id%id%
return

act()
{
winget,list,list, Logged In ahk_class QWidget,,Full Tilt
return list1
}
;-----------------------------------------------------------------------------------------------------
activateundermouse:
activatetableundermouse()
return

activatetableundermouse()
{
    MousegetPos,,,WinID
    WinGetClass, class, ahk_id %WinID%
    WinGetTitle, title, ahk_id %WinID%
    if (class="QWidget")
    winactivate, ahk_id %WinID%
}
return
;-----------------------------------------------------------------------------------------------------
ActivateBottomWindow:
GroupActivate, FullTiltTables
return
;-----------------------------------------------------------------------------------------------------
SitOutNextAll:
;ClickImBack:=false
settimer,Check,off

WinGet, list, List,Logged In ahk_class QWidget,,Full Tilt
Loop, %list%
{
 Z:=list%A_Index%
 WinGetTitle, title, ahk_id%Z%
 StringMid, bb, title, InStr(title, "/") + 1, InStr(title, a_space,"", InStr(title, "/")) - InStr(title, "/") - 1
 StringReplace,bb,bb,$,,1
 if Racetrack
 {
  if bb<4
  {
   sitx:=0.4263
   sity:=0.9264
  }
  else
  {
   sitx:=0.4125
   sity:=0.9345
  }
 }
 else
 {
  if bb<4
  {
   sitx:=0.0031
   sity:=0.7770
  }
  else
  {
   sitx:=0.0031
   sity:=0.7857
  }
 }
 click_x:=sitx+0.0070
 click_y:=sity+0.0070
 WinGetPos,,, W, H, ahk_id %Z%
 if w>1000
 Sittingout:=PixelColorA(0,0,0,sity,sitx,Z,1,15,15)
 else
 Sittingout:=PixelColorA(0,0,0,sity,sitx,Z,1,10,10)
 if !(instr(Sittingout,"-0-")) & !(instr(Sittingout,"1710618"))  ; & !(instr(Sittingout,"16777215"))
 {
  PostClickFT(click_x, click_y, Z, 0) 
 }       
}
return
;-----------------------------------------------------------------------------------------------------
RemoveSitout:
;ClickImBack:=true
if dealmein OR Timebank
settimer,Check,639
WinGet, list, List,Logged In ahk_class QWidget,,Full Tilt
Loop, %list%
{
 Z:=list%A_Index%
WinGetTitle, title, ahk_id%Z%
 StringMid, bb, title, InStr(title, "/") + 1, InStr(title, a_space,"", InStr(title, "/")) - InStr(title, "/") - 1
 StringReplace,bb,bb,$,,1
 if Racetrack
 {
  if bb<4
  {
   sitx:=0.4263
   sity:=0.9264
  }
  else
  {
   sitx:=0.4125
   sity:=0.9345
  }
 }
 else
 {
  if bb<4
  {
   sitx:=0.0031
   sity:=0.7770
  }
  else
  {
   sitx:=0.0031
   sity:=0.7857
  }
 }
 click_x:=sitx+0.0070
 click_y:=sity+0.0070
 WinGetPos,,, W, H, ahk_id %Z%
 if w>1000
 Sittingout:=PixelColorA(0,0,0,sity,sitx,Z,1,15,15)
 else
 Sittingout:=PixelColorA(0,0,0,sity,sitx,Z,1,10,10)
; FileAppend, %Sittingout%`n`n, test.txt
 if (instr(Sittingout,"-0-")) || (instr(Sittingout,"1710618"))  ; & !(instr(Sittingout,"16777215"))
  {
  PostClickFT(click_x, click_y, Z, 0) 
 }       
}
return
;-----------------------------------------------------------------------------------------------------
Layout1:
ifwinactive,Logged In ahk_class QWidget,,Full Tilt
WinGet, WinId, ID, A
else
MousegetPos,,,WinID
wingetclass,class,ahk_id %WinID%
wingettitle,title,ahk_id %WinID%
if class=QWidget
if !instr(title,"Full Tilt")
{
CX:=0.8261
CY:=0.0155
wingetpos,x1,y1,w,h,ahk_id%winid%
coordmode,mouse,screen
mousegetpos,x,y
coordmode,mouse,relative
DllCall("SetCursorPos", int, x1+w+10, int, y1+h+10)
PostclickFT(cx,cy,winid,1)
sleep 100
critical,6
send {Tab 7}
sleep,25
Send {Enter}
critical,off
sleep,-1
DllCall("SetCursorPos", int, x, int, y)
}
return
;-----------------------------------------------------------------------------------------------------
Layout2:
ifwinactive,Logged In ahk_class QWidget,,Full Tilt
WinGet, WinId, ID, A
else
MousegetPos,,,WinID
wingetclass,class,ahk_id %WinID%
wingettitle,title,ahk_id %WinID%
if class=QWidget
if !instr(title,"Full Tilt")
{
CX:=0.8261
CY:=0.0155
wingetpos,x1,y1,w,h,ahk_id%winid%
coordmode,mouse,screen
mousegetpos,x,y
coordmode,mouse,relative
DllCall("SetCursorPos", int, x1+w+10, int, y1+h+10)
PostclickFT(cx,cy,winid,1)
sleep 100
critical,6
send {Tab 8}
sleep,25
Send {Enter}
critical,off
sleep,-1
DllCall("SetCursorPos", int, x, int, y)
}
return
;-----------------------------------------------------------------------------------------------------
Layout3:
ifwinactive,Logged In ahk_class QWidget,,Full Tilt
WinGet, WinId, ID, A
else
MousegetPos,,,WinID
wingetclass,class,ahk_id %WinID%
wingettitle,title,ahk_id %WinID%
if class=QWidget
if !instr(title,"Full Tilt")
{
CX:=0.8261
CY:=0.0155
wingetpos,x1,y1,w,h,ahk_id%winid%
coordmode,mouse,screen
mousegetpos,x,y
coordmode,mouse,relative
DllCall("SetCursorPos", int, x1+w+10, int, y1+h+10)
PostclickFT(cx,cy,winid,1)
sleep 100
critical,6
send {Tab 9}
sleep,25
Send {Enter}
critical,off
sleep,-1
DllCall("SetCursorPos", int, x, int, y)
}
return
;-----------------------------------------------------------------------------------------------------
HighLighter:
HighLighter(1)
return

HighLighter(Highlight=1)  ;x_mouse=0.75, y_mouse=0.75 
{
global OldX,OldY,OldW,OldH
global highlighthero,last_table_id
global border_color
global border_size
global trans
global xbord,ybord
global cap

;act()
foldx:=0.6534
foldy:=0.9662
foldx1:=0.5859
foldy1:=0.9662

back_x:=0.6534
back_y:=0.9862
back_x1:=0.5859
back_y1:=0.9862

join_y:=0.9292
join_x:=0.8261

fold1:=0x181818
v:=15
; id:=act()
; wingetclass,class,A
; wingettitle,title,A
; ifwinnotactive,ahk_id%id%
; if class=QWidget
; if (instr(title, "Logged In") & instr(title, "/"))
; winactivate,ahk_id%id%
; winget,id,id,A
ifwinactive, Logged In ahk_class QWidget,,Full Tilt
{  
 winget,id,id,A
 WinGetActiveStats,ActiveTitle, ActiveW, ActiveH, ActiveX, ActiveY
  relFTclientpoint(id,foldx,foldy,0)
  pixelgetcolor,fold,foldx,foldy,ahk_id%id%
  relFTclientpoint(id,foldx1,foldy1,0)
  pixelgetcolor,bacgr,foldx1,foldy1,ahk_id%id%
  relFTclientpoint(id,back_x,back_y,0)
  pixelgetcolor,deal,back_x,back_y,ahk_id%id%
  relFTclientpoint(id,back_x1,back_y1,0)
  pixelgetcolor,deal1,back_x1,back_y1,ahk_id%id%
 ; relFTclientpoint(id,join_x,join_y,0)
 ; pixelgetcolor,join,join_x,join_y,ahk_id%id%

 if (id != last_table_id) || ((OldX <> ActiveX || OldY <> ActiveY || OldW <> ActiveW || OldH <> ActiveH))    
 {
  OldX := ActiveX
  OldY := ActiveY
  OldW := ActiveW
  OldH := ActiveH
  mouse_last:=last_table_id
  last_table_id := id  
  if(!id)
  {
   Gui, 2: Cancel
   Gui, 3: Cancel
   Gui, 4: Cancel
   Gui, 5: Cancel
   return
  }  
  WinGetPos, x, y, w, h, ahk_id%id%
  x := x + xbord
  y := y + xbord + cap
  w := w - (2*xbord)
  h := h - (2*xbord) - cap
 
  ;Makes Border around urgent table
;  if ( Highlight = 1 )
  if (highlighthero=0) || ((highlighthero=1) & (comparecolors(fold,bacgr,v)=0) & (comparecolors(fold,fold1,v)=0) & (comparecolors(deal,deal1,v)=1))  ; & (comparecolors(join,deal1,v)=1))
  { 
   ;top
   guinum := 2
   Gui, %guinum%: +Alwaysontop +Lastfound +Owner
   Gui, %guinum%: Color, %border_color%
   WinSet, Transparent, %trans%
   Gui, %guinum%: -Caption
   Gui, %guinum%: Show, w%w% h%border_size% x%x% y%y% NoActivate    
   ;left
   guinum++
   Gui, %guinum%: +Alwaysontop +Lastfound +Owner
   Gui, %guinum%: Color, %border_color%
   WinSet, Transparent, %trans%
   Gui, %guinum%: -Caption
   Gui, %guinum%: Show, w%border_size% h%h% x%x% y%y% NoActivate    
   ;bottom
   guinum++
   Gui, %guinum%: +Alwaysontop +Lastfound +Owner
   Gui, %guinum%: Color, %border_color%
   WinSet, Transparent, %trans%
   Gui, %guinum%: -Caption
   y2 := y + h - border_size
   Gui, %guinum%: Show, w%w% h%border_size% x%x% y%y2% NoActivate    
   ;right
   guinum++
   Gui, %guinum%: +Alwaysontop +Lastfound +Owner
   Gui, %guinum%: Color, %border_color%
   WinSet, Transparent, %trans%
   Gui, %guinum%: -Caption
   x2 := x + w - border_size
   Gui, %guinum%: Show, w%border_size% h%h% x%x2% y%y% NoActivate  
  }
  else 
  if highlighthero=1
 ; if comparecolors(fold,bacgr,v)=1
 ; {
 ;  Gui, 2: Cancel
 ;  Gui, 3: Cancel
 ;  Gui, 4: Cancel
 ;  Gui, 5: Cancel
   last_table_id=
 ; }          
 }
 else
 if highlighthero=1
 if comparecolors(fold,bacgr,v)=1
 {
  Gui, 2: Cancel
  Gui, 3: Cancel
  Gui, 4: Cancel
  Gui, 5: Cancel
  last_table_id=
 }
}
else
{
   Gui, 2: Cancel
   Gui, 3: Cancel
   Gui, 4: Cancel
   Gui, 5: Cancel
   last_table_id=
}
}
return
;-----------------------------------------------------------------------------------------------------
MouseMove:
MoveMouse()
return

MoveMouse(x_mouse=0.7468, y_mouse=0.8735)
{
if IsWindowNew()
{ 
wingetclass,class,A
wingetactivetitle,title
if class=QWidget 
if !instr(title,"Full Tilt") 
{
 winget,id,id,A
 relFTClientPoint(id, x_mouse, y_mouse,0,1)
 DllCall("SetCursorPos", int, x_mouse, int, y_mouse)
}  
}
}
return
;-----------------------------------------------------------------------------------------------------
IsWindowNew()
{
global oldwinid,stealfocus
winget,id,id,A
wingetclass,class,ahk_id%oldwinid%
if id!=%oldwinid%
{
 oldwinid:=id
 if stealfocus
 return 1
 else
 {
  if class=QWidget
  return 1
  else
  return 0
 }
}
else
return 0
}
;-----------------------------------------------------------------------------------------------------
Colorinit:
if once
Colorinit()
return

Colorinit()
{
local id,t,col,v1
v1:=15
id:=WinExist("Logged In ahk_class QWidget","","Full Tilt")
if id
{
once:=false
settimer,Colorinit,off
t:=PixelColorA(time_x,time_y,time_x1,time_y,join_x,id)
stringsplit,col,t,-
if (CompareColors(col1,col2,v1)=false)
{
t2:=col2
once:=true
settimer,Colorinit,87
}
else
t2:=col1
t:=PixelColorA(back_x,back_y,back_x1,back_y,join_x,id)
stringsplit,col,t,-
if (CompareColors(col1,col2,v1)=false)
{
back2:=col2
once:=true
settimer,Colorinit,87
}
else
back2:=col1
}
}
return
;-----------------------------------------------------------------------------------------------------
check:
check()
return

check()
{
local listft,id,t,col
winget,listft,list,Logged In ahk_class QWidget,,Full Tilt
loop %listft%
{
id:=listft%A_index%
t:=PixelColorA(time_x,time_y,back_x,back_y,join_x,id)
stringsplit,col,t,-
if (CompareColors(col1,t1,v)=false) & (CompareColors(col1,t2,v)=false)
{
if !InStr(tablequeue,id)
movetolist(id,A_TickCount)
}
else
if InStr(tablequeue,id)
removefromlist(id)
if dealmein
if (CompareColors(col2,back1,v1)=false) & (CompareColors(col2,back2,v1)=false) & (CompareColors(col3,back2,v)=true)
PostclickFT(back_x,back_y,id,0)
}
}
return
;-----------------------------------------------------------------------------------------------------
relFTClientPoint(id, ByRef x, ByRef y, client=1, screen=0)
{
global xbord,ybord,cap
WinGetPos,x1,y1,w,h,ahk_id%id%
w-=2*xbord
h-=(2*ybord)+cap
x:=floor(W*x)
y:=floor(H*y)
if !client
{
x+=xbord
y+=ybord+cap
}
if screen
{
x+=x1
y+=y1
}
}
return
;-----------------------------------------------------------------------------------------------------
PostLeftDoubleClick(x, y, table_id, activate=1) {
; ### Max1mums: Send the double left click, then the mouse-up messages,
; some windows can get activated on the down left click so we will use
; left doubleclick instead, don't use on objects which have any functions
; binded to doubleclick unless you want to make doubleclick on them
; NOTE: This is relative to the top left of the client area and NOT the top left of the
;       window (ie: It *doesn't* include the title-bar like AHK's MouseClick does!!!).
If activate
 WinActivate, ahk_id%table_id%
critical,6
PostMessage, 0x203 , 0, ((y<<16)^x), , ahk_id%table_id% ; without 0x001 as lparam which is Lbutton down
PostMessage, 0x202 , 0, ((y<<16)^x), , ahk_id%table_id%
PostMessage, 0x202 , 0, ((y<<16)^x), , ahk_id%table_id%
critical,off
sleep,-1
}
return
;-----------------------------------------------------------------------------------------------------
PostclickFT(x,y,winid,activate=1,client=1)
{
relFTClientPoint(winid, x, y,client)
DllCall("SetCapture","Uint",winid)
PostLeftDoubleClick(x, y, winid, activate)
DllCall("ReleaseCapture")
}
return
;-----------------------------------------------------------------------------------------------------
clickwithdelay:
Loop, Parse, tablequeue, `,
{
interval:=interval1*1000
stringsplit,tab,A_loopfield,-
if abs(tab2-A_TickCount)>interval
{
PostclickFT(time_x,time_y,tab1,0)
listDelItem(tablequeue, A_Loopfield) 
}
}
return
;-----------------------------------------------------------------------------------------------------
PixelColorA(colx,coly,backx,backy,joinx,id,region=0,regionw=70,regionh=15)
{
global boost,xbord,ybord,cap
if boost
critical,6
setwindelay, -1
hdc_frame := DllCall( "GetDC", "UInt", id )
hdc_buffer := DllCall("gdi32.dll\CreateCompatibleDC", "UInt",  hdc_frame)
WinGetPos,,,W,H,ahk_id %id%
hbm_buffer := DllCall("gdi32.dll\CreateCompatibleBitmap", "UInt",hdc_frame, "Int",w, "Int",h)
DllCall( "gdi32.dll\SelectObject", "UInt",hdc_buffer, "UInt",hbm_buffer)
DllCall( "PrintWindow", "UInt" , id , "UInt" , hdc_buffer , "UInt" , 0 )
DllCall("RedrawWindow","UInt",id,"UInt",0,"UInt",0,"UInt", 1|16|32|64|1024) 
x:=floor(((W-2*xbord)*colx) + xbord)
y:=floor(((H-(2*ybord)-cap)*coly) + ybord + cap)
pix1=
pix1 := DllCall("GetPixel", "UInt", hdc_buffer, "Int", x, "Int", y) 
x:=floor(((W-2*xbord)*backx) + xbord)
y:=floor(((H-(2*ybord)-cap)*backy) + ybord + cap)
pix2:=DllCall("GetPixel", "UInt", hdc_buffer, "Int", x, "Int", y) 
x:=floor(((W-2*xbord)*joinx) + xbord)
pix3:=DllCall("GetPixel", "UInt", hdc_buffer, "Int", x, "Int", y) 
SetFormat, IntegerFast, hex
pix1 += 0
pix1 .= ""
pix2 += 0
pix2 .= ""
pix3 += 0
pix3 .= ""
SetFormat, IntegerFast, d
pix1.="-" . pix2 . "-" . pix3
if region
{
x:=floor(((W-2*xbord)*joinx) + xbord)
y:=floor(((H-(2*ybord)-cap)*backy) + ybord + cap)
pix1.="*"
loop %regionw%
{
delta:=A_index
loop %regionh%
{
delta1:=A_index
p := DllCall("GetPixel", "UInt", hdc_buffer, "Int", x+delta , "Int", y+delta1)
;p1:=p
;SetFormat, IntegerFast, hex
;p += 0
;p .= ""
;SetFormat, IntegerFast, d
;pix1.=p . "*" . p1 . "-"
pix1.=p . "-"
}
}
}
sleep,1
DllCall( "gdi32.dll\DeleteObject", "Uint", hbm_buffer )
DllCall( "gdi32.dll\ReleaseDC", "Uint", hdc_frame )
DllCall( "gdi32.dll\DeleteDC", "Uint", hdc_frame )
DllCall( "gdi32.dll\ReleaseDC", "Uint", hdc_buffer )
DllCall( "gdi32.dll\DeleteDC", "Uint", hdc_buffer )
if boost
{
critical,off
sleep,-1
}
return pix1
}
;-----------------------------------------------------------------------------------------------------
CompareColors(ByRef bgr1, ByRef bgr2, ByRef variation) {
	c1 := bgr1 & 0xff
	c2 := bgr2 & 0xff
	if (abs(c1 - c2) > variation)
		return false
	c1 := (bgr1 >> 8) & 0xff
	c2 := (bgr2 >> 8) & 0xff
	if (abs(c1 - c2) > variation)
		return false
	c1 := (bgr1 >> 16) & 0xff
	c2 := (bgr2 >> 16) & 0xff
	if (abs(c1 - c2) > variation)
		return false
	return true
}
;-----------------------------------------------------------------------------------------------------
listAdd( byRef list, item, del="," ) {
  list:=( list!="" ? ( list . del . item ) : item )
  return list
}
;-----------------------------------------------------------------------------------------------------
listDelItem( byRef list, item, del=",") {
  ifEqual, item,, return list
  list:=del . list . del
  StringReplace, list, list, %item%%del%
  StringTrimLeft, list, list, 1
  StringTrimRight, list, list, 1
  return list
}
;-----------------------------------------------------------------------------------------------------
movetolist(winid,time)
{
global tablequeue
listAdd(tablequeue, winid . "-" . time)
}
return
;-----------------------------------------------------------------------------------------------------
removefromlist(winid)
{
global tablequeue
Loop, Parse, tablequeue, `,
{
if InStr(A_loopfield,winid)
listDelItem(tablequeue, A_Loopfield)
}
}
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
}
;-----------------------------------------------------------------------------------------------------
register:
ifwinactive, ahk_class QWidget
{
winget,id,id, A
wingettitle,title,ahk_id%id%
if instr(title,"Full Tilt Poker -")
{
reg_x :=0.9080
reg_y :=0.7357
PostclickFT(reg_x,reg_y,id,0)
winwait,Tournament Buy-in ahk_class QWidget,,4
if !errorlevel
{
sleep,50
winget,id,id,Tournament Buy-in ahk_class QWidget
wingetpos,,,,h,ahk_id%id%
reg_x :=0.3608
if h<240
reg_y :=0.4876
else
reg_y :=0.4193
PostclickFT(reg_x,reg_y,id,0)
ifwinExist,Full Tilt Poker - Tournament ahk_class QWidget
winclose,Full Tilt Poker - Tournament ahk_class QWidget
}
}
}
return
;-----------------------------------------------------------------------------------------------------
unregister:
ifwinactive, ahk_class QWidget
{
winget,id,id, A
wingettitle,title,ahk_id%id%
if instr(title,"Full Tilt Poker -")
{
reg_x:=0.9080
reg_y:=0.6709
PostclickFT(reg_x,reg_y,id,0)
winwait,Full Tilt Poker - Tournament ahk_class QWidget,,4
if not errorlevel
{
winget,id,id, Full Tilt Poker - Tournament ahk_class QWidget
reg_x :=0.8876
reg_y :=0.0776
PostclickFT(reg_x,reg_y,id,0)
winwait,Tournament Buy-in ahk_class QWidget,,0.5
if not errorlevel
{
winclose,Tournament Buy-in ahk_class QWidget
ifwinexist, Full Tilt Poker - Tournament ahk_class QWidget
winclose, Full Tilt Poker - Tournament ahk_class QWidget
}
else
{
settitlematchmode,3
winwait, Full Tilt Poker ahk_class QWidget,,4
if not errorlevel
winclose,Full Tilt Poker ahk_class QWidget
settitlematchmode,2
ifwinexist, Full Tilt Poker - Tournament ahk_class QWidget
winclose, Full Tilt Poker - Tournament ahk_class QWidget
}
}
}
}
return
;-----------------------------------------------------------------------------------------------------
Toggledealmein:
If (dealmein=true) {
	dealmein:=false
	T=Off
}
else {
	dealmein:=true
	T=On
}
Gui, 12:Add, Text,, Auto Deal me in: %T%
Gui, 12:+ToolWindow
Gui, 12:Show, w150 h20
Sleep, 1000
Gui, 12:Destroy
return
;-----------------------------------------------------------------------------------------------------
Joinwaitlist:
winget,listft,list,Logged In ahk_class QWidget,,Full Tilt
loop %listft%
{
id:=listft%A_index%
t:=PixelColorA(join_x,back_y,back_x,join_y,join_x1,id,1)
stringsplit,st,t,*
stringsplit,col,st1,-
if (CompareColors(col1,back1,v1)=false) & (CompareColors(col1,back2,v1)=false)
if !instr(st2,"16777215") & !instr(st2,"67284200") & !instr(st2,"111670350") & !instr(st2,"148766710")
PostclickFT(back_x,back_y,id,0)
}
return
;-----------------------------------------------------------------------------------------------------
Unjoinwaitlist:
winget,listft,list,Logged In ahk_class QWidget,,Full Tilt
loop %listft%
{
id:=listft%A_index%
t:=PixelColorA(join_x,back_y,join_x1,join_y,join_x1,id,1)
stringsplit,st,t,*
stringsplit,col,st1,-
if (CompareColors(col1,back1,v1)=false) & (CompareColors(col1,back2,v1)=false)
if instr(st2,"16777215")  or instr(st2,"67284200") or instr(st2,"111670350") or instr(st2,"148766710")
PostclickFT(back_x,back_y,id,0)
}
return
;-----------------------------------------------------------------------------------------------------
AlterAmount(id, dir="", frac=1, unit="")
{
  WinGetTitle, title, ahk_id%id%
  amount := 0
  StringTrimRight, tablename, title, ( StrLen(title) - (InStr(title, " - ")-1) )
  IfWinExist, ahk_id%id% ahk_group FullTiltTables
  {
    StringMid, bb, title, InStr(title, "/") + 1, InStr(title, a_space,"", InStr(title, "/")) - InStr(title, "/") - 1
  }   
  StringReplace,bb,bb,$,,1
  StringReplace,bb,bb,Ј,,1
  StringReplace,bb,bb,Ђ,,1
  StringReplace,bb,bb,€,,1 

 ; bb++
 ; bb--
  sb := sb(bb)
;listvars
  If (unit = "" or unit = "bb")
  {
    unit := bb
  }
  Else If (unit = "sb")
  {
    unit := sb
  }
  Else If (unit = "pot")
  {
    pot := 0
    call := 0
    hero_bet := 0
    street := "pre"
    hero_position := ""
    open := 0
    max := 10000000
    IfWinExist, ahk_id%id% ahk_group FullTiltTables
    {
        PotSizeFullTilt2(id, pot, call, sb, bb, hero_bet, street, hero_position, open, max)
    }
    pot := ((pot + call + hero_bet) )+ call
    unit := pot
  }
  amount := unit * frac
  if (dir="down")
  {
    amount := amount - (2*amount)
  }
  a:=floor(amount)
  if amount-a=0
  amount:=a
  
  IfWinExist, ahk_id%id% ahk_group FullTiltTables
  {
      oldClipboard = %clipboard%
      clipboard =
      PostStarsClick(767, 440, id)
      Send ^a
      Send ^c
      ClipWait, 0.3
      If !ErrorLevel
      t := clipboard
      clipboard = %oldClipBoard%
      t := t + amount
      if (t < 0)
      {
        t := 0
      }
    t2 := Round(t, 0)
    t1 := Round(t, 2)
    t := Round(t, 3)
    if t-t1=0
    t:=t1
    if t-t2=0
    t:=t2
      PostStarsClick(767, 440, id)
      Send ^a
      Send %t%
  }
}

Pot(id, frac=1, round_bet=0.2, open_adjust="", fixblinds=0)
{
  global debug
  global attempts

  if attempts<=0
  attempts:=1
  pot := 0
  call := 0
  sb := 0
  bb := 0
  hero_bet := 0
  street := ""
  hero_position := ""
  open := 1
  max := 10000000

  IfWinExist, ahk_id%id% ahk_group FullTiltTables
  {
    loop %attempts%
    {
     PotSizeFullTilt2(id, pot, call, sb, bb, hero_bet, street, hero_position, open, max)
     if pot>0
     break
     sleep,20 
    }
    }
  Else
  {
    return
  }
 
  StringSplit, fr, frac, %A_SPACE%
  if (fr0 < 4)
  {
    times := 4 - fr0
    Loop, %times%
    {
      n := 5 - A_Index
      fr%n% := fr%fr0% 
    }
  }
  
  if (street = "pre")
  {
    frac:= Round(fr1/100,2)
  }
  else if (street = "flop")
  {
    frac:= Round(fr2/100,2)
  }
  else if (street = "turn")
  {
    frac:= Round(fr3/100,2)
  }
  else if (street = "river")
  {
    frac:= Round(fr4/100,2)
  }
  if (debug)
  {
    TrayTip, BetPot, Pot:`t`t%pot%`nCall:`t`t%call%`nHero_bet:`t%hero_bet%`n`nPosition:`t%hero_position%`n`nBlinds:`t$%sb%/$%bb%`n`nStreet:`t%street%`n`n%fr0%`n%fr1% %fr2% %fr3% %fr4%`n`n%frac%,10,17
  }
   ; listvars
  if (fixblinds AND open AND street="pre")
  {
    if (hero_position = "sb" )
    {
      pot := pot - sb
      call := call + sb
    }
    else if (hero_position = "bb")
    {
      pot := pot - bb
      call := call + bb
    }
  }

  pot := ((pot + call + hero_bet)* (frac)) + call  

  if (open=1 AND open_adjust="ssnl" )
  {
    pot := pot + bb - sb
  }
  else if (open=1 AND open_adjust="trny" )
  {
    pot := pot - bb
  }
  else if (open=1 AND open_adjust="mix" )
  {
    if (bb=2)
    {
      pot := pot + bb - sb
    }
  ;  pot := pot + bb + sb
  }
  
  if(round_bet = "smallblind")
  {
   ; if sb<1
    pot := Round((Floor((pot / sb)) * sb),2)
   ; else
   ; pot := Round((Floor((pot / sb)) * sb),0)
  }
  else if(round_bet = "bigblind")
  {
    pot := Round((Floor((pot / bb)) * bb),2)
  }
  else if (round_bet < 1)
  {
    places := round_bet*10
    pot := Round(pot, (places))
  }
  else if (round_bet >= 1)
  {
    pot := Floor(pot / round_bet) * round_bet
  }
 
  p:=floor(pot)
  if pot-p=0
  pot:=p
    
  IfWinExist, ahk_id%id% ahk_group FullTiltTables
  {
    PostStarsClick(767, 440, id)
    Send ^a
    Send %pot%
  }
}

PotSizeFullTilt2(id, ByRef pot, ByRef call, ByRef sb, ByRef bb, ByRef hero_bet, ByRef street, ByRef hero_position, ByRef open, ByRef max)
{
  global deduct_rake,Racetrack
  rake := 0
  notraked := 0
  maxrake := 3
  max := 7654321
  
  
  WinGetTitle, title, ahk_id%id%
  StringMid, bb, title, InStr(title, "/") + 1, InStr(title, a_space,"", InStr(title, "/")) - InStr(title, "/") - 1
  StringReplace,bb,bb,$,,1
  sb := sb(bb)
  
TotalPotDigitsPosX=393
TotalPotDigitsPosY=277
if Racetrack
{
MainPotDigitsPosX=334
MainPotDigitsPosY=183
}
else
{
MainPotDigitsPosX=285
MainPotDigitsPosY=335
}
;PotDigitsPos6X=338
;PotDigitsPos6Y=340
PotDigitsPosW=80
PotDigitsPosH=14
 

pot:=DigitSearchByPixelCount(TotalPotDigitsPosX,TotalPotDigitsPosY,PotDigitsPosW,PotDigitsPosH,Id)
if pot is not number
pot:=DigitSearchByPixelCount(MainPotDigitsPosX,MainPotDigitsPosY,PotDigitsPosW,PotDigitsPosH,Id)

;oldClipboard=%clipboard%
oldClipboard:=clipboard
 clipboard =
PostStarsClick(707, 418, id) ;hit min
PostStarsClick(707, 418, id) ;hit min
PostStarsClick(707, 418, id) ;hit min
;PostStarsClick(707, 418, id) ;hit min
;PostStarsClick(707, 418, id) ;hit min
;PostStarsClick(707, 418, id) ;hit min
PostStarsClick(767, 440, id)

min := sb
Send ^a
Send ^c
ClipWait, 0.3
If !ErrorLevel
 {
  min := clipboard
  clipboard = %oldClipBoard%
 }
 else
 {
 min := 2*bb 
 }
   
  street := "pre" 
  street := GetStreetFT(id)
   
  if (min = bb)
  {
    call := 0
  }
  else if (min > bb)
  {
    call := min / 2
  }
  else if (street != "pre")
  {
    call := bb
  }
  
    call2 := Round(call, 0)
    call1 := Round(call, 2)
    call := Round(call, 3)
    if call-call1=0
    call:=call1
    if call-call2=0
    call:=call2

  if (call != bb || street != "pre")
  {
    open := 0
  }
 pot := Round((Floor((pot / sb)) * sb),2) 
 ;pot := pot - (2 * call)

if call is not number
call:=0
if hero_bet is not number
hero_bet:=0 
return
}

GetStreetFT(id)
{
  CoordMode, Pixel, Screen

  street := "pre"
  
  x1 := 485
  y1 := 214
  x2 := 520
  y2 := 260
  relStarsScreenPoint(id, x1, y1)
  relStarsScreenPoint(id, x2, y2)
  
  If ( GetPixelCount(x1, y1, x2, y2, 0xffffff) > 5 )
  {
    street := "river"
    return street
  }
  
  x1 := 431
  y1 := 214
  x2 := 461
  y2 := 260
  relStarsScreenPoint(id, x1, y1)
  relStarsScreenPoint(id, x2, y2)

  If ( GetPixelCount(x1, y1, x2, y2, 0xffffff) > 5 )
  {
    street := "turn"
    return street
  }

  x1 := 378
  y1 := 214
  x2 := 414
  y2 := 260
  relStarsScreenPoint(id, x1, y1)
  relStarsScreenPoint(id, x2, y2)

  If ( GetPixelCount(x1, y1, x2, y2, 0xffffff) > 5 )
  {
    street := "flop"
    return street
  }
  return street
}

; finds number of specified pixels in a region
GetPixelCount(x1, y1, x2, y2, color, options="")
{
  CoordMode, Pixel, Screen
  pixels := (x2 - x1 + 1)*(y2 - y1 + 1)
  If ( pixels <= 0 )
  {
    ErrorLevel = 1
    return
  }
  count = 0
  x = %x1%
  Loop
  {
    If ( x > x2 )
    {
      break
    }
    y = %y1%
    Loop
    {
      If ( y > y2 )
      {
        break
      }
      PixelGetColor, c, x, y, %options%
      If ( c = color )
      {
        count++
      }
      y++
    }
    x++
  }
  return count
}

sb(bb) {
If bb = .25
 sb := .10
else if bb = 15
 sb = 10
else if bb = 0.05
 sb = 0.02
else
 sb := bb/2
if (sb > 1)
{
  sb := Round(sb, 0)
}
else
{
  sb := Round(sb, 2)
}
return sb
}

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

StrMid(str,str1,str2,startPos1=1,startPos2=1,caseSense=0){
If startPos1 =
 startPos1 = 1
If startPos2 =
 startPos2 = 1
StringTrimLeft,o,str,InStr(str,str1,cS,startPos1) + StrLen(str1) - 1
StringLeft,o,o,InStr(o,str2,caseSense,startPos2)-1
return o
}

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

relStarsClientPoint(id, ByRef x, ByRef y)
{
  global border
  global caption
  rw := 792
  rh := 546
  WinGetPos, , , w, h, ahk_id%id%
  w := w - (2*border)
  h := h - (2*border) - caption
  
  x := Floor( (x / rw ) * w )
  y := Floor( (y / rh) * h  )
  
}

relStarsWindowPoint(id, ByRef x, ByRef y)
{
  global border
  global caption
  relStarsClientPoint(id, x, y)
  x := x + border
  y := y + border + caption
}

relStarsScreenPoint(id, ByRef x, ByRef y)
{
  relStarsWindowPoint(id, x, y)
  WinGetPos, x1, y1, , , ahk_id%id%
  x += x1
  y += y1
}


reverse_calc_stars_client_area(cw, ByRef w, ByRef h)
{
  global border
  global caption
  w := cw + (2*border) 
  h := Floor(cw / 1.45) + (2*border) + caption
}

client_area(id, ByRef x, Byref y, ByRef w, Byref h)
{
  WinGetPos, x, y, w, h, ahk_id%id%
  global border
  global caption
  x := x + border
  y := y + border + caption
  w := w - (2*border)
  h := h - (2*border) - caption
  return
}

PostStarsClick(x, y, id)
{
  relStarsClientPoint(id, x, y)
;listvars
  PostLeftClick(x, y, id)
}

PostLeftClick(x, y, table_id, activate=1) {
; ### JUK: Send the down left click, then the mouse-up messages.
; NOTE: This is relative to the top left of the client area and NOT the top left of the
;       window (ie: It *doesn't* include the title-bar like AHK's MouseClick does!!!).
If activate
 WinActivate, ahk_id%table_id%
PostMessage, 0x201, 0x0001, ((y<<16)^x), , ahk_id%table_id%
PostMessage, 0x202 , 0, ((y<<16)^x), , ahk_id%table_id%
}


;;;;;;;;;;;;;;;;;;;;PixelCount function source taken from PokerShortCuts;;;;;;;;;;;;;;;;;;;;;

/*
DigitsByPixelCountGetValue()
   Purpose: This function looks for digits by counting pixels in each column of a digit and tries to find a match for those counts
               when a column of 0 pixels is found. we search the client area xywh
   Returns:
      DigitString - the numbers found
         A for All In
         S for Sitting Out
         "" if no digits found
   Parameters:
      X - x poistion in standard client area to search for digits
      Y - y "
      W - standardized width of search area
      H - standardized height of search area
      DigitsType - e.g. Bet, Stack or Pot. This var is used to get the colors and tolerances from the global variables
      ByRef PixelCountForAllDigitsStringReturned: for test purposes... this is the long pixel count string
      WinId: window id

Notes:
      1. I was having problems with the alternate color not reading the digits correctly on FT. This is black digits on white background.
      There sometimes seems to be a black pixel in the area below the stack numbers, and this would cause one of the columns to read incorrectly.
      To fix it, I had to reduce the Height parameter that it was checking from 15 down to 12. This seems to be reliable for all table sizes.

      2. Full Tilt on small tables does not have a blank row of pixels above the stack digits if the user's name has a decender character in it.
      I had to change the software to allow for a few pixels in this row for it to be considered a blank row. I suppose this could be a problem if
      the user only has a stack size of 1, in which case the blank row at the top would be intrepreted as the stack digit with on (since it might only have 1 pixel in the row.)
      The "y" has one pixel that is right above the stack numbers, and the "g" character has 2 pixels...  so we will allow for 2 pixels in the row.
      If the user's name has more than 2 pixels in the decenders, then this code won't work at the smallest of table sizes (need a table size that puts in a blank row of pixels.)

      3. On small full tilt tables, you can't position the initial starting position too far to the left, else the software doesn't read the stack size correctly.
      I have found that just to the left of the "Sitting Out" words is about right. for some reason it picks up a number of decimal point characters if
      X is too far to the left.

      4. At the larger table sizes, Stars tables go to a stack font that is not one solid color. It has the shading of the digits.
      But it does have one dominant color, and that is what I use to do the pixel count with. The color variation seems to be at
      least 10 for the other colors. So I captured the pixel counts setting the color variation to 1.
      This should work, unless there are some computers that show the color with more variation. I know that my alternate sony
      laptop has doesn't show the colors the same as my main sony laptop. So we need some color variation in there. So I'll try setting the variation
      to about 5.
      It may be that if this doesn't work, then we'll just have to tell users that have too much color variation in their font digits,
      that they can't use the larger table sizes on stars.

      5. One good testing method is to outputdebug the Y paramater to let you know if the software is finding the blank line above the digits.
      Also, output the digitstring and alternate and pixel count strings at the end of this function.
      In the debug, you can use a mouse position to look for the digit characters.


*/
DigitSearchByPixelCount(X,Y,W,H,WinId)
{  
DigitsColor=0xFFFFFF
DigitsColorTolerance=0

FTMinimumPixelCountPerColumn := 2               ; when counting pixels in a column, this is the minimum number to be a valid column (else it is a spacer column)
FTMaximumAllowedNumPixelsInRowToBeBlank:=2                                                   ; FT has some columns with one pixel in them next to a decimal point that we need to say these are spacer columns.
                                                   ;    Like the 4 digit has one column on the right with one pixel, and this will be right next to the decimal point.
                                                ;    Fortunately the decimal point has 2 pixels in it, so that it can be detected as a dp.

   ; FT Pixel Count Digits for table (client width) 472-563
   PixelCountDigits52254 := 0
   PixelCountDigits276 := 1
   PixelCountDigits35335 := 2
   PixelCountDigits33335 := 2
   PixelCountDigits23344 := 3
   PixelCountDigits22276 := 4
   PixelCountDigits53335 := 5
   PixelCountDigits53321 := 6
   PixelCountDigits23321 := 7
   PixelCountDigits43344 := 8
   PixelCountDigits23354 := 9
   PixelCountDigits21 := "."
   PixelCountDigits3333332 := "A"
   PixelCountDigits333335 := "S"


   ; FT Pixel Count Digits for table (client width) 564-682
   PixelCountDigits622265 := 0
   PixelCountDigits287 := 1
   PixelCountDigits333336 := 2
   PixelCountDigits223355 := 3
   PixelCountDigits22287 := 4
   PixelCountDigits533346 := 5
   PixelCountDigits533332 := 6
   PixelCountDigits33321 := 7
   PixelCountDigits533355 := 8
   PixelCountDigits333354 := 9
   PixelCountDigits21 := "."
   PixelCountDigits3433432 := "A"
   PixelCountDigits333346 := "S"

   ; FT Pixel Count Digits for table (client width) 683-841
   PixelCountDigits6822865 := 0
   PixelCountDigits2887 := 1
   PixelCountDigits3544536 := 2
   PixelCountDigits2433855 := 3
   PixelCountDigits222787 := 4
   PixelCountDigits653646 := 5
   PixelCountDigits6833632 := 6
   PixelCountDigits47521 := 7
   PixelCountDigits5833855 := 8
   PixelCountDigits3633865 := 9
   PixelCountDigits221 := "."
   PixelCountDigits36636632 := "A"
   PixelCountDigits4644646 := "S"

   ; FT Pixel Count Special situation below 842-881 - looks like only the 2 digit is different here
   PixelCountDigits23444647 := 2

   ; FT Pixel Count Digits for table (client width) 842-960
   PixelCountDigits79222976 := 0
   PixelCountDigits22998 := 1
   PixelCountDigits33444647 := 2

   PixelCountDigits22333966 := 3
   PixelCountDigits2222998 := 4
   PixelCountDigits5533757 := 5
   PixelCountDigits68433743 := 6
   PixelCountDigits465421 := 7
   PixelCountDigits69333966 := 8
   PixelCountDigits47334865 := 9
   PixelCountDigits221 := "."
   PixelCountDigits2555355521 := "A"
   PixelCountDigits56333656 := "S"

   ; FT Pixel Count Digits for table (client width) 961-1040
   PixelCountDigits684224865 := 0
   PixelCountDigits22AA9 := 1
   PixelCountDigits354435647 := 2
   PixelCountDigits463337735 := 3
   PixelCountDigits22222AA9 := 4
   PixelCountDigits275335647 := 5
   PixelCountDigits685335632 := 6
   PixelCountDigits3555421 := 7
   PixelCountDigits7A3333A77 := 8
   PixelCountDigits365335865 := 9
   PixelCountDigits332 := "."
   PixelCountDigits3556365532 := "A"
   PixelCountDigits475445746 := "S"

   ; FT Pixel Count Digits for table (client width) 1041-1119
   PixelCountDigits8A42224A87 := 0
   PixelCountDigits22CCB := 1
   PixelCountDigits3544445649 := 2
   PixelCountDigits4623337957 := 3
   PixelCountDigits222222CCB := 4
   PixelCountDigits2863335759 := 5
   PixelCountDigits7954335743 := 6
   PixelCountDigits35555421 := 7
   PixelCountDigits5973337957 := 8
   PixelCountDigits4753345976 := 9
   PixelCountDigits332 := "."
   PixelCountDigits355653565532 := "A"
   PixelCountDigits5864446858 := "S"


   coordmode, pixel, Screen
   WindowScaledPos(X, Y, ClientScaleFactor, "Screen", WinId)
   W := Round(W * ClientScaleFactor)
   H := Round(H * ClientScaleFactor)
   PixelGetColor, ColorRGB,X,Y,RGB
      CheckPrimaryColorFlag := 1
      CheckAlternateColorFlag := 0
   Y += Round(H/2)
   TopRowFound := 0
   loop, % Round(H)
   {
      Xpos := X
      PixelCountInRow := 0
      ScanWidth := Round(W*3/4)
      loop,% ScanWidth
      {
         Xpos += 1
         PixelGetColor, ColorRGB,Xpos,Y,RGB
         if (CheckPrimaryColorFlag AND (ColorWithinTolerance(ColorRGB, DigitsColor, DigitsColorTolerance)))
         {
            PixelCountInRow++
            if (PixelCountInRow > FTMaximumAllowedNumPixelsInRowToBeBlank)
               break
         }
      } 
      if (Xpos == (X + ScanWidth))
      {
         TopRowFound := 1
         Y += 1                  ; move back down to the top row of the font
         break
      }
      Y -= 1
   } 
   if NOT TopRowFound
   {
      return ""
   }
   DigitString:=""
   PixelCountForAllDigitsString := ""
   PixelCountForThisDigitString := ""
   loop, %W%
   {
      ColumnNum:= A_Index
      PixelCountInColumn:=0
      FirstPixelPosition := 0
      LastPixelPosition := 0
      loop, %H%
      {
         RowNum:=A_Index
         PixelGetColor, ColorRGB,X+ColumnNum-1,Y+RowNum-1,RGB

         if (ColorWithinTolerance(ColorRGB, DigitsColor, DigitsColorTolerance))
         {
            if (!FirstPixelPosition)
               FirstPixelPosition := RowNum
            LastPixelPosition := RowNum
            PixelCountInColumn++
         }
      }
      if (PixelCountInColumn >= FTMinimumPixelCountPerColumn)
      {
         LastMinusFirstPixelPosition := LastPixelPosition  - FirstPixelPosition
         if (PixelCountInColumn > 9)
         {
            PixelCountInColumn := chr(64 + PixelCountInColumn - 9)
         }
         if PixelCountInColumn is alnum
            PixelCountForThisDigitString .= PixelCountInColumn
      }
      else
      {
         if (PixelCountForThisDigitString != "")
         {

            if (LastMinusFirstPixelPosition > 9)
               LastMinusFirstPixelPosition := chr(64 + LastMinusFirstPixelPosition - 9)
            if LastMinusFirstPixelPosition is alnum
               PixelCountForThisDigitString .= LastMinusFirstPixelPosition
            Temp := "PixelCountDigits"
            DigitString .= %Temp%%PixelCountForThisDigitString%
            PixelCountForAllDigitsString .= PixelCountForThisDigitString . A_Space
            PixelCountForThisDigitString := ""
         }
      }
   }
   Loop,
   {
      StringPosition := instr(DigitString,".")    ; find the first decimal point
      if StringPosition
      {
         if ((strlen(DigitString) - StringPosition) > 2)
            StringReplace, DigitString, DigitString,.,,
         else
            break
      }
      else
         break
   }
   if (DigitString)
   {
      PixelCountForAllDigitsStringReturned := PixelCountForAllDigitsString
      return DigitString
   }
}

ColorWithinTolerance(SampleColor, TestColor, Tolerance) {

   if (SampleColor == TestColor)
      return 1
   If (Tolerance == 0)
      return (SampleColor == TestColor)

    SampleColorRed := SampleColor >> 16
    TestColorRed := TestColor >> 16
    SampleColorGreen:= SampleColor >> 8 & 0xff
    TestColorGreen := TestColor >> 8 & 0xff
    SampleColorBlue := SampleColor & 0xff
    TestColorBlue := TestColor & 0xff
    return (    ( (SampleColorRed + Tolerance >= TestColorRed)     && (SampleColorRed - Tolerance <= TestColorRed) )
        &&      ( (SampleColorGreen + Tolerance >= TestColorGreen) && (SampleColorGreen - Toleranc <= TestColorGreene) )
        &&      ( (SampleColorBlue + Tolerance >= TestColorBlue)   && (SampleColorBlue - Tolerance <= TestColorBlue) )           )
}

WindowScaledPos(ByRef PosX, ByRef PosY, ByRef ClientScaleFactor, ScaleType="Screen", WinId="")
{
   local TitleBarHeight, WindowBottomBorder, WindowSideBorder, WindowTopBorder ,WindowX,WindowY,WindowWidth,WindowHeight
   local ClientWidth, ClientHeight , ClientWidthScaleFactor, ClientHeightScaleFactor

   StandardClientWidth=794
   StandardClientHeight=547

   SysGet, TitleBarHeight, 4
   SysGet, WindowBottomBorder, 32
   SysGet, WindowSideBorder, 33

   WindowTopBorder := TitleBarHeight + WindowBottomBorder
   WinGetPos,WindowX,WindowY,WindowWidth,WindowHeight,ahk_id%WinId%

  ; if this is a poker table, then scale the XY position based on the size of the current table to a standard table size
  ; ifWinExist, ahk_id%WinId%  ahk_group Tables
  ; {
      ClientWidth := WindowWidth - 2 * WindowSideBorder
      ClientHeight := WindowHeight - TitleBarHeight - 2 * WindowBottomBorder
      ClientWidthScaleFactor := ClientWidth / StandardClientWidth
      ClientHeightScaleFactor := ClientHeight / StandardClientHeight 
      ClientScaleFactor := ClientWidthScaleFactor     ; pass back the scaling factor in case the calling function needs it
      PosX := Round(PosX * ClientWidthScaleFactor)
      PosY := Round(PosY * ClientHeightScaleFactor)
  ; }
   
    if (ScaleType == "Client")
   {
      return
   }
   else if (ScaleType == "Window")
   {
      PosX += WindowSideBorder
      PosY += WindowTopBorder
   }

   else if (ScaleType == "Screen")
   {
      PosX += WindowX + WindowSideBorder
      PosY += WindowY + WindowTopBorder
   }
}


BuildGui:
Gui, color, white
Gui, add, tab, h490 w300, General|Global hotkeys|BetPot|Table hotkeys|Time
Gui, Tab, General

Gui, Add, Radio, x36 y70 w180 h20 Checked%ClassicTheme% vClassicTheme, Classic
Gui, Add, Radio, x36 y90 w180 h20 Checked%Racetrack% vRacetrack, Racetrack

Gui, add, text,cRed y125 x85, Use these options
Gui, add, text,cRed y140 x50, if you experience flicker problem
Gui, add, Checkbox, y160 x60 Checked%flicker1% Vflicker1
Gui, add, text, y175 x25,set FullTilt process
Gui, add, text, y190 x25,priority to high
Gui, add, Checkbox, y160 x180 Checked%flicker2% Vflicker2
Gui, add, text, y175 x125,set affinity to cpu1 only
Gui, add, text, y190 x125,for FullTilt process 
Gui, add, text, y205 x125,(Dual-core/HT cpu) 
Gui, add, text,cGreen y235 x25,Turning aero theme off (Vista/W7) might help
Gui, add, text,cGreen y250 x25,if these settings don't work.
Gui, add, text,cGreen y270 x25,It is vital to turn aero off for BetPot function.
Gui, Add, Radio, x26 y300 w220 h15 Checked%ActOnActiveTable% vActOnActiveTable, Send actions to active table
Gui, Add, Radio, x26 y315 w220 h15 Checked%sendundermouse% vsendundermouse, Send actions to table under mouse
Gui, add, text, y335 x25, Activate table under mouse
Gui, add, Checkbox, y335 x220 Checked%activatetableundermouse% Vactivatetableundermouse

Gui, add, text, y365 x25, Highlight table
Gui, add, Checkbox, y365 x100 Checked%Highlight% VHighlight
Gui, Add, Radio, x126 y360 w120 h15 Checked%highlightactive% vhighlightactive, Active
Gui, Add, Radio, x126 y375 w120 h15 Checked%highlighthero% vhighlighthero, With action on hero
Gui, add, text, y405 x25, Move mouse to action buttons
Gui, add, Checkbox, y405 x220 Checked%MoveMouse% VMoveMouse
Gui, add, text, y425 x65, Move mouse from nonfulltilt app
Gui, add, Checkbox, y425 x220 Checked%stealfocus% Vstealfocus

Gui, Add, Button, x75 y455 w55 h20 gSave,Submit
Gui, Add, Button, x135 y455 w55 h20 gCancel,Cancel

Gui, Tab, Global hotkeys

Gui, Add, Text, x25 y75 ,Register
Gui, Add, Edit, x220 y72 w50 h20 vregister, %register%
Gui, Add, Text, x25 y92 ,(join/unjoin waiting list for cash tables)
Gui, Add, Text, x25 y115 ,Unregister
Gui, Add, Edit, x220 y112 w50 h20 vunregister, %unregister%
Gui, Add, Text, x25 y140 ,Join waiting list on all tables
Gui, Add, Edit, x220 y137 w50 h20 vjoinwaitlist, %joinwaitlist%
Gui, Add, Text, x25 y165 ,Unjoin waiting list on all tables
Gui, Add, Edit, x220 y162 w50 h20 vunjoinwaitlist, %unjoinwaitlist%

Gui, Add, Text, x25 y215 ,Activate next table
Gui, Add, Edit, x220 y212 w50 h20 vActivateBottomWindow, %ActivateBottomWindow%
Gui, Add, Text, x25 y245 ,Custom layout 1
Gui, Add, Edit, x220 y242 w50 h20 vlayout1, %layout1%
Gui, Add, Text, x25 y265 ,Custom layout 2
Gui, Add, Edit, x220 y262 w50 h20 vlayout2, %layout2%
Gui, Add, Text, x25 y285 ,Custom layout 3
Gui, Add, Edit, x220 y282 w50 h20 vlayout3, %layout3%

Gui, Add, Text, x25 y315 ,Suspend all hotkeys
Gui, Add, Edit, x220 y312 w50 h20 vsuspend, %suspend%
Gui, Add, Text, x25 y335 ,Pause/unpause
Gui, Add, Edit, x220 y332 w50 h20 vTogglePause, %TogglePause%


Gui, Add, Button, x75 y415 w55 h20 gSave,Submit
Gui, Add, Button, x135 y415 w55 h20 gCancel,Cancel

Gui, Tab, Time

Gui, add, Checkbox, y75 x200 Checked%Timebank% VTimebank
Gui, add, text, y75 x25,Click Timebank automatically
Gui, add, Text, w200 y95 x25, Time delay for pressing Time button 
Gui, add, DropDownList, w40 y90 x220  vInterval1, %ddlist%
Gui, add, text, y135 x25, Click "Deal me in" automatically 
Gui, add, Checkbox, y135 x200 Checked%dealmein% Vdealmein
Gui, Add, Text, x25 y155 w120 h20 , Toggle Deal me in
Gui, Add, Edit, x220 y152 w50 h20 vToggledealmein, %Toggledealmein%
Gui, Add, Text, x25 y180 ,Sitout on all tables
Gui, Add, Edit, x180 y177 w50 h20 vSitOutNextAll, %SitOutNextAll%
Gui, Add, Text, x25 y205 ,Remove sitout on all tables
Gui, Add, Edit, x180 y202 w50 h20 vRemoveSitout, %RemoveSitout%

Gui, Add, Button, x75 y415 w55 h20 gSave,Submit
Gui, Add, Button, x135 y415 w55 h20 gCancel,Cancel

Gui, Tab, Table hotkeys

Gui, Add, Edit, x180 y67 w50 h20 vfold, %fold%
Gui, Add, Text, x25 y70 ,Fold
Gui, Add, Edit, x180 y87 w50 h20 vcall, %call%
Gui, Add, Text, x25 y90 ,Check/Call
Gui, Add, Edit, x180 y107 w50 h20 vraise, %raise%
Gui, Add, Text, x25 y110 ,Bet/Raise
Gui, Add, Edit, x180 y127 w50 h20 vfold2any, %fold2any%
Gui, Add, Text, x25 y130 ,Fold to any
Gui, Add, Edit, x180 y147 w50 h20 vfold2any400, %fold2any400%
Gui, Add, Text, x25 y150 ,Fold to any nl400

Gui, Add, Button, x75 y315 w55 h20 gSave,Submit
Gui, Add, Button, x135 y315 w55 h20 gCancel,Cancel


Gui, Tab, BetPot

Gui, add, Checkbox, y55 x180 Checked%autopot% Vautopot
Gui, add, text, y55 x25,Auto put bet into bet box
Gui, Add, Text, x15 y70 ,Pre*
Gui, Add, Edit, x15 y85 w25 h20 vPotDefPre, %PotDefPre%
Gui, Add, Text, x45 y70 ,Flop*
Gui, Add, Edit, x45 y85 w25 h20 vPotDefFlop, %PotDefFlop%
Gui, Add, Text, x75 y70 ,Turn*
Gui, Add, Edit, x75 y85 w25 h20 vPotDefTurn, %PotDefTurn%
Gui, Add, Text, x105 y70 ,River*
Gui, Add, Edit, x105 y85 w25 h20 vPotDefRiver, %PotDefRiver%
Gui, Add, Text, x140 y70 ,Open
Gui, add, DropDownList, w45 y85 x140  vOpenDef, %ddlist1%
Gui, Add, Text, x175 y70 ,Round(sb)
Gui, add, Checkbox, y85 x200 Checked%RoundDef% VRoundDef
Gui, Add, Text, x230 y70 ,Fix blinds
Gui, add, Checkbox, y85 x250 Checked%FixDef% VFixDef

Gui, Add, Edit, x60 y107 w80 h20 vpot1, %pot1%
Gui, Add, Text, x15 y110 ,Pot1
Gui, Add, Text, x15 y130 ,Pre*
Gui, Add, Edit, x15 y145 w25 h20 vPot1Pre, %Pot1Pre%
Gui, Add, Text, x45 y130 ,Flop*
Gui, Add, Edit, x45 y145 w25 h20 vPot1Flop, %Pot1Flop%
Gui, Add, Text, x75 y130 ,Turn*
Gui, Add, Edit, x75 y145 w25 h20 vPot1Turn, %Pot1Turn%
Gui, Add, Text, x105 y130 ,River*
Gui, Add, Edit, x105 y145 w25 h20 vPot1River, %Pot1River%
Gui, Add, Text, x140 y130 ,Open
Gui, add, DropDownList, w45 y145 x140  vOpen1, %ddlist1%
Gui, Add, Text, x175 y130 ,Round(sb)
Gui, add, Checkbox, y145 x200 Checked%Round1% VRound1
Gui, Add, Text, x230 y130 ,Fix blinds
Gui, add, Checkbox, y145 x250 Checked%Fix1% VFix1

Gui, Add, Edit, x60 y167 w80 h20 vpot2, %pot2%
Gui, Add, Text, x15 y170 ,Pot2
Gui, Add, Edit, x15 y190 w25 h20 vPot2Pre, %Pot2Pre%
Gui, Add, Edit, x45 y190 w25 h20 vPot2Flop, %Pot2Flop%
Gui, Add, Edit, x75 y190 w25 h20 vPot2Turn, %Pot2Turn%
Gui, Add, Edit, x105 y190 w25 h20 vPot2River, %Pot2River%
Gui, add, DropDownList, w45 y190 x140  vOpen2, %ddlist1%
Gui, add, Checkbox, y190 x200 Checked%Round2% VRound2
Gui, add, Checkbox, y190 x250 Checked%Fix2% VFix2

Gui, Add, Edit, x60 y212 w80 h20 vpot3, %pot3%
Gui, Add, Text, x15 y215 ,Pot3
Gui, Add, Edit, x15 y235 w25 h20 vPot3Pre, %Pot3Pre%
Gui, Add, Edit, x45 y235 w25 h20 vPot3Flop, %Pot3Flop%
Gui, Add, Edit, x75 y235 w25 h20 vPot3Turn, %Pot3Turn%
Gui, Add, Edit, x105 y235 w25 h20 vPot3River, %Pot3River%
Gui, add, DropDownList, w45 y235 x140  vOpen3, %ddlist1%
Gui, add, Checkbox, y235 x200 Checked%Round3% VRound3
Gui, add, Checkbox, y235 x250 Checked%Fix3% VFix3

Gui, add, Checkbox, y260 x210 Checked%autobet% Vautobet
Gui, add, text, y260 x55,Additionally press bet button

Gui, Add, Edit, x80 y282 w40 h20 vincr1, %incr1%
Gui, Add, Text, x15 y285 ,Increase by
Gui, Add, Radio, x125 y280 w40 h15 Checked%bb1% vbb1,bb
Gui, Add, Radio, x125 y295 w40 h15 Checked%sb1% vsb1,sb
Gui, Add, Edit, x190 y282 w80 h20 valt1, %alt1%

Gui, Add, Edit, x80 y312 w40 h20 vincr2, %incr2%
Gui, Add, Text, x15 y315 ,Decrease by
Gui, Add, Radio, x125 y310 w40 h15 Checked%bb2% vbb2,bb
Gui, Add, Radio, x125 y325 w40 h15 Checked%sb2% vsb2,sb
Gui, Add, Edit, x190 y312 w80 h20 valt2, %alt2%

Gui, Add, Edit, x80 y342 w40 h20 vincr3, %incr3%
Gui, Add, Text, x15 y345 ,Increase by
Gui, Add, Radio, x125 y340 w40 h15 Checked%bb3% vbb3,bb
Gui, Add, Radio, x125 y355 w40 h15 Checked%sb3% vsb3,sb
Gui, Add, Edit, x190 y342 w80 h20 valt3, %alt3%

Gui, Add, Edit, x80 y372 w40 h20 vincr4, %incr4%
Gui, Add, Text, x15 y375 ,Decrease by
Gui, Add, Radio, x125 y370 w40 h15 Checked%bb4% vbb4,bb
Gui, Add, Radio, x125 y385 w40 h15 Checked%sb4% vsb4,sb
Gui, Add, Edit, x190 y372 w80 h20 valt4, %alt4%

Gui, Add, Text, x15 y400 ,Attempts to read Pot amount from screen
Gui, Add, Edit, x230 y397 w25 h20 vattempts, %attempts%

Gui, Add, Text, x15 y420 ,* Pot percent

Gui, add, text,cRed y440 x35,BetPot function won't be efficient with aero theme on

Gui, Add, Button, x75 y460 w55 h20 gSave,Submit
Gui, Add, Button, x135 y460 w55 h20 gCancel,Cancel

Gosub, GetIni
Gui, show, w316, %thisahk%
Return
;-----------------------------------------------------------------------------------------------------
GetIni:
Settitlematchmode,2
IfNotExist, %thisahk%.ini
gosub, CreateIni
IniRead, ClassicTheme,%thisahk%.ini, Options, ClassicTheme,0
IniRead, Racetrack,%thisahk%.ini, Options, Racetrack,0
IniRead, ActOnActiveTable, %thisahk%.ini, Options, ActOnActiveTable, 0
IniRead, sendundermouse, %thisahk%.ini, Options, sendundermouse, 0
IniRead, activatetableundermouse, %thisahk%.ini, Settings, activatetableundermouse, 0
IniRead, Highlight, %thisahk%.ini, Settings, Highlight, 0
IniRead, highlighthero, %thisahk%.ini, Options, highlighthero, 0
IniRead, highlightactive, %thisahk%.ini, Options, highlightactive, 0
IniRead, MoveMouse, %thisahk%.ini, Settings, MoveMouse, 0
IniRead, stealfocus, %thisahk%.ini, Settings, stealfocus, 0

IniRead, Interval1, %thisahk%.ini, Settings, Interval1
StringReplace, ddlist, ddlist, %interval1%, %Interval1%|
GuiControl, , Interval1, |%ddlist%
StringReplace, ddlist, ddlist, %interval1%|, %Interval1%
IniRead, flicker1, %thisahk%.ini, Settings, flicker1, 0
IniRead, flicker2, %thisahk%.ini, Settings, flicker2, 0
IniRead, dealmein, %thisahk%.ini, Settings, dealmein, 0
IniRead, Toggledealmein, %thisahk%.ini, Settings, Toggledealmein,%A_Space%
If Toggledealmein
{
HotKey, IfWinActive, ahk_class QWidget
Hotkey, %Toggledealmein%, Toggledealmein
}
IniRead, Timebank, %thisahk%.ini, Settings, Timebank, 0
IniRead, SitOutNextAll, %thisahk%.ini, Hotkeys, SitOutNextAll,%A_Space%
IniRead, RemoveSitout, %thisahk%.ini, Hotkeys, RemoveSitout,%A_Space%
if SitOutNextAll
Hotkey, %SitOutNextAll%,SitOutNextAll
if RemoveSitout
Hotkey, %RemoveSitout%,RemoveSitout

IniRead, register, %thisahk%.ini, Settings, register,%A_Space%
IniRead, unregister, %thisahk%.ini, Settings, unregister,%A_Space%
IniRead, joinwaitlist, %thisahk%.ini, Settings, joinwaitlist,%A_Space%
IniRead, Unjoinwaitlist, %thisahk%.ini, Settings, Unjoinwaitlist,%A_Space%
if register
Hotkey, %register%,register
if unregister
Hotkey, %unregister%,unregister
if joinwaitlist
Hotkey, %joinwaitlist%,joinwaitlist
if Unjoinwaitlist
Hotkey, %Unjoinwaitlist%,Unjoinwaitlist
IniRead, ActivateBottomWindow, %thisahk%.ini, Hotkeys, ActivateBottomWindow,%A_Space%
if ActivateBottomWindow
Hotkey, %ActivateBottomWindow%,ActivateBottomWindow
IniRead, suspend, %thisahk%.ini, Hotkeys, suspend,%A_Space%
if suspend
Hotkey, %suspend%,suspend
IniRead, TogglePause, %thisahk%.ini, Hotkeys, TogglePause,%A_Space%
if TogglePause
Hotkey, %TogglePause%,TogglePause
IniRead, layout1, %thisahk%.ini, Hotkeys, layout1,%A_Space%
if layout1
Hotkey, %layout1%,layout1
IniRead, layout2, %thisahk%.ini, Hotkeys, layout2,%A_Space%
if layout2
Hotkey, %layout2%,layout2
IniRead, layout3, %thisahk%.ini, Hotkeys, layout3,%A_Space%
if layout3
Hotkey, %layout3%,layout3


IniRead, fold, %thisahk%.ini, Hotkeys, fold,%A_Space%
IniRead, call, %thisahk%.ini, Hotkeys, call,%A_Space%
IniRead, raise, %thisahk%.ini, Hotkeys, raise,%A_Space%
IniRead, fold2any, %thisahk%.ini, Hotkeys, fold2any,%A_Space%
IniRead, fold2any400, %thisahk%.ini, Hotkeys, fold2any400,%A_Space%
if fold
{
;HotKey, IfWinActive, ahk_class QWidget
HotKey, IfWinActive
Hotkey, %fold%,fold
}
if call
{
;HotKey, IfWinActive, ahk_class QWidget
HotKey, IfWinActive
Hotkey, %call%,call
}
if raise
{
;HotKey, IfWinActive, ahk_class QWidget
HotKey, IfWinActive
Hotkey, %raise%,raise
}
if fold2any
{
;HotKey, IfWinActive, ahk_class QWidget
HotKey, IfWinActive
Hotkey, %fold2any%,fold2any
}
if fold2any400
{
;HotKey, IfWinActive, ahk_class QWidget
HotKey, IfWinActive
Hotkey, %fold2any400%,fold2any400
}

IniRead, OpenDef, %thisahk%.ini, BetPotSettings, OpenDef
StringReplace, ddlist1, ddlist1, %OpenDef%, %OpenDef%|
GuiControl, , OpenDef, |%ddlist1%
StringReplace, ddlist1, ddlist1, %OpenDef%|, %OpenDef%
IniRead, RoundDef, %thisahk%.ini, BetPotSettings, RoundDef, 0
IniRead, FixDef, %thisahk%.ini, BetPotSettings, FixDef, 0
IniRead, PotDefPre, %thisahk%.ini, BetPotSettings, PotDefPre, 0
IniRead, PotDefFlop, %thisahk%.ini, BetPotSettings, PotDefFlop, 0
IniRead, PotDefTurn, %thisahk%.ini, BetPotSettings, PotDefTurn, 0
IniRead, PotDefRiver, %thisahk%.ini, BetPotSettings, PotDefRiver, 0

IniRead, Open1, %thisahk%.ini, BetPotSettings, Open1
StringReplace, ddlist1, ddlist1, %Open1%, %Open1%|
GuiControl, , Open1, |%ddlist1%
StringReplace, ddlist1, ddlist1, %Open1%|, %Open1%
IniRead, Round1, %thisahk%.ini, BetPotSettings, Round1, 0
IniRead, Fix1, %thisahk%.ini, BetPotSettings, Fix1, 0
IniRead, Pot1Pre, %thisahk%.ini, BetPotSettings, Pot1Pre, 0
IniRead, Pot1Flop, %thisahk%.ini, BetPotSettings, Pot1Flop, 0
IniRead, Pot1Turn, %thisahk%.ini, BetPotSettings, Pot1Turn, 0
IniRead, Pot1River, %thisahk%.ini, BetPotSettings, Pot1River, 0
IniRead, pot1, %thisahk%.ini, BetPotHotkeys, pot1,%A_Space%
if pot1
{
;HotKey, IfWinActive,ahk_class QWidget
HotKey, IfWinActive
Hotkey, %pot1%,pot1
}
IniRead, Open2, %thisahk%.ini, BetPotSettings, Open2
StringReplace, ddlist1, ddlist1, %Open2%, %Open2%|
GuiControl, , Open2, |%ddlist1%
StringReplace, ddlist1, ddlist1, %Open2%|, %Open2%
IniRead, Round2, %thisahk%.ini, BetPotSettings, Round2, 0
IniRead, Fix2, %thisahk%.ini, BetPotSettings, Fix2, 0
IniRead, Pot2Pre, %thisahk%.ini, BetPotSettings, Pot2Pre, 0
IniRead, Pot2Flop, %thisahk%.ini, BetPotSettings, Pot2Flop, 0
IniRead, Pot2Turn, %thisahk%.ini, BetPotSettings, Pot2Turn, 0
IniRead, Pot2River, %thisahk%.ini, BetPotSettings, Pot2River, 0
IniRead, pot2, %thisahk%.ini, BetPotHotkeys, pot2,%A_Space%
if pot2
{
;HotKey, IfWinActive,ahk_class QWidget
HotKey, IfWinActive
Hotkey, %pot2%,pot2
}
IniRead, Open3, %thisahk%.ini, BetPotSettings, Open3
StringReplace, ddlist1, ddlist1, %Open3%, %Open3%|
GuiControl, , Open3, |%ddlist1%
StringReplace, ddlist1, ddlist1, %Open3%|, %Open3%
IniRead, Round3, %thisahk%.ini, BetPotSettings, Round3, 0
IniRead, Fix3, %thisahk%.ini, BetPotSettings, Fix3, 0
IniRead, Pot3Pre, %thisahk%.ini, BetPotSettings, Pot3Pre, 0
IniRead, Pot3Flop, %thisahk%.ini, BetPotSettings, Pot3Flop, 0
IniRead, Pot3Turn, %thisahk%.ini, BetPotSettings, Pot3Turn, 0
IniRead, Pot3River, %thisahk%.ini, BetPotSettings, Pot3River, 0
IniRead, pot3, %thisahk%.ini, BetPotHotkeys, pot3,%A_Space%
if pot3
{
;HotKey, IfWinActive,ahk_class QWidget
HotKey, IfWinActive
Hotkey, %pot3%,pot3
}

IniRead, incr1, %thisahk%.ini, BetPotSettings, incr1, 0
IniRead, bb1, %thisahk%.ini, BetPotSettings, bb1, 0
IniRead, sb1, %thisahk%.ini, BetPotSettings, sb1, 0
IniRead, alt1, %thisahk%.ini, BetPotHotkeys, alt1, %A_Space%
if alt1
{
HotKey, IfWinActive, ahk_class QWidget
Hotkey, %alt1%,alt1
}
IniRead, incr2, %thisahk%.ini, BetPotSettings, incr2, 0
IniRead, bb2, %thisahk%.ini, BetPotSettings, bb2, 0
IniRead, sb2, %thisahk%.ini, BetPotSettings, sb2, 0
IniRead, alt2, %thisahk%.ini, BetPotHotkeys, alt2, %A_Space%
if alt2
{
HotKey, IfWinActive, ahk_class QWidget
Hotkey, %alt2%,alt2
}
IniRead, incr3, %thisahk%.ini, BetPotSettings, incr3, 0
IniRead, bb3, %thisahk%.ini, BetPotSettings, bb3, 0
IniRead, sb3, %thisahk%.ini, BetPotSettings, sb3, 0
IniRead, alt3, %thisahk%.ini, BetPotHotkeys, alt3, %A_Space%
if alt3
{
HotKey, IfWinActive, ahk_class QWidget
Hotkey, %alt3%,alt3
}
IniRead, incr4, %thisahk%.ini, BetPotSettings, incr4, 0
IniRead, bb4, %thisahk%.ini, BetPotSettings, bb4, 0
IniRead, sb4, %thisahk%.ini, BetPotSettings, sb4, 0
IniRead, alt4, %thisahk%.ini, BetPotHotkeys, alt4, %A_Space%
if alt4
{
HotKey, IfWinActive, ahk_class QWidget
Hotkey, %alt4%,alt4
}

IniRead, autopot, %thisahk%.ini, BetPotSettings, autopot, 0
IniRead, autobet, %thisahk%.ini, BetPotSettings, autobet, 0
IniRead, attempts, %thisahk%.ini, BetPotVariables, attempts, 0
Return
;-----------------------------------------------------------------------------------------------------
MakeIni:
If ClassicTheme
IniWrite, %ClassicTheme%, %thisahk%.ini, Options, ClassicTheme
If Racetrack
IniWrite, %Racetrack%, %thisahk%.ini, Options, Racetrack
if ActOnActiveTable
IniWrite, %ActOnActiveTable%, %thisahk%.ini, Options, ActOnActiveTable
if sendundermouse
IniWrite, %sendundermouse%, %thisahk%.ini, Options, sendundermouse
IniWrite, %activatetableundermouse%, %thisahk%.ini, Settings, activatetableundermouse
IniWrite, %Highlight%, %thisahk%.ini, Settings, Highlight
if highlighthero
IniWrite, %highlighthero%, %thisahk%.ini, Options, highlighthero
if highlightactive
IniWrite, %highlightactive%, %thisahk%.ini, Options, highlightactive
IniWrite, %MoveMouse%, %thisahk%.ini, Settings, MoveMouse
IniWrite, %stealfocus%, %thisahk%.ini, Settings, stealfocus
IniWrite, %Interval1%, %thisahk%.ini, Settings, Interval1
IniWrite, %flicker1%, %thisahk%.ini, Settings, flicker1
IniWrite, %flicker2%, %thisahk%.ini, Settings, flicker2
IniWrite, %dealmein%, %thisahk%.ini, Settings, dealmein
if Toggledealmein
IniWrite, %Toggledealmein%, %thisahk%.ini, Settings, Toggledealmein
IniWrite, %Timebank%, %thisahk%.ini, Settings, Timebank
if SitOutNextAll
IniWrite, %SitOutNextAll%, %thisahk%.ini, Hotkeys, SitOutNextAll
if RemoveSitout
IniWrite, %RemoveSitout%, %thisahk%.ini, Hotkeys, RemoveSitout

if register
IniWrite, %register%, %thisahk%.ini, Settings, register
if unregister
IniWrite, %unregister%, %thisahk%.ini, Settings, unregister
if joinwaitlist
IniWrite, %joinwaitlist%, %thisahk%.ini, Settings, joinwaitlist
if Unjoinwaitlist
IniWrite, %Unjoinwaitlist%, %thisahk%.ini, Settings, Unjoinwaitlist
if ActivateBottomWindow
IniWrite, %ActivateBottomWindow%, %thisahk%.ini, Hotkeys, ActivateBottomWindow
if suspend
IniWrite, %suspend%, %thisahk%.ini, Hotkeys, suspend
if TogglePause
IniWrite, %TogglePause%, %thisahk%.ini, Hotkeys, TogglePause
if layout1
IniWrite, %layout1%, %thisahk%.ini, Hotkeys, layout1
if layout2
IniWrite, %layout2%, %thisahk%.ini, Hotkeys, layout2
if layout3
IniWrite, %layout3%, %thisahk%.ini, Hotkeys, layout3


if fold
IniWrite, %fold%, %thisahk%.ini, Hotkeys, fold
if call
IniWrite, %call%, %thisahk%.ini, Hotkeys, call
if raise
IniWrite, %raise%, %thisahk%.ini, Hotkeys, raise
if fold2any
IniWrite, %fold2any%, %thisahk%.ini, Hotkeys, fold2any
if fold2any400
IniWrite, %fold2any400%, %thisahk%.ini, Hotkeys, fold2any400

IniWrite, %OpenDef%, %thisahk%.ini, BetPotSettings, OpenDef
IniWrite, %RoundDef%, %thisahk%.ini, BetPotSettings, RoundDef
IniWrite, %FixDef%, %thisahk%.ini, BetPotSettings, FixDef
IniWrite, %PotDefPre%, %thisahk%.ini, BetPotSettings, PotDefPre
IniWrite, %PotDefFlop%, %thisahk%.ini, BetPotSettings, PotDefFlop
IniWrite, %PotDefTurn%, %thisahk%.ini, BetPotSettings, PotDefTurn
IniWrite, %PotDefRiver%, %thisahk%.ini, BetPotSettings, PotDefRiver

IniWrite, %Open1%, %thisahk%.ini, BetPotSettings, Open1
IniWrite, %Round1%, %thisahk%.ini, BetPotSettings, Round1
IniWrite, %Fix1%, %thisahk%.ini, BetPotSettings, Fix1
IniWrite, %Pot1Pre%, %thisahk%.ini, BetPotSettings, Pot1Pre
IniWrite, %Pot1Flop%, %thisahk%.ini, BetPotSettings, Pot1Flop
IniWrite, %Pot1Turn%, %thisahk%.ini, BetPotSettings, Pot1Turn
IniWrite, %Pot1River%, %thisahk%.ini, BetPotSettings, Pot1River
if pot1
IniWrite, %pot1%, %thisahk%.ini, BetPotHotkeys, pot1

IniWrite, %Open2%, %thisahk%.ini, BetPotSettings, Open2
IniWrite, %Round2%, %thisahk%.ini, BetPotSettings, Round2
IniWrite, %Fix2%, %thisahk%.ini, BetPotSettings, Fix2
IniWrite, %Pot2Pre%, %thisahk%.ini, BetPotSettings, Pot2Pre
IniWrite, %Pot2Flop%, %thisahk%.ini, BetPotSettings, Pot2Flop
IniWrite, %Pot2Turn%, %thisahk%.ini, BetPotSettings, Pot2Turn
IniWrite, %Pot2River%, %thisahk%.ini, BetPotSettings, Pot2River
if pot2
IniWrite, %pot2%, %thisahk%.ini, BetPotHotkeys, pot2

IniWrite, %Open3%, %thisahk%.ini, BetPotSettings, Open3
IniWrite, %Round3%, %thisahk%.ini, BetPotSettings, Round3
IniWrite, %Fix3%, %thisahk%.ini, BetPotSettings, Fix3
IniWrite, %Pot3Pre%, %thisahk%.ini, BetPotSettings, Pot3Pre
IniWrite, %Pot3Flop%, %thisahk%.ini, BetPotSettings, Pot3Flop
IniWrite, %Pot3Turn%, %thisahk%.ini, BetPotSettings, Pot3Turn
IniWrite, %Pot3River%, %thisahk%.ini, BetPotSettings, Pot3River
if pot3
IniWrite, %pot3%, %thisahk%.ini, BetPotHotkeys, pot3


IniWrite, %incr1%, %thisahk%.ini, BetPotSettings, incr1
if bb1
IniWrite, %bb1%, %thisahk%.ini, BetPotSettings, bb1
if sb1
IniWrite, %sb1%, %thisahk%.ini, BetPotSettings, sb1
if alt1
IniWrite, %alt1%, %thisahk%.ini, BetPotHotkeys, alt1

IniWrite, %incr2%, %thisahk%.ini, BetPotSettings, incr2
if bb2
IniWrite, %bb2%, %thisahk%.ini, BetPotSettings, bb2
if sb2
IniWrite, %sb2%, %thisahk%.ini, BetPotSettings, sb2
if alt2
IniWrite, %alt2%, %thisahk%.ini, BetPotHotkeys, alt2

IniWrite, %incr3%, %thisahk%.ini, BetPotSettings, incr3
if bb3
IniWrite, %bb3%, %thisahk%.ini, BetPotSettings, bb3
if sb3
IniWrite, %sb3%, %thisahk%.ini, BetPotSettings, sb3
if alt3
IniWrite, %alt3%, %thisahk%.ini, BetPotHotkeys, alt3

IniWrite, %incr4%, %thisahk%.ini, BetPotSettings, incr4
if bb4
IniWrite, %bb4%, %thisahk%.ini, BetPotSettings, bb4
if sb4
IniWrite, %sb4%, %thisahk%.ini, BetPotSettings, sb4
if alt4
IniWrite, %alt4%, %thisahk%.ini, BetPotHotkeys, alt4


IniWrite, %autopot%, %thisahk%.ini, BetPotSettings, autopot
IniWrite, %autobet%, %thisahk%.ini, BetPotSettings, autobet
IniWrite, %attempts%, %thisahk%.ini, BetPotVariables, attempts

Return
;-----------------------------------------------------------------------------------------------------
CreateIni:
Racetrack:=0
ClassicTheme:=1
ActOnActiveTable:=1
sendundermouse:=0
activatetableundermouse:=0
Highlight:=0
highlighthero:=0
highlightactive:=1
MoveMouse:=0
stealfocus:=1

flicker1:=1
flicker2:=0
Interval1:=1
dealmein:=0
Timebank:=0

register=^r
unregister=^u

autopot:=0
autobet:=0
OpenDef=ssnl
Open1=ssnl
Open2=trny
Open3=----
RoundDef:=1
Round1:=1
Round2:=1
Round3:=1
fixDef:=1
fix1:=1
fix2:=1
fix3:=1
PotDefPre:=75
PotDefFlop:=75
PotDefTurn:=66
PotDefRiver:=66
Pot1Pre:=75
Pot1Flop:=75
Pot1Turn:=66
Pot1River:=66
Pot2Pre:=100
Pot2Flop:=80
Pot2Turn:=80
Pot2River:=80
Pot3Pre:=999
Pot3Flop:=100
Pot3Turn:=100
Pot3River:=100
Pot1=mbutton
Pot2=xbutton1
Pot3=xbutton2
incr1:=1
incr2:=1
incr3:=1
incr4:=1
bb1:=1
sb1:=0
bb2:=1
sb2:=0
bb3:=0
sb3:=1
bb4:=0
sb4:=1
alt1=wheelup
alt2=wheeldown
alt3=^wheelup
alt4=^wheeldown
attempts:=1

gosub, MakeIni
gosub, buildgui
return
;-----------------------------------------------------------------------------------------------------
GuiClose:
gosub, cancel
return
;-----------------------------------------------------------------------------------------------------
menuGui:
gosub, getini
winget,id,id, %thisahk% ahk_class AutoHotkeyGUI
if !DllCall( "IsWindowVisible", "UInt",id)
gosub, buildgui
else
winactivate,ahk_id%id%
Gui, Submit,nohide
return
;-----------------------------------------------------------------------------------------------------
reload:
reload
return
;-----------------------------------------------------------------------------------------------------
Save:
Gui, Submit
FileDelete, %thisahk%.ini
gosub, MakeIni
Reload
return
;-----------------------------------------------------------------------------------------------------
Cancel:
Gui, Destroy
Return
;-----------------------------------------------------------------------------------------------------
TogglePause:
pause,toggle
return
;-----------------------------------------------------------------------------------------------------
Suspend:
suspend
if A_IsSuspended=0
{
 T=Off
}
else
{
 T=On
}
Gui, 13:Add, Text,,Suspend: %T%
Gui, 13:+ToolWindow
Gui, 13:Show, w150 h20
Sleep, 1500
Gui, 3:Destroy
return
;-----------------------------------------------------------------------------------------------------
Edit:
edit
return
;-----------------------------------------------------------------------------------------------------
exitSub:
if flicker1
{
Process, Exist, FullTiltPoker.exe
if (ErrorLevel)
{
  FTP := ErrorLevel
  Process, Priority, %FTP%, Normal
;  SetAffinity(FTP)
}
}
;FileDelete, %thisahk%.ini
;gosub, makeini
exitApp
return
;-----------------------------------------------------------------------------------------------------
FTCash - free script for FullTilt cash players. Quote
03-14-2010 , 04:24 PM
That version... works! I tested it on multiple tables from 1/2 - 3/6.

Can you make a modification for the script to stay open until I manually exit or kill the process? I have my own start/stop scripts for poker related applications, and FTCash seems to be closing even when I keep the client open but don't have tables open...

PM me your FTP name for donation, thanks again
FTCash - free script for FullTilt cash players. Quote
03-14-2010 , 05:30 PM
Here i've made a fix for table hotkeys not always working issue
Code:
; #### FTCash ####

; AHK version: 1.0.48.05
; date: March 14,2010
  version := "1.02b"
; author: Max1mums (max1mums@overcards.com)

#SingleInstance, Force
#NoEnv
#Persistent
Settitlematchmode, 2
OnExit exitSub

StringTrimRight, thisahk, A_ScriptName, 4
SetWorkingDir %A_ScriptDir%

Menu, Tray, NoStandard
Menu, Tray, Add, Settings, menugui
Menu, Tray, Add 
Menu, Tray, Add, Reload, reload
Menu, Tray, Default, Settings
Menu, Tray, Add 
Menu, Tray, Add, Suspend, Suspend
Menu, Tray, Add, Pause, TogglePause
Menu, Tray, Add 
Menu, Tray, Add, Edit, Edit 
Menu, Tray, Add 
Menu, Tray, Add, Exit, ExitSub

OnMessage(0x112,"WM_SYSCOMMAND")
WM_SYSCOMMAND(wParam)
{
  if (A_Gui && wParam = 0xF020) ; SC_MINIMIZE
  {
    Gui, destroy
    return 0
  }
}

boost:=false
; Border of the "Highlighter"
border_color := "ff0000"
border_size := 5
trans := 255

debug:=0

SetBatchLines,-1
SetWinDelay,-1
SendMode Input

SysGet, xbord, 32
SysGet, ybord, 33
SysGet, cap, 4
SysGet, border, 32
SysGet, caption, 4

time_x:=0.9093
time_y:=0.7200
time_x1:=0.8808
t1:=0xdedbde
v:=25
back_x:=0.6534
back_y:=0.9862
back_x1:=0.5859
back1:=0x181818
v1:=5
join_x:=0.6158
join_y:=0.9292
join_x1:=0.8261
join:=0xffffff
v2:=5
once:=true
tablequeue=
ddlist=
Loop 14
ddlist:=ddlist . A_index . "|"

ddlist1=
ddlist1.="ssnl" . "|"
ddlist1.="trny" . "|"
ddlist1.="mix" . "|"
ddlist1.="----" . "|"
gosub,getini

ifwinnotexist,FullTiltPoker ahk_class QWidget
{
if flicker1
{
winwait,Logged In ahk_class QWidget
Process, Exist, FullTiltPoker.exe
if (ErrorLevel)
{
  FTP := ErrorLevel
  Process, Priority, %FTP%, High
}
}
else
{
Process, Exist, FullTiltPoker.exe
if (ErrorLevel)
{
  FTP := ErrorLevel
  Process, Priority, %FTP%, Normal
}
}
if flicker2
{
winwait,Logged In ahk_class QWidget
Process, Exist, AutoHotkey.exe
if (ErrorLevel)
{
  Ahk := ErrorLevel
;  SetAffinity(Ahk,0)
 SetAffinity(Ahk)
}
Process, Exist, FullTiltPoker.exe
if (ErrorLevel)
{
  FTP := ErrorLevel
;  SetAffinity(FTP,0)
 SetAffinity(FTP)
}
}
}
else
ifwinnotexist,Full Tilt Poker - ahk_class QWidget
winwaitclose,FullTiltPoker ahk_class QWidget



;;;;;;;;;;;;End of init;;;;;;;;;;;;;;

if Timebank
settimer,clickwithdelay,100
if autopot OR Highlight 
settimer,act,55
if Highlight
settimer,Highlighter,43
if dealmein OR Timebank
settimer,check,639
settimer,Colorinit,187
if MoveMouse
settimer,MouseMove,119
settimer,BetPot,87
settimer,onFTclose,1078
if activatetableundermouse
settimer,activateundermouse,133

return

;-----------------------------------------------------------------------------------------------------
onFTclose:
Settitlematchmode, 3
ifwinexist,FullTiltPoker ahk_class QWidget
ifwinnotexist,Full Tilt Poker - ahk_class QWidget
{
exitapp
}
Settitlematchmode, 2
return
;-----------------------------------------------------------------------------------------------------
FoldFT(id)
{
  PostclickFT(0.6834,0.9358,id)
  PostclickFT(0.6834,0.9358,id)
}
CallFT(id)
{
  PostclickFT(0.8032,0.9358,id)
  PostclickFT(0.8032,0.9358,id)
}
RaiseFT(id)
{
  PostclickFT(0.9356,0.9358,id)
  PostclickFT(0.9356,0.9358,id)
}
Fold2anyFT(id)
{
global Racetrack
WinGetTitle, title, ahk_id%id%
StringMid, bb, title, InStr(title, "/") + 1, InStr(title, a_space,"", InStr(title, "/")) - InStr(title, "/") - 1
StringReplace,bb,bb,$,,1
if Racetrack
{
 if bb<4
 {
  click_x:=0.4325
  click_y:=0.8937
 }
 else
 {
  click_x:=0.4193
  click_y:=0.9169
 }
}
else
{
 if bb<4
 {
  click_x:=0.0088
  click_y:=0.7472
 }
 else
 {
  click_x:=0.0088
  click_y:=0.7566
 }
}
PostclickFT(click_x,click_y,id)
}
;-----------------------------------------------------------------------------------------------------
fold:
sendmode event
If ActOnActiveTable
WinGet, Id, ID, A
else
MousegetPos,,,ID
wingetclass,class,ahk_id%id%
if class=QWidget
{
 FoldFT(id)
}
else
{
;ControlGetFocus,ctrl,ahk_id%id%
;ControlSend,%ctrl%,%fold%,ahk_id%id%
send {%fold%}
}
sendmode input
return



call:
sendmode event
If ActOnActiveTable
WinGet, Id, ID, A
else
MousegetPos,,,ID
wingetclass,class,ahk_id%id%
if class=QWidget
{
 callFT(id)
}
else
{
;ControlGetFocus,ctrl,ahk_id%id%
;ControlSend,%ctrl%,%call%,ahk_id%id%
send {%call%}
}
sendmode input
return

raise:
sendmode event
If ActOnActiveTable
WinGet, Id, ID, A
else
MousegetPos,,,ID
wingetclass,class,ahk_id%id%
if class=QWidget
{
 raiseFT(id)
}
else
{
;ControlGetFocus,ctrl,ahk_id%id%
;ControlSend,%ctrl%,%raise%,ahk_id%id%
send {%raise%}
}
sendmode input
return

fold2any:
sendmode event
If ActOnActiveTable
WinGet, Id, ID, A
else
MousegetPos,,,ID
wingetclass,class,ahk_id%id%
if class=QWidget
{
 fold2anyFT(id)
}
else
{
;ControlGetFocus,ctrl,ahk_id%id%
;ControlSend,%ctrl%,%fold2any%,ahk_id%id%
send {%fold2any%}
}
sendmode input
return
;-----------------------------------------------------------------------------------------------------
pot1:
If ActOnActiveTable
WinGet, id, id, A
else
MousegetPos,,,id
if Round1
Roundsb:="smallblind"
else
Roundsb:=0.2
Pot(id,Pot1Pre A_space Pot1Flop A_space Pot1Turn A_space Pot1River, Roundsb, Open1, fix1)
if autobet
raiseFT(id)
return

pot2:
If ActOnActiveTable
WinGet, id, id, A
else
MousegetPos,,,id
if Round2
Roundsb:="smallblind"
else
Roundsb:=0.2
Pot(id,Pot2Pre A_space Pot2Flop A_space Pot2Turn A_space Pot2River, Roundsb, Open2, fix2)
if autobet
raiseFT(id)
return

pot3:
If ActOnActiveTable
WinGet, id, id, A
else
MousegetPos,,,id
if Round3
Roundsb:="smallblind"
else
Roundsb:=0.2
Pot(id,Pot3Pre A_space Pot3Flop A_space Pot3Turn A_space Pot3River, Roundsb, Open3, fix3)
if autobet
raiseFT(id)
return

alt1:
If ActOnActiveTable
WinGet, id, id, A
else
MousegetPos,,,id
if sb1
sb:="sb"
else
sb:=""
AlterAmount(id,"up", incr1, sb)
return

alt2:
If ActOnActiveTable
WinGet, id, id, A
else
MousegetPos,,,id
if sb2
sb:="sb"
else
sb:=""
AlterAmount(id,"down", incr2, sb)
return

alt3:
If ActOnActiveTable
WinGet, id, id, A
else
MousegetPos,,,id
if sb3
sb:="sb"
else
sb:=""
AlterAmount(id,"up", incr3, sb)
return

alt4:
If ActOnActiveTable
WinGet, id, id, A
else
MousegetPos,,,id
if sb4
sb:="sb"
else
sb:=""
AlterAmount(id,"down", incr4, sb)
return
;-----------------------------------------------------------------------------------------------------
BetPot:
GroupAdd, FullTiltTables,Logged In ahk_class QWidget,,,Full Tilt
if autopot
{
isbetboxnew()
}
return
;-----------------------------------------------------------------------------------------------------
IsBetBoxNew()
{
global oldid,PotDefPre,PotDefFlop,PotDefTurn,PotDefRiver,RoundDef,OpenDef,FixDef
winget winid,id,A
betboxX:=0.9687
betboxY:=0.8000
relFTclientpoint(winid,betboxX,betboxY,0)
pixelgetcolor,bet,betboxX,betboxY,ahk_id%winid%
if (winid<>oldid)
{
 if bet=0xffffff
 {
  oldid:=winid
  if RoundDef
  Roundsb:="smallblind"
  else
  Roundsb:=0.2
  Pot(winid,PotDefPre A_space PotDefFlop A_space PotDefTurn A_space PotDefRiver, Roundsb, OpenDef, FixDef)
 }
 else
 oldid=
 }
else
{ 
 if bet!=0xffffff
 oldid=
}
}
return
;-----------------------------------------------------------------------------------------------------
act:
id:=act()
 wingetclass,class,A
wingettitle,title,A
 ifwinnotactive,ahk_id%id%
 if class=QWidget
if (instr(title, "Logged In") & instr(title, "/"))
 winactivate,ahk_id%id%
return

act()
{
winget,list,list, Logged In ahk_class QWidget,,Full Tilt
return list1
}
;-----------------------------------------------------------------------------------------------------
activateundermouse:
activatetableundermouse()
return

activatetableundermouse()
{
    MousegetPos,,,WinID
    WinGetClass, class, ahk_id %WinID%
    WinGetTitle, title, ahk_id %WinID%
    if (class="QWidget")
    winactivate, ahk_id %WinID%
}
return
;-----------------------------------------------------------------------------------------------------
ActivateBottomWindow:
GroupActivate, FullTiltTables
return
;-----------------------------------------------------------------------------------------------------
SitOutNextAll:
;ClickImBack:=false
settimer,Check,off

WinGet, list, List,Logged In ahk_class QWidget,,Full Tilt
Loop, %list%
{
 Z:=list%A_Index%
 WinGetTitle, title, ahk_id%Z%
 StringMid, bb, title, InStr(title, "/") + 1, InStr(title, a_space,"", InStr(title, "/")) - InStr(title, "/") - 1
 StringReplace,bb,bb,$,,1
 if Racetrack
 {
  if bb<4
  {
   sitx:=0.4263
   sity:=0.9264
  }
  else
  {
   sitx:=0.4125
   sity:=0.9345
  }
 }
 else
 {
  if bb<4
  {
   sitx:=0.0031
   sity:=0.7770
  }
  else
  {
   sitx:=0.0031
   sity:=0.7857
  }
 }
 click_x:=sitx+0.0070
 click_y:=sity+0.0070
 WinGetPos,,, W, H, ahk_id %Z%
 if w>1000
 Sittingout:=PixelColorA(0,0,0,sity,sitx,Z,1,15,15)
 else
 Sittingout:=PixelColorA(0,0,0,sity,sitx,Z,1,10,10)
 if !(instr(Sittingout,"-0-")) & !(instr(Sittingout,"1710618"))  ; & !(instr(Sittingout,"16777215"))
 {
  PostClickFT(click_x, click_y, Z, 0) 
 }       
}
return
;-----------------------------------------------------------------------------------------------------
RemoveSitout:
;ClickImBack:=true
if dealmein OR Timebank
settimer,Check,639
WinGet, list, List,Logged In ahk_class QWidget,,Full Tilt
Loop, %list%
{
 Z:=list%A_Index%
WinGetTitle, title, ahk_id%Z%
 StringMid, bb, title, InStr(title, "/") + 1, InStr(title, a_space,"", InStr(title, "/")) - InStr(title, "/") - 1
 StringReplace,bb,bb,$,,1
 if Racetrack
 {
  if bb<4
  {
   sitx:=0.4263
   sity:=0.9264
  }
  else
  {
   sitx:=0.4125
   sity:=0.9345
  }
 }
 else
 {
  if bb<4
  {
   sitx:=0.0031
   sity:=0.7770
  }
  else
  {
   sitx:=0.0031
   sity:=0.7857
  }
 }
 click_x:=sitx+0.0070
 click_y:=sity+0.0070
 WinGetPos,,, W, H, ahk_id %Z%
 if w>1000
 Sittingout:=PixelColorA(0,0,0,sity,sitx,Z,1,15,15)
 else
 Sittingout:=PixelColorA(0,0,0,sity,sitx,Z,1,10,10)
; FileAppend, %Sittingout%`n`n, test.txt
 if (instr(Sittingout,"-0-")) || (instr(Sittingout,"1710618"))  ; & !(instr(Sittingout,"16777215"))
  {
  PostClickFT(click_x, click_y, Z, 0) 
 }       
}
return
;-----------------------------------------------------------------------------------------------------
Layout1:
ifwinactive,Logged In ahk_class QWidget,,Full Tilt
WinGet, WinId, ID, A
else
MousegetPos,,,WinID
wingetclass,class,ahk_id %WinID%
wingettitle,title,ahk_id %WinID%
if class=QWidget
if !instr(title,"Full Tilt")
{
CX:=0.8261
CY:=0.0155
wingetpos,x1,y1,w,h,ahk_id%winid%
coordmode,mouse,screen
mousegetpos,x,y
coordmode,mouse,relative
DllCall("SetCursorPos", int, x1+w+10, int, y1+h+10)
PostclickFT(cx,cy,winid,1)
sleep 100
critical,6
send {Tab 7}
sleep,25
Send {Enter}
critical,off
sleep,-1
DllCall("SetCursorPos", int, x, int, y)
}
return
;-----------------------------------------------------------------------------------------------------
Layout2:
ifwinactive,Logged In ahk_class QWidget,,Full Tilt
WinGet, WinId, ID, A
else
MousegetPos,,,WinID
wingetclass,class,ahk_id %WinID%
wingettitle,title,ahk_id %WinID%
if class=QWidget
if !instr(title,"Full Tilt")
{
CX:=0.8261
CY:=0.0155
wingetpos,x1,y1,w,h,ahk_id%winid%
coordmode,mouse,screen
mousegetpos,x,y
coordmode,mouse,relative
DllCall("SetCursorPos", int, x1+w+10, int, y1+h+10)
PostclickFT(cx,cy,winid,1)
sleep 100
critical,6
send {Tab 8}
sleep,25
Send {Enter}
critical,off
sleep,-1
DllCall("SetCursorPos", int, x, int, y)
}
return
;-----------------------------------------------------------------------------------------------------
Layout3:
ifwinactive,Logged In ahk_class QWidget,,Full Tilt
WinGet, WinId, ID, A
else
MousegetPos,,,WinID
wingetclass,class,ahk_id %WinID%
wingettitle,title,ahk_id %WinID%
if class=QWidget
if !instr(title,"Full Tilt")
{
CX:=0.8261
CY:=0.0155
wingetpos,x1,y1,w,h,ahk_id%winid%
coordmode,mouse,screen
mousegetpos,x,y
coordmode,mouse,relative
DllCall("SetCursorPos", int, x1+w+10, int, y1+h+10)
PostclickFT(cx,cy,winid,1)
sleep 100
critical,6
send {Tab 9}
sleep,25
Send {Enter}
critical,off
sleep,-1
DllCall("SetCursorPos", int, x, int, y)
}
return
;-----------------------------------------------------------------------------------------------------
HighLighter:
HighLighter(1)
return

HighLighter(Highlight=1)  ;x_mouse=0.75, y_mouse=0.75 
{
global OldX,OldY,OldW,OldH
global highlighthero,last_table_id
global border_color
global border_size
global trans
global xbord,ybord
global cap

;act()
foldx:=0.6534
foldy:=0.9662
foldx1:=0.5859
foldy1:=0.9662

back_x:=0.6534
back_y:=0.9862
back_x1:=0.5859
back_y1:=0.9862

join_y:=0.9292
join_x:=0.8261

fold1:=0x181818
v:=15
; id:=act()
; wingetclass,class,A
; wingettitle,title,A
; ifwinnotactive,ahk_id%id%
; if class=QWidget
; if (instr(title, "Logged In") & instr(title, "/"))
; winactivate,ahk_id%id%
; winget,id,id,A
ifwinactive, Logged In ahk_class QWidget,,Full Tilt
{  
 winget,id,id,A
 WinGetActiveStats,ActiveTitle, ActiveW, ActiveH, ActiveX, ActiveY
  relFTclientpoint(id,foldx,foldy,0)
  pixelgetcolor,fold,foldx,foldy,ahk_id%id%
  relFTclientpoint(id,foldx1,foldy1,0)
  pixelgetcolor,bacgr,foldx1,foldy1,ahk_id%id%
  relFTclientpoint(id,back_x,back_y,0)
  pixelgetcolor,deal,back_x,back_y,ahk_id%id%
  relFTclientpoint(id,back_x1,back_y1,0)
  pixelgetcolor,deal1,back_x1,back_y1,ahk_id%id%
 ; relFTclientpoint(id,join_x,join_y,0)
 ; pixelgetcolor,join,join_x,join_y,ahk_id%id%

 if (id != last_table_id) || ((OldX <> ActiveX || OldY <> ActiveY || OldW <> ActiveW || OldH <> ActiveH))    
 {
  OldX := ActiveX
  OldY := ActiveY
  OldW := ActiveW
  OldH := ActiveH
  mouse_last:=last_table_id
  last_table_id := id  
  if(!id)
  {
   Gui, 2: Cancel
   Gui, 3: Cancel
   Gui, 4: Cancel
   Gui, 5: Cancel
   return
  }  
  WinGetPos, x, y, w, h, ahk_id%id%
  x := x + xbord
  y := y + xbord + cap
  w := w - (2*xbord)
  h := h - (2*xbord) - cap
 
  ;Makes Border around urgent table
;  if ( Highlight = 1 )
  if (highlighthero=0) || ((highlighthero=1) & (comparecolors(fold,bacgr,v)=0) & (comparecolors(fold,fold1,v)=0) & (comparecolors(deal,deal1,v)=1))  ; & (comparecolors(join,deal1,v)=1))
  { 
   ;top
   guinum := 2
   Gui, %guinum%: +Alwaysontop +Lastfound +Owner
   Gui, %guinum%: Color, %border_color%
   WinSet, Transparent, %trans%
   Gui, %guinum%: -Caption
   Gui, %guinum%: Show, w%w% h%border_size% x%x% y%y% NoActivate    
   ;left
   guinum++
   Gui, %guinum%: +Alwaysontop +Lastfound +Owner
   Gui, %guinum%: Color, %border_color%
   WinSet, Transparent, %trans%
   Gui, %guinum%: -Caption
   Gui, %guinum%: Show, w%border_size% h%h% x%x% y%y% NoActivate    
   ;bottom
   guinum++
   Gui, %guinum%: +Alwaysontop +Lastfound +Owner
   Gui, %guinum%: Color, %border_color%
   WinSet, Transparent, %trans%
   Gui, %guinum%: -Caption
   y2 := y + h - border_size
   Gui, %guinum%: Show, w%w% h%border_size% x%x% y%y2% NoActivate    
   ;right
   guinum++
   Gui, %guinum%: +Alwaysontop +Lastfound +Owner
   Gui, %guinum%: Color, %border_color%
   WinSet, Transparent, %trans%
   Gui, %guinum%: -Caption
   x2 := x + w - border_size
   Gui, %guinum%: Show, w%border_size% h%h% x%x2% y%y% NoActivate  
  }
  else 
  if highlighthero=1
 ; if comparecolors(fold,bacgr,v)=1
 ; {
 ;  Gui, 2: Cancel
 ;  Gui, 3: Cancel
 ;  Gui, 4: Cancel
 ;  Gui, 5: Cancel
   last_table_id=
 ; }          
 }
 else
 if highlighthero=1
 if comparecolors(fold,bacgr,v)=1
 {
  Gui, 2: Cancel
  Gui, 3: Cancel
  Gui, 4: Cancel
  Gui, 5: Cancel
  last_table_id=
 }
}
else
{
   Gui, 2: Cancel
   Gui, 3: Cancel
   Gui, 4: Cancel
   Gui, 5: Cancel
   last_table_id=
}
}
return
;-----------------------------------------------------------------------------------------------------
MouseMove:
MoveMouse()
return

MoveMouse(x_mouse=0.7468, y_mouse=0.8735)
{
if IsWindowNew()
{ 
wingetclass,class,A
wingetactivetitle,title
if class=QWidget 
if !instr(title,"Full Tilt") 
{
 winget,id,id,A
 relFTClientPoint(id, x_mouse, y_mouse,0,1)
 DllCall("SetCursorPos", int, x_mouse, int, y_mouse)
}  
}
}
return
;-----------------------------------------------------------------------------------------------------
IsWindowNew()
{
global oldwinid,stealfocus
winget,id,id,A
wingetclass,class,ahk_id%oldwinid%
if id!=%oldwinid%
{
 oldwinid:=id
 if stealfocus
 return 1
 else
 {
  if class=QWidget
  return 1
  else
  return 0
 }
}
else
return 0
}
;-----------------------------------------------------------------------------------------------------
Colorinit:
if once
Colorinit()
return

Colorinit()
{
local id,t,col,v1
v1:=15
id:=WinExist("Logged In ahk_class QWidget","","Full Tilt")
if id
{
once:=false
settimer,Colorinit,off
t:=PixelColorA(time_x,time_y,time_x1,time_y,join_x,id)
stringsplit,col,t,-
if (CompareColors(col1,col2,v1)=false)
{
t2:=col2
once:=true
settimer,Colorinit,87
}
else
t2:=col1
t:=PixelColorA(back_x,back_y,back_x1,back_y,join_x,id)
stringsplit,col,t,-
if (CompareColors(col1,col2,v1)=false)
{
back2:=col2
once:=true
settimer,Colorinit,87
}
else
back2:=col1
}
}
return
;-----------------------------------------------------------------------------------------------------
check:
check()
return

check()
{
local listft,id,t,col
winget,listft,list,Logged In ahk_class QWidget,,Full Tilt
loop %listft%
{
id:=listft%A_index%
t:=PixelColorA(time_x,time_y,back_x,back_y,join_x,id)
stringsplit,col,t,-
if (CompareColors(col1,t1,v)=false) & (CompareColors(col1,t2,v)=false)
{
if !InStr(tablequeue,id)
movetolist(id,A_TickCount)
}
else
if InStr(tablequeue,id)
removefromlist(id)
if dealmein
if (CompareColors(col2,back1,v1)=false) & (CompareColors(col2,back2,v1)=false) & (CompareColors(col3,back2,v)=true)
PostclickFT(back_x,back_y,id,0)
}
}
return
;-----------------------------------------------------------------------------------------------------
relFTClientPoint(id, ByRef x, ByRef y, client=1, screen=0)
{
global xbord,ybord,cap
WinGetPos,x1,y1,w,h,ahk_id%id%
w-=2*xbord
h-=(2*ybord)+cap
x:=floor(W*x)
y:=floor(H*y)
if !client
{
x+=xbord
y+=ybord+cap
}
if screen
{
x+=x1
y+=y1
}
}
return
;-----------------------------------------------------------------------------------------------------
PostLeftDoubleClick(x, y, table_id, activate=1) {
; ### Max1mums: Send the double left click, then the mouse-up messages,
; some windows can get activated on the down left click so we will use
; left doubleclick instead, don't use on objects which have any functions
; binded to doubleclick unless you want to make doubleclick on them
; NOTE: This is relative to the top left of the client area and NOT the top left of the
;       window (ie: It *doesn't* include the title-bar like AHK's MouseClick does!!!).
If activate
 WinActivate, ahk_id%table_id%
critical,6
PostMessage, 0x203 , 0, ((y<<16)^x), , ahk_id%table_id% ; without 0x001 as lparam which is Lbutton down
PostMessage, 0x202 , 0, ((y<<16)^x), , ahk_id%table_id%
PostMessage, 0x202 , 0, ((y<<16)^x), , ahk_id%table_id%
critical,off
sleep,-1
}
return
;-----------------------------------------------------------------------------------------------------
PostclickFT(x,y,winid,activate=1,client=1)
{
relFTClientPoint(winid, x, y,client)
DllCall("SetCapture","Uint",winid)
PostLeftDoubleClick(x, y, winid, activate)
DllCall("ReleaseCapture")
}
return
;-----------------------------------------------------------------------------------------------------
clickwithdelay:
Loop, Parse, tablequeue, `,
{
interval:=interval1*1000
stringsplit,tab,A_loopfield,-
if abs(tab2-A_TickCount)>interval
{
PostclickFT(time_x,time_y,tab1,0)
listDelItem(tablequeue, A_Loopfield) 
}
}
return
;-----------------------------------------------------------------------------------------------------
PixelColorA(colx,coly,backx,backy,joinx,id,region=0,regionw=70,regionh=15)
{
global boost,xbord,ybord,cap
if boost
critical,6
setwindelay, -1
hdc_frame := DllCall( "GetDC", "UInt", id )
hdc_buffer := DllCall("gdi32.dll\CreateCompatibleDC", "UInt",  hdc_frame)
WinGetPos,,,W,H,ahk_id %id%
hbm_buffer := DllCall("gdi32.dll\CreateCompatibleBitmap", "UInt",hdc_frame, "Int",w, "Int",h)
DllCall( "gdi32.dll\SelectObject", "UInt",hdc_buffer, "UInt",hbm_buffer)
DllCall( "PrintWindow", "UInt" , id , "UInt" , hdc_buffer , "UInt" , 0 )
DllCall("RedrawWindow","UInt",id,"UInt",0,"UInt",0,"UInt", 1|16|32|64|1024) 
x:=floor(((W-2*xbord)*colx) + xbord)
y:=floor(((H-(2*ybord)-cap)*coly) + ybord + cap)
pix1=
pix1 := DllCall("GetPixel", "UInt", hdc_buffer, "Int", x, "Int", y) 
x:=floor(((W-2*xbord)*backx) + xbord)
y:=floor(((H-(2*ybord)-cap)*backy) + ybord + cap)
pix2:=DllCall("GetPixel", "UInt", hdc_buffer, "Int", x, "Int", y) 
x:=floor(((W-2*xbord)*joinx) + xbord)
pix3:=DllCall("GetPixel", "UInt", hdc_buffer, "Int", x, "Int", y) 
SetFormat, IntegerFast, hex
pix1 += 0
pix1 .= ""
pix2 += 0
pix2 .= ""
pix3 += 0
pix3 .= ""
SetFormat, IntegerFast, d
pix1.="-" . pix2 . "-" . pix3
if region
{
x:=floor(((W-2*xbord)*joinx) + xbord)
y:=floor(((H-(2*ybord)-cap)*backy) + ybord + cap)
pix1.="*"
loop %regionw%
{
delta:=A_index
loop %regionh%
{
delta1:=A_index
p := DllCall("GetPixel", "UInt", hdc_buffer, "Int", x+delta , "Int", y+delta1)
;p1:=p
;SetFormat, IntegerFast, hex
;p += 0
;p .= ""
;SetFormat, IntegerFast, d
;pix1.=p . "*" . p1 . "-"
pix1.=p . "-"
}
}
}
sleep,1
DllCall( "gdi32.dll\DeleteObject", "Uint", hbm_buffer )
DllCall( "gdi32.dll\ReleaseDC", "Uint", hdc_frame )
DllCall( "gdi32.dll\DeleteDC", "Uint", hdc_frame )
DllCall( "gdi32.dll\ReleaseDC", "Uint", hdc_buffer )
DllCall( "gdi32.dll\DeleteDC", "Uint", hdc_buffer )
if boost
{
critical,off
sleep,-1
}
return pix1
}
;-----------------------------------------------------------------------------------------------------
CompareColors(ByRef bgr1, ByRef bgr2, ByRef variation) {
	c1 := bgr1 & 0xff
	c2 := bgr2 & 0xff
	if (abs(c1 - c2) > variation)
		return false
	c1 := (bgr1 >> 8) & 0xff
	c2 := (bgr2 >> 8) & 0xff
	if (abs(c1 - c2) > variation)
		return false
	c1 := (bgr1 >> 16) & 0xff
	c2 := (bgr2 >> 16) & 0xff
	if (abs(c1 - c2) > variation)
		return false
	return true
}
;-----------------------------------------------------------------------------------------------------
listAdd( byRef list, item, del="," ) {
  list:=( list!="" ? ( list . del . item ) : item )
  return list
}
;-----------------------------------------------------------------------------------------------------
listDelItem( byRef list, item, del=",") {
  ifEqual, item,, return list
  list:=del . list . del
  StringReplace, list, list, %item%%del%
  StringTrimLeft, list, list, 1
  StringTrimRight, list, list, 1
  return list
}
;-----------------------------------------------------------------------------------------------------
movetolist(winid,time)
{
global tablequeue
listAdd(tablequeue, winid . "-" . time)
}
return
;-----------------------------------------------------------------------------------------------------
removefromlist(winid)
{
global tablequeue
Loop, Parse, tablequeue, `,
{
if InStr(A_loopfield,winid)
listDelItem(tablequeue, A_Loopfield)
}
}
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
}
;-----------------------------------------------------------------------------------------------------
register:
ifwinactive, ahk_class QWidget
{
winget,id,id, A
wingettitle,title,ahk_id%id%
if instr(title,"Full Tilt Poker -")
{
reg_x :=0.9080
reg_y :=0.7357
PostclickFT(reg_x,reg_y,id,0)
PostclickFT(reg_x,reg_y,id,0)
winwait,Tournament Buy-in ahk_class QWidget,,4
if !errorlevel
{
sleep,50
winget,id,id,Tournament Buy-in ahk_class QWidget
wingetpos,,,,h,ahk_id%id%
reg_x :=0.3608
if h<240
reg_y :=0.4876
else
reg_y :=0.4193
PostclickFT(reg_x,reg_y,id,0)
PostclickFT(reg_x,reg_y,id,0)
ifwinExist,Full Tilt Poker - Tournament ahk_class QWidget
winclose,Full Tilt Poker - Tournament ahk_class QWidget
}
}
}
return
;-----------------------------------------------------------------------------------------------------
unregister:
ifwinactive, ahk_class QWidget
{
winget,id,id, A
wingettitle,title,ahk_id%id%
if instr(title,"Full Tilt Poker -")
{
reg_x:=0.9080
reg_y:=0.6709
PostclickFT(reg_x,reg_y,id,0)
PostclickFT(reg_x,reg_y,id,0)
winwait,Full Tilt Poker - Tournament ahk_class QWidget,,4
if not errorlevel
{
winget,id,id, Full Tilt Poker - Tournament ahk_class QWidget
reg_x :=0.8876
reg_y :=0.0776
PostclickFT(reg_x,reg_y,id,0)
PostclickFT(reg_x,reg_y,id,0)
winwait,Tournament Buy-in ahk_class QWidget,,0.5
if not errorlevel
{
winclose,Tournament Buy-in ahk_class QWidget
ifwinexist, Full Tilt Poker - Tournament ahk_class QWidget
winclose, Full Tilt Poker - Tournament ahk_class QWidget
}
else
{
settitlematchmode,3
winwait, Full Tilt Poker ahk_class QWidget,,4
if not errorlevel
winclose,Full Tilt Poker ahk_class QWidget
settitlematchmode,2
ifwinexist, Full Tilt Poker - Tournament ahk_class QWidget
winclose, Full Tilt Poker - Tournament ahk_class QWidget
}
}
}
}
return
;-----------------------------------------------------------------------------------------------------
Toggledealmein:
If (dealmein=true) {
	dealmein:=false
	T=Off
}
else {
	dealmein:=true
	T=On
}
Gui, 12:Add, Text,, Auto Deal me in: %T%
Gui, 12:+ToolWindow
Gui, 12:Show, w150 h20
Sleep, 1000
Gui, 12:Destroy
return
;-----------------------------------------------------------------------------------------------------
Joinwaitlist:
winget,listft,list,Logged In ahk_class QWidget,,Full Tilt
loop %listft%
{
id:=listft%A_index%
t:=PixelColorA(join_x,back_y,back_x,join_y,join_x1,id,1)
stringsplit,st,t,*
stringsplit,col,st1,-
if (CompareColors(col1,back1,v1)=false) & (CompareColors(col1,back2,v1)=false)
if !instr(st2,"16777215") & !instr(st2,"67284200") & !instr(st2,"111670350") & !instr(st2,"148766710")
PostclickFT(back_x,back_y,id,0)
}
return
;-----------------------------------------------------------------------------------------------------
Unjoinwaitlist:
winget,listft,list,Logged In ahk_class QWidget,,Full Tilt
loop %listft%
{
id:=listft%A_index%
t:=PixelColorA(join_x,back_y,join_x1,join_y,join_x1,id,1)
stringsplit,st,t,*
stringsplit,col,st1,-
if (CompareColors(col1,back1,v1)=false) & (CompareColors(col1,back2,v1)=false)
if instr(st2,"16777215")  or instr(st2,"67284200") or instr(st2,"111670350") or instr(st2,"148766710")
PostclickFT(back_x,back_y,id,0)
}
return
;-----------------------------------------------------------------------------------------------------
AlterAmount(id, dir="", frac=1, unit="")
{
  WinGetTitle, title, ahk_id%id%
  amount := 0
  StringTrimRight, tablename, title, ( StrLen(title) - (InStr(title, " - ")-1) )
  IfWinExist, ahk_id%id% ahk_group FullTiltTables
  {
    StringMid, bb, title, InStr(title, "/") + 1, InStr(title, a_space,"", InStr(title, "/")) - InStr(title, "/") - 1
  }   
  StringReplace,bb,bb,$,,1
  StringReplace,bb,bb,Ј,,1
  StringReplace,bb,bb,Ђ,,1
  StringReplace,bb,bb,€,,1 

 ; bb++
 ; bb--
  sb := sb(bb)
;listvars
  If (unit = "" or unit = "bb")
  {
    unit := bb
  }
  Else If (unit = "sb")
  {
    unit := sb
  }
  Else If (unit = "pot")
  {
    pot := 0
    call := 0
    hero_bet := 0
    street := "pre"
    hero_position := ""
    open := 0
    max := 10000000
    IfWinExist, ahk_id%id% ahk_group FullTiltTables
    {
        PotSizeFullTilt2(id, pot, call, sb, bb, hero_bet, street, hero_position, open, max)
    }
    pot := ((pot + call + hero_bet) )+ call
    unit := pot
  }
  amount := unit * frac
  if (dir="down")
  {
    amount := amount - (2*amount)
  }
  a:=floor(amount)
  if amount-a=0
  amount:=a
  
  IfWinExist, ahk_id%id% ahk_group FullTiltTables
  {
      oldClipboard = %clipboard%
      clipboard =
      PostStarsClick(767, 440, id)
      Send ^a
      Send ^c
      ClipWait, 0.3
      If !ErrorLevel
      t := clipboard
      clipboard = %oldClipBoard%
      t := t + amount
      if (t < 0)
      {
        t := 0
      }
    t2 := Round(t, 0)
    t1 := Round(t, 2)
    t := Round(t, 3)
    if t-t1=0
    t:=t1
    if t-t2=0
    t:=t2
      PostStarsClick(767, 440, id)
      Send ^a
      Send %t%
  }
}

Pot(id, frac=1, round_bet=0.2, open_adjust="", fixblinds=0)
{
  global debug
  global attempts

  if attempts<=0
  attempts:=1
  pot := 0
  call := 0
  sb := 0
  bb := 0
  hero_bet := 0
  street := ""
  hero_position := ""
  open := 1
  max := 10000000

  IfWinExist, ahk_id%id% ahk_group FullTiltTables
  {
    loop %attempts%
    {
     PotSizeFullTilt2(id, pot, call, sb, bb, hero_bet, street, hero_position, open, max)
     if pot>0
     break
     sleep,20 
    }
    }
  Else
  {
    return
  }
 
  StringSplit, fr, frac, %A_SPACE%
  if (fr0 < 4)
  {
    times := 4 - fr0
    Loop, %times%
    {
      n := 5 - A_Index
      fr%n% := fr%fr0% 
    }
  }
  
  if (street = "pre")
  {
    frac:= Round(fr1/100,2)
  }
  else if (street = "flop")
  {
    frac:= Round(fr2/100,2)
  }
  else if (street = "turn")
  {
    frac:= Round(fr3/100,2)
  }
  else if (street = "river")
  {
    frac:= Round(fr4/100,2)
  }
  if (debug)
  {
    TrayTip, BetPot, Pot:`t`t%pot%`nCall:`t`t%call%`nHero_bet:`t%hero_bet%`n`nPosition:`t%hero_position%`n`nBlinds:`t$%sb%/$%bb%`n`nStreet:`t%street%`n`n%fr0%`n%fr1% %fr2% %fr3% %fr4%`n`n%frac%,10,17
  }
   ; listvars
  if (fixblinds AND open AND street="pre")
  {
    if (hero_position = "sb" )
    {
      pot := pot - sb
      call := call + sb
    }
    else if (hero_position = "bb")
    {
      pot := pot - bb
      call := call + bb
    }
  }

  pot := ((pot + call + hero_bet)* (frac)) + call  

  if (open=1 AND open_adjust="ssnl" )
  {
    pot := pot + bb - sb
  }
  else if (open=1 AND open_adjust="trny" )
  {
    pot := pot - bb
  }
  else if (open=1 AND open_adjust="mix" )
  {
    if (bb=2)
    {
      pot := pot + bb - sb
    }
  ;  pot := pot + bb + sb
  }
  
  if(round_bet = "smallblind")
  {
   ; if sb<1
    pot := Round((Floor((pot / sb)) * sb),2)
   ; else
   ; pot := Round((Floor((pot / sb)) * sb),0)
  }
  else if(round_bet = "bigblind")
  {
    pot := Round((Floor((pot / bb)) * bb),2)
  }
  else if (round_bet < 1)
  {
    places := round_bet*10
    pot := Round(pot, (places))
  }
  else if (round_bet >= 1)
  {
    pot := Floor(pot / round_bet) * round_bet
  }
 
  p:=floor(pot)
  if pot-p=0
  pot:=p
    
  IfWinExist, ahk_id%id% ahk_group FullTiltTables
  {
    PostStarsClick(767, 440, id)
    Send ^a
    Send %pot%
  }
}

PotSizeFullTilt2(id, ByRef pot, ByRef call, ByRef sb, ByRef bb, ByRef hero_bet, ByRef street, ByRef hero_position, ByRef open, ByRef max)
{
  global deduct_rake,Racetrack
  rake := 0
  notraked := 0
  maxrake := 3
  max := 7654321
  
  
  WinGetTitle, title, ahk_id%id%
  StringMid, bb, title, InStr(title, "/") + 1, InStr(title, a_space,"", InStr(title, "/")) - InStr(title, "/") - 1
  StringReplace,bb,bb,$,,1
  sb := sb(bb)
  
TotalPotDigitsPosX=393
TotalPotDigitsPosY=277
if Racetrack
{
MainPotDigitsPosX=334
MainPotDigitsPosY=183
}
else
{
MainPotDigitsPosX=285
MainPotDigitsPosY=335
}
;PotDigitsPos6X=338
;PotDigitsPos6Y=340
PotDigitsPosW=80
PotDigitsPosH=14
 

pot:=DigitSearchByPixelCount(TotalPotDigitsPosX,TotalPotDigitsPosY,PotDigitsPosW,PotDigitsPosH,Id)
if pot is not number
pot:=DigitSearchByPixelCount(MainPotDigitsPosX,MainPotDigitsPosY,PotDigitsPosW,PotDigitsPosH,Id)

;oldClipboard=%clipboard%
oldClipboard:=clipboard
 clipboard =
PostStarsClick(707, 418, id) ;hit min
PostStarsClick(707, 418, id) ;hit min
PostStarsClick(707, 418, id) ;hit min
;PostStarsClick(707, 418, id) ;hit min
;PostStarsClick(707, 418, id) ;hit min
;PostStarsClick(707, 418, id) ;hit min
PostStarsClick(767, 440, id)

min := sb
Send ^a
Send ^c
ClipWait, 0.3
If !ErrorLevel
 {
  min := clipboard
  clipboard = %oldClipBoard%
 }
 else
 {
 min := 2*bb 
 }
   
  street := "pre" 
  street := GetStreetFT(id)
   
  if (min = bb)
  {
    call := 0
  }
  else if (min > bb)
  {
    call := min / 2
  }
  else if (street != "pre")
  {
    call := bb
  }
  
    call2 := Round(call, 0)
    call1 := Round(call, 2)
    call := Round(call, 3)
    if call-call1=0
    call:=call1
    if call-call2=0
    call:=call2

  if (call != bb || street != "pre")
  {
    open := 0
  }
 pot := Round((Floor((pot / sb)) * sb),2) 
 ;pot := pot - (2 * call)

if call is not number
call:=0
if hero_bet is not number
hero_bet:=0 
return
}

GetStreetFT(id)
{
  CoordMode, Pixel, Screen

  street := "pre"
  
  x1 := 485
  y1 := 214
  x2 := 520
  y2 := 260
  relStarsScreenPoint(id, x1, y1)
  relStarsScreenPoint(id, x2, y2)
  
  If ( GetPixelCount(x1, y1, x2, y2, 0xffffff) > 5 )
  {
    street := "river"
    return street
  }
  
  x1 := 431
  y1 := 214
  x2 := 461
  y2 := 260
  relStarsScreenPoint(id, x1, y1)
  relStarsScreenPoint(id, x2, y2)

  If ( GetPixelCount(x1, y1, x2, y2, 0xffffff) > 5 )
  {
    street := "turn"
    return street
  }

  x1 := 378
  y1 := 214
  x2 := 414
  y2 := 260
  relStarsScreenPoint(id, x1, y1)
  relStarsScreenPoint(id, x2, y2)

  If ( GetPixelCount(x1, y1, x2, y2, 0xffffff) > 5 )
  {
    street := "flop"
    return street
  }
  return street
}

; finds number of specified pixels in a region
GetPixelCount(x1, y1, x2, y2, color, options="")
{
  CoordMode, Pixel, Screen
  pixels := (x2 - x1 + 1)*(y2 - y1 + 1)
  If ( pixels <= 0 )
  {
    ErrorLevel = 1
    return
  }
  count = 0
  x = %x1%
  Loop
  {
    If ( x > x2 )
    {
      break
    }
    y = %y1%
    Loop
    {
      If ( y > y2 )
      {
        break
      }
      PixelGetColor, c, x, y, %options%
      If ( c = color )
      {
        count++
      }
      y++
    }
    x++
  }
  return count
}

sb(bb) {
If bb = .25
 sb := .10
else if bb = 15
 sb = 10
else if bb = 0.05
 sb = 0.02
else
 sb := bb/2
if (sb > 1)
{
  sb := Round(sb, 0)
}
else
{
  sb := Round(sb, 2)
}
return sb
}

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

StrMid(str,str1,str2,startPos1=1,startPos2=1,caseSense=0){
If startPos1 =
 startPos1 = 1
If startPos2 =
 startPos2 = 1
StringTrimLeft,o,str,InStr(str,str1,cS,startPos1) + StrLen(str1) - 1
StringLeft,o,o,InStr(o,str2,caseSense,startPos2)-1
return o
}

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

relStarsClientPoint(id, ByRef x, ByRef y)
{
  global border
  global caption
  rw := 792
  rh := 546
  WinGetPos, , , w, h, ahk_id%id%
  w := w - (2*border)
  h := h - (2*border) - caption
  
  x := Floor( (x / rw ) * w )
  y := Floor( (y / rh) * h  )
  
}

relStarsWindowPoint(id, ByRef x, ByRef y)
{
  global border
  global caption
  relStarsClientPoint(id, x, y)
  x := x + border
  y := y + border + caption
}

relStarsScreenPoint(id, ByRef x, ByRef y)
{
  relStarsWindowPoint(id, x, y)
  WinGetPos, x1, y1, , , ahk_id%id%
  x += x1
  y += y1
}


reverse_calc_stars_client_area(cw, ByRef w, ByRef h)
{
  global border
  global caption
  w := cw + (2*border) 
  h := Floor(cw / 1.45) + (2*border) + caption
}

client_area(id, ByRef x, Byref y, ByRef w, Byref h)
{
  WinGetPos, x, y, w, h, ahk_id%id%
  global border
  global caption
  x := x + border
  y := y + border + caption
  w := w - (2*border)
  h := h - (2*border) - caption
  return
}

PostStarsClick(x, y, id)
{
  relStarsClientPoint(id, x, y)
;listvars
  PostLeftClick(x, y, id)
}

PostLeftClick(x, y, table_id, activate=1) {
; ### JUK: Send the down left click, then the mouse-up messages.
; NOTE: This is relative to the top left of the client area and NOT the top left of the
;       window (ie: It *doesn't* include the title-bar like AHK's MouseClick does!!!).
If activate
 WinActivate, ahk_id%table_id%
PostMessage, 0x201, 0x0001, ((y<<16)^x), , ahk_id%table_id%
PostMessage, 0x202 , 0, ((y<<16)^x), , ahk_id%table_id%
}


;;;;;;;;;;;;;;;;;;;;PixelCount function source taken from PokerShortCuts;;;;;;;;;;;;;;;;;;;;;

/*
DigitsByPixelCountGetValue()
   Purpose: This function looks for digits by counting pixels in each column of a digit and tries to find a match for those counts
               when a column of 0 pixels is found. we search the client area xywh
   Returns:
      DigitString - the numbers found
         A for All In
         S for Sitting Out
         "" if no digits found
   Parameters:
      X - x poistion in standard client area to search for digits
      Y - y "
      W - standardized width of search area
      H - standardized height of search area
      DigitsType - e.g. Bet, Stack or Pot. This var is used to get the colors and tolerances from the global variables
      ByRef PixelCountForAllDigitsStringReturned: for test purposes... this is the long pixel count string
      WinId: window id

Notes:
      1. I was having problems with the alternate color not reading the digits correctly on FT. This is black digits on white background.
      There sometimes seems to be a black pixel in the area below the stack numbers, and this would cause one of the columns to read incorrectly.
      To fix it, I had to reduce the Height parameter that it was checking from 15 down to 12. This seems to be reliable for all table sizes.

      2. Full Tilt on small tables does not have a blank row of pixels above the stack digits if the user's name has a decender character in it.
      I had to change the software to allow for a few pixels in this row for it to be considered a blank row. I suppose this could be a problem if
      the user only has a stack size of 1, in which case the blank row at the top would be intrepreted as the stack digit with on (since it might only have 1 pixel in the row.)
      The "y" has one pixel that is right above the stack numbers, and the "g" character has 2 pixels...  so we will allow for 2 pixels in the row.
      If the user's name has more than 2 pixels in the decenders, then this code won't work at the smallest of table sizes (need a table size that puts in a blank row of pixels.)

      3. On small full tilt tables, you can't position the initial starting position too far to the left, else the software doesn't read the stack size correctly.
      I have found that just to the left of the "Sitting Out" words is about right. for some reason it picks up a number of decimal point characters if
      X is too far to the left.

      4. At the larger table sizes, Stars tables go to a stack font that is not one solid color. It has the shading of the digits.
      But it does have one dominant color, and that is what I use to do the pixel count with. The color variation seems to be at
      least 10 for the other colors. So I captured the pixel counts setting the color variation to 1.
      This should work, unless there are some computers that show the color with more variation. I know that my alternate sony
      laptop has doesn't show the colors the same as my main sony laptop. So we need some color variation in there. So I'll try setting the variation
      to about 5.
      It may be that if this doesn't work, then we'll just have to tell users that have too much color variation in their font digits,
      that they can't use the larger table sizes on stars.

      5. One good testing method is to outputdebug the Y paramater to let you know if the software is finding the blank line above the digits.
      Also, output the digitstring and alternate and pixel count strings at the end of this function.
      In the debug, you can use a mouse position to look for the digit characters.


*/
DigitSearchByPixelCount(X,Y,W,H,WinId)
{  
DigitsColor=0xFFFFFF
DigitsColorTolerance=0

FTMinimumPixelCountPerColumn := 2               ; when counting pixels in a column, this is the minimum number to be a valid column (else it is a spacer column)
FTMaximumAllowedNumPixelsInRowToBeBlank:=2                                                   ; FT has some columns with one pixel in them next to a decimal point that we need to say these are spacer columns.
                                                   ;    Like the 4 digit has one column on the right with one pixel, and this will be right next to the decimal point.
                                                ;    Fortunately the decimal point has 2 pixels in it, so that it can be detected as a dp.

   ; FT Pixel Count Digits for table (client width) 472-563
   PixelCountDigits52254 := 0
   PixelCountDigits276 := 1
   PixelCountDigits35335 := 2
   PixelCountDigits33335 := 2
   PixelCountDigits23344 := 3
   PixelCountDigits22276 := 4
   PixelCountDigits53335 := 5
   PixelCountDigits53321 := 6
   PixelCountDigits23321 := 7
   PixelCountDigits43344 := 8
   PixelCountDigits23354 := 9
   PixelCountDigits21 := "."
   PixelCountDigits3333332 := "A"
   PixelCountDigits333335 := "S"


   ; FT Pixel Count Digits for table (client width) 564-682
   PixelCountDigits622265 := 0
   PixelCountDigits287 := 1
   PixelCountDigits333336 := 2
   PixelCountDigits223355 := 3
   PixelCountDigits22287 := 4
   PixelCountDigits533346 := 5
   PixelCountDigits533332 := 6
   PixelCountDigits33321 := 7
   PixelCountDigits533355 := 8
   PixelCountDigits333354 := 9
   PixelCountDigits21 := "."
   PixelCountDigits3433432 := "A"
   PixelCountDigits333346 := "S"

   ; FT Pixel Count Digits for table (client width) 683-841
   PixelCountDigits6822865 := 0
   PixelCountDigits2887 := 1
   PixelCountDigits3544536 := 2
   PixelCountDigits2433855 := 3
   PixelCountDigits222787 := 4
   PixelCountDigits653646 := 5
   PixelCountDigits6833632 := 6
   PixelCountDigits47521 := 7
   PixelCountDigits5833855 := 8
   PixelCountDigits3633865 := 9
   PixelCountDigits221 := "."
   PixelCountDigits36636632 := "A"
   PixelCountDigits4644646 := "S"

   ; FT Pixel Count Special situation below 842-881 - looks like only the 2 digit is different here
   PixelCountDigits23444647 := 2

   ; FT Pixel Count Digits for table (client width) 842-960
   PixelCountDigits79222976 := 0
   PixelCountDigits22998 := 1
   PixelCountDigits33444647 := 2

   PixelCountDigits22333966 := 3
   PixelCountDigits2222998 := 4
   PixelCountDigits5533757 := 5
   PixelCountDigits68433743 := 6
   PixelCountDigits465421 := 7
   PixelCountDigits69333966 := 8
   PixelCountDigits47334865 := 9
   PixelCountDigits221 := "."
   PixelCountDigits2555355521 := "A"
   PixelCountDigits56333656 := "S"

   ; FT Pixel Count Digits for table (client width) 961-1040
   PixelCountDigits684224865 := 0
   PixelCountDigits22AA9 := 1
   PixelCountDigits354435647 := 2
   PixelCountDigits463337735 := 3
   PixelCountDigits22222AA9 := 4
   PixelCountDigits275335647 := 5
   PixelCountDigits685335632 := 6
   PixelCountDigits3555421 := 7
   PixelCountDigits7A3333A77 := 8
   PixelCountDigits365335865 := 9
   PixelCountDigits332 := "."
   PixelCountDigits3556365532 := "A"
   PixelCountDigits475445746 := "S"

   ; FT Pixel Count Digits for table (client width) 1041-1119
   PixelCountDigits8A42224A87 := 0
   PixelCountDigits22CCB := 1
   PixelCountDigits3544445649 := 2
   PixelCountDigits4623337957 := 3
   PixelCountDigits222222CCB := 4
   PixelCountDigits2863335759 := 5
   PixelCountDigits7954335743 := 6
   PixelCountDigits35555421 := 7
   PixelCountDigits5973337957 := 8
   PixelCountDigits4753345976 := 9
   PixelCountDigits332 := "."
   PixelCountDigits355653565532 := "A"
   PixelCountDigits5864446858 := "S"


   coordmode, pixel, Screen
   WindowScaledPos(X, Y, ClientScaleFactor, "Screen", WinId)
   W := Round(W * ClientScaleFactor)
   H := Round(H * ClientScaleFactor)
   PixelGetColor, ColorRGB,X,Y,RGB
      CheckPrimaryColorFlag := 1
      CheckAlternateColorFlag := 0
   Y += Round(H/2)
   TopRowFound := 0
   loop, % Round(H)
   {
      Xpos := X
      PixelCountInRow := 0
      ScanWidth := Round(W*3/4)
      loop,% ScanWidth
      {
         Xpos += 1
         PixelGetColor, ColorRGB,Xpos,Y,RGB
         if (CheckPrimaryColorFlag AND (ColorWithinTolerance(ColorRGB, DigitsColor, DigitsColorTolerance)))
         {
            PixelCountInRow++
            if (PixelCountInRow > FTMaximumAllowedNumPixelsInRowToBeBlank)
               break
         }
      } 
      if (Xpos == (X + ScanWidth))
      {
         TopRowFound := 1
         Y += 1                  ; move back down to the top row of the font
         break
      }
      Y -= 1
   } 
   if NOT TopRowFound
   {
      return ""
   }
   DigitString:=""
   PixelCountForAllDigitsString := ""
   PixelCountForThisDigitString := ""
   loop, %W%
   {
      ColumnNum:= A_Index
      PixelCountInColumn:=0
      FirstPixelPosition := 0
      LastPixelPosition := 0
      loop, %H%
      {
         RowNum:=A_Index
         PixelGetColor, ColorRGB,X+ColumnNum-1,Y+RowNum-1,RGB

         if (ColorWithinTolerance(ColorRGB, DigitsColor, DigitsColorTolerance))
         {
            if (!FirstPixelPosition)
               FirstPixelPosition := RowNum
            LastPixelPosition := RowNum
            PixelCountInColumn++
         }
      }
      if (PixelCountInColumn >= FTMinimumPixelCountPerColumn)
      {
         LastMinusFirstPixelPosition := LastPixelPosition  - FirstPixelPosition
         if (PixelCountInColumn > 9)
         {
            PixelCountInColumn := chr(64 + PixelCountInColumn - 9)
         }
         if PixelCountInColumn is alnum
            PixelCountForThisDigitString .= PixelCountInColumn
      }
      else
      {
         if (PixelCountForThisDigitString != "")
         {

            if (LastMinusFirstPixelPosition > 9)
               LastMinusFirstPixelPosition := chr(64 + LastMinusFirstPixelPosition - 9)
            if LastMinusFirstPixelPosition is alnum
               PixelCountForThisDigitString .= LastMinusFirstPixelPosition
            Temp := "PixelCountDigits"
            DigitString .= %Temp%%PixelCountForThisDigitString%
            PixelCountForAllDigitsString .= PixelCountForThisDigitString . A_Space
            PixelCountForThisDigitString := ""
         }
      }
   }
   Loop,
   {
      StringPosition := instr(DigitString,".")    ; find the first decimal point
      if StringPosition
      {
         if ((strlen(DigitString) - StringPosition) > 2)
            StringReplace, DigitString, DigitString,.,,
         else
            break
      }
      else
         break
   }
   if (DigitString)
   {
      PixelCountForAllDigitsStringReturned := PixelCountForAllDigitsString
      return DigitString
   }
}

ColorWithinTolerance(SampleColor, TestColor, Tolerance) {

   if (SampleColor == TestColor)
      return 1
   If (Tolerance == 0)
      return (SampleColor == TestColor)

    SampleColorRed := SampleColor >> 16
    TestColorRed := TestColor >> 16
    SampleColorGreen:= SampleColor >> 8 & 0xff
    TestColorGreen := TestColor >> 8 & 0xff
    SampleColorBlue := SampleColor & 0xff
    TestColorBlue := TestColor & 0xff
    return (    ( (SampleColorRed + Tolerance >= TestColorRed)     && (SampleColorRed - Tolerance <= TestColorRed) )
        &&      ( (SampleColorGreen + Tolerance >= TestColorGreen) && (SampleColorGreen - Toleranc <= TestColorGreene) )
        &&      ( (SampleColorBlue + Tolerance >= TestColorBlue)   && (SampleColorBlue - Tolerance <= TestColorBlue) )           )
}

WindowScaledPos(ByRef PosX, ByRef PosY, ByRef ClientScaleFactor, ScaleType="Screen", WinId="")
{
   local TitleBarHeight, WindowBottomBorder, WindowSideBorder, WindowTopBorder ,WindowX,WindowY,WindowWidth,WindowHeight
   local ClientWidth, ClientHeight , ClientWidthScaleFactor, ClientHeightScaleFactor

   StandardClientWidth=794
   StandardClientHeight=547

   SysGet, TitleBarHeight, 4
   SysGet, WindowBottomBorder, 32
   SysGet, WindowSideBorder, 33

   WindowTopBorder := TitleBarHeight + WindowBottomBorder
   WinGetPos,WindowX,WindowY,WindowWidth,WindowHeight,ahk_id%WinId%

  ; if this is a poker table, then scale the XY position based on the size of the current table to a standard table size
  ; ifWinExist, ahk_id%WinId%  ahk_group Tables
  ; {
      ClientWidth := WindowWidth - 2 * WindowSideBorder
      ClientHeight := WindowHeight - TitleBarHeight - 2 * WindowBottomBorder
      ClientWidthScaleFactor := ClientWidth / StandardClientWidth
      ClientHeightScaleFactor := ClientHeight / StandardClientHeight 
      ClientScaleFactor := ClientWidthScaleFactor     ; pass back the scaling factor in case the calling function needs it
      PosX := Round(PosX * ClientWidthScaleFactor)
      PosY := Round(PosY * ClientHeightScaleFactor)
  ; }
   
    if (ScaleType == "Client")
   {
      return
   }
   else if (ScaleType == "Window")
   {
      PosX += WindowSideBorder
      PosY += WindowTopBorder
   }

   else if (ScaleType == "Screen")
   {
      PosX += WindowX + WindowSideBorder
      PosY += WindowY + WindowTopBorder
   }
}


BuildGui:
Gui, color, white
Gui, add, tab, h490 w300, General|Global hotkeys|BetPot|Table hotkeys|Time
Gui, Tab, General

Gui, Add, Radio, x36 y70 w180 h20 Checked%ClassicTheme% vClassicTheme, Classic
Gui, Add, Radio, x36 y90 w180 h20 Checked%Racetrack% vRacetrack, Racetrack

Gui, add, text,cRed y125 x85, Use these options
Gui, add, text,cRed y140 x50, if you experience flicker problem
Gui, add, Checkbox, y160 x60 Checked%flicker1% Vflicker1
Gui, add, text, y175 x25,set FullTilt process
Gui, add, text, y190 x25,priority to high
Gui, add, Checkbox, y160 x180 Checked%flicker2% Vflicker2
Gui, add, text, y175 x125,set affinity to cpu1 only
Gui, add, text, y190 x125,for FullTilt process 
Gui, add, text, y205 x125,(Dual-core/HT cpu) 
Gui, add, text,cGreen y235 x25,Turning aero theme off (Vista/W7) might help
Gui, add, text,cGreen y250 x25,if these settings don't work.
Gui, add, text,cGreen y270 x25,It is vital to turn aero off for BetPot function.
Gui, Add, Radio, x26 y300 w220 h15 Checked%ActOnActiveTable% vActOnActiveTable, Send actions to active table
Gui, Add, Radio, x26 y315 w220 h15 Checked%sendundermouse% vsendundermouse, Send actions to table under mouse
Gui, add, text, y335 x25, Activate table under mouse
Gui, add, Checkbox, y335 x220 Checked%activatetableundermouse% Vactivatetableundermouse

Gui, add, text, y365 x25, Highlight table
Gui, add, Checkbox, y365 x100 Checked%Highlight% VHighlight
Gui, Add, Radio, x126 y360 w120 h15 Checked%highlightactive% vhighlightactive, Active
Gui, Add, Radio, x126 y375 w120 h15 Checked%highlighthero% vhighlighthero, With action on hero
Gui, add, text, y405 x25, Move mouse to action buttons
Gui, add, Checkbox, y405 x220 Checked%MoveMouse% VMoveMouse
Gui, add, text, y425 x65, Move mouse from nonfulltilt app
Gui, add, Checkbox, y425 x220 Checked%stealfocus% Vstealfocus

Gui, Add, Button, x75 y455 w55 h20 gSave,Submit
Gui, Add, Button, x135 y455 w55 h20 gCancel,Cancel

Gui, Tab, Global hotkeys

Gui, Add, Text, x25 y75 ,Register
Gui, Add, Edit, x220 y72 w50 h20 vregister, %register%
Gui, Add, Text, x25 y92 ,(join/unjoin waiting list for cash tables)
Gui, Add, Text, x25 y115 ,Unregister
Gui, Add, Edit, x220 y112 w50 h20 vunregister, %unregister%
Gui, Add, Text, x25 y140 ,Join waiting list on all tables
Gui, Add, Edit, x220 y137 w50 h20 vjoinwaitlist, %joinwaitlist%
Gui, Add, Text, x25 y165 ,Unjoin waiting list on all tables
Gui, Add, Edit, x220 y162 w50 h20 vunjoinwaitlist, %unjoinwaitlist%

Gui, Add, Text, x25 y215 ,Activate next table
Gui, Add, Edit, x220 y212 w50 h20 vActivateBottomWindow, %ActivateBottomWindow%
Gui, Add, Text, x25 y245 ,Custom layout 1
Gui, Add, Edit, x220 y242 w50 h20 vlayout1, %layout1%
Gui, Add, Text, x25 y265 ,Custom layout 2
Gui, Add, Edit, x220 y262 w50 h20 vlayout2, %layout2%
Gui, Add, Text, x25 y285 ,Custom layout 3
Gui, Add, Edit, x220 y282 w50 h20 vlayout3, %layout3%

Gui, Add, Text, x25 y315 ,Suspend all hotkeys
Gui, Add, Edit, x220 y312 w50 h20 vsuspend, %suspend%
Gui, Add, Text, x25 y335 ,Pause/unpause
Gui, Add, Edit, x220 y332 w50 h20 vTogglePause, %TogglePause%


Gui, Add, Button, x75 y415 w55 h20 gSave,Submit
Gui, Add, Button, x135 y415 w55 h20 gCancel,Cancel

Gui, Tab, Time

Gui, add, Checkbox, y75 x200 Checked%Timebank% VTimebank
Gui, add, text, y75 x25,Click Timebank automatically
Gui, add, Text, w200 y95 x25, Time delay for pressing Time button 
Gui, add, DropDownList, w40 y90 x220  vInterval1, %ddlist%
Gui, add, text, y135 x25, Click "Deal me in" automatically 
Gui, add, Checkbox, y135 x200 Checked%dealmein% Vdealmein
Gui, Add, Text, x25 y155 w120 h20 , Toggle Deal me in
Gui, Add, Edit, x220 y152 w50 h20 vToggledealmein, %Toggledealmein%
Gui, Add, Text, x25 y180 ,Sitout on all tables
Gui, Add, Edit, x180 y177 w50 h20 vSitOutNextAll, %SitOutNextAll%
Gui, Add, Text, x25 y205 ,Remove sitout on all tables
Gui, Add, Edit, x180 y202 w50 h20 vRemoveSitout, %RemoveSitout%

Gui, Add, Button, x75 y415 w55 h20 gSave,Submit
Gui, Add, Button, x135 y415 w55 h20 gCancel,Cancel

Gui, Tab, Table hotkeys

Gui, Add, Edit, x180 y67 w50 h20 vfold, %fold%
Gui, Add, Text, x25 y70 ,Fold
Gui, Add, Edit, x180 y87 w50 h20 vcall, %call%
Gui, Add, Text, x25 y90 ,Check/Call
Gui, Add, Edit, x180 y107 w50 h20 vraise, %raise%
Gui, Add, Text, x25 y110 ,Bet/Raise
Gui, Add, Edit, x180 y127 w50 h20 vfold2any, %fold2any%
Gui, Add, Text, x25 y130 ,Fold to any

Gui, Add, Button, x75 y315 w55 h20 gSave,Submit
Gui, Add, Button, x135 y315 w55 h20 gCancel,Cancel


Gui, Tab, BetPot

Gui, add, Checkbox, y55 x180 Checked%autopot% Vautopot
Gui, add, text, y55 x25,Auto put bet into bet box
Gui, Add, Text, x15 y70 ,Pre*
Gui, Add, Edit, x15 y85 w25 h20 vPotDefPre, %PotDefPre%
Gui, Add, Text, x45 y70 ,Flop*
Gui, Add, Edit, x45 y85 w25 h20 vPotDefFlop, %PotDefFlop%
Gui, Add, Text, x75 y70 ,Turn*
Gui, Add, Edit, x75 y85 w25 h20 vPotDefTurn, %PotDefTurn%
Gui, Add, Text, x105 y70 ,River*
Gui, Add, Edit, x105 y85 w25 h20 vPotDefRiver, %PotDefRiver%
Gui, Add, Text, x140 y70 ,Open
Gui, add, DropDownList, w45 y85 x140  vOpenDef, %ddlist1%
Gui, Add, Text, x175 y70 ,Round(sb)
Gui, add, Checkbox, y85 x200 Checked%RoundDef% VRoundDef
Gui, Add, Text, x230 y70 ,Fix blinds
Gui, add, Checkbox, y85 x250 Checked%FixDef% VFixDef

Gui, Add, Edit, x60 y107 w80 h20 vpot1, %pot1%
Gui, Add, Text, x15 y110 ,Pot1
Gui, Add, Text, x15 y130 ,Pre*
Gui, Add, Edit, x15 y145 w25 h20 vPot1Pre, %Pot1Pre%
Gui, Add, Text, x45 y130 ,Flop*
Gui, Add, Edit, x45 y145 w25 h20 vPot1Flop, %Pot1Flop%
Gui, Add, Text, x75 y130 ,Turn*
Gui, Add, Edit, x75 y145 w25 h20 vPot1Turn, %Pot1Turn%
Gui, Add, Text, x105 y130 ,River*
Gui, Add, Edit, x105 y145 w25 h20 vPot1River, %Pot1River%
Gui, Add, Text, x140 y130 ,Open
Gui, add, DropDownList, w45 y145 x140  vOpen1, %ddlist1%
Gui, Add, Text, x175 y130 ,Round(sb)
Gui, add, Checkbox, y145 x200 Checked%Round1% VRound1
Gui, Add, Text, x230 y130 ,Fix blinds
Gui, add, Checkbox, y145 x250 Checked%Fix1% VFix1

Gui, Add, Edit, x60 y167 w80 h20 vpot2, %pot2%
Gui, Add, Text, x15 y170 ,Pot2
Gui, Add, Edit, x15 y190 w25 h20 vPot2Pre, %Pot2Pre%
Gui, Add, Edit, x45 y190 w25 h20 vPot2Flop, %Pot2Flop%
Gui, Add, Edit, x75 y190 w25 h20 vPot2Turn, %Pot2Turn%
Gui, Add, Edit, x105 y190 w25 h20 vPot2River, %Pot2River%
Gui, add, DropDownList, w45 y190 x140  vOpen2, %ddlist1%
Gui, add, Checkbox, y190 x200 Checked%Round2% VRound2
Gui, add, Checkbox, y190 x250 Checked%Fix2% VFix2

Gui, Add, Edit, x60 y212 w80 h20 vpot3, %pot3%
Gui, Add, Text, x15 y215 ,Pot3
Gui, Add, Edit, x15 y235 w25 h20 vPot3Pre, %Pot3Pre%
Gui, Add, Edit, x45 y235 w25 h20 vPot3Flop, %Pot3Flop%
Gui, Add, Edit, x75 y235 w25 h20 vPot3Turn, %Pot3Turn%
Gui, Add, Edit, x105 y235 w25 h20 vPot3River, %Pot3River%
Gui, add, DropDownList, w45 y235 x140  vOpen3, %ddlist1%
Gui, add, Checkbox, y235 x200 Checked%Round3% VRound3
Gui, add, Checkbox, y235 x250 Checked%Fix3% VFix3

Gui, add, Checkbox, y260 x210 Checked%autobet% Vautobet
Gui, add, text, y260 x55,Additionally press bet button

Gui, Add, Edit, x80 y282 w40 h20 vincr1, %incr1%
Gui, Add, Text, x15 y285 ,Increase by
Gui, Add, Radio, x125 y280 w40 h15 Checked%bb1% vbb1,bb
Gui, Add, Radio, x125 y295 w40 h15 Checked%sb1% vsb1,sb
Gui, Add, Edit, x190 y282 w80 h20 valt1, %alt1%

Gui, Add, Edit, x80 y312 w40 h20 vincr2, %incr2%
Gui, Add, Text, x15 y315 ,Decrease by
Gui, Add, Radio, x125 y310 w40 h15 Checked%bb2% vbb2,bb
Gui, Add, Radio, x125 y325 w40 h15 Checked%sb2% vsb2,sb
Gui, Add, Edit, x190 y312 w80 h20 valt2, %alt2%

Gui, Add, Edit, x80 y342 w40 h20 vincr3, %incr3%
Gui, Add, Text, x15 y345 ,Increase by
Gui, Add, Radio, x125 y340 w40 h15 Checked%bb3% vbb3,bb
Gui, Add, Radio, x125 y355 w40 h15 Checked%sb3% vsb3,sb
Gui, Add, Edit, x190 y342 w80 h20 valt3, %alt3%

Gui, Add, Edit, x80 y372 w40 h20 vincr4, %incr4%
Gui, Add, Text, x15 y375 ,Decrease by
Gui, Add, Radio, x125 y370 w40 h15 Checked%bb4% vbb4,bb
Gui, Add, Radio, x125 y385 w40 h15 Checked%sb4% vsb4,sb
Gui, Add, Edit, x190 y372 w80 h20 valt4, %alt4%

Gui, Add, Text, x15 y400 ,Attempts to read Pot amount from screen
Gui, Add, Edit, x230 y397 w25 h20 vattempts, %attempts%

Gui, Add, Text, x15 y420 ,* Pot percent

Gui, add, text,cRed y440 x35,BetPot function won't be efficient with aero theme on

Gui, Add, Button, x75 y460 w55 h20 gSave,Submit
Gui, Add, Button, x135 y460 w55 h20 gCancel,Cancel

Gosub, GetIni
Gui, show, w316, %thisahk%
Return
;-----------------------------------------------------------------------------------------------------
GetIni:
Settitlematchmode,2
IfNotExist, %thisahk%.ini
gosub, CreateIni
IniRead, ClassicTheme,%thisahk%.ini, Options, ClassicTheme,0
IniRead, Racetrack,%thisahk%.ini, Options, Racetrack,0
IniRead, ActOnActiveTable, %thisahk%.ini, Options, ActOnActiveTable, 0
IniRead, sendundermouse, %thisahk%.ini, Options, sendundermouse, 0
IniRead, activatetableundermouse, %thisahk%.ini, Settings, activatetableundermouse, 0
IniRead, Highlight, %thisahk%.ini, Settings, Highlight, 0
IniRead, highlighthero, %thisahk%.ini, Options, highlighthero, 0
IniRead, highlightactive, %thisahk%.ini, Options, highlightactive, 0
IniRead, MoveMouse, %thisahk%.ini, Settings, MoveMouse, 0
IniRead, stealfocus, %thisahk%.ini, Settings, stealfocus, 0

IniRead, Interval1, %thisahk%.ini, Settings, Interval1
StringReplace, ddlist, ddlist, %interval1%, %Interval1%|
GuiControl, , Interval1, |%ddlist%
StringReplace, ddlist, ddlist, %interval1%|, %Interval1%
IniRead, flicker1, %thisahk%.ini, Settings, flicker1, 0
IniRead, flicker2, %thisahk%.ini, Settings, flicker2, 0
IniRead, dealmein, %thisahk%.ini, Settings, dealmein, 0
IniRead, Toggledealmein, %thisahk%.ini, Settings, Toggledealmein,%A_Space%
If Toggledealmein
{
HotKey, IfWinActive, ahk_class QWidget
Hotkey, %Toggledealmein%, Toggledealmein
}
IniRead, Timebank, %thisahk%.ini, Settings, Timebank, 0
IniRead, SitOutNextAll, %thisahk%.ini, Hotkeys, SitOutNextAll,%A_Space%
IniRead, RemoveSitout, %thisahk%.ini, Hotkeys, RemoveSitout,%A_Space%
if SitOutNextAll
Hotkey, %SitOutNextAll%,SitOutNextAll
if RemoveSitout
Hotkey, %RemoveSitout%,RemoveSitout

IniRead, register, %thisahk%.ini, Settings, register,%A_Space%
IniRead, unregister, %thisahk%.ini, Settings, unregister,%A_Space%
IniRead, joinwaitlist, %thisahk%.ini, Settings, joinwaitlist,%A_Space%
IniRead, Unjoinwaitlist, %thisahk%.ini, Settings, Unjoinwaitlist,%A_Space%
if register
Hotkey, %register%,register
if unregister
Hotkey, %unregister%,unregister
if joinwaitlist
Hotkey, %joinwaitlist%,joinwaitlist
if Unjoinwaitlist
Hotkey, %Unjoinwaitlist%,Unjoinwaitlist
IniRead, ActivateBottomWindow, %thisahk%.ini, Hotkeys, ActivateBottomWindow,%A_Space%
if ActivateBottomWindow
Hotkey, %ActivateBottomWindow%,ActivateBottomWindow
IniRead, suspend, %thisahk%.ini, Hotkeys, suspend,%A_Space%
if suspend
Hotkey, %suspend%,suspend
IniRead, TogglePause, %thisahk%.ini, Hotkeys, TogglePause,%A_Space%
if TogglePause
Hotkey, %TogglePause%,TogglePause
IniRead, layout1, %thisahk%.ini, Hotkeys, layout1,%A_Space%
if layout1
Hotkey, %layout1%,layout1
IniRead, layout2, %thisahk%.ini, Hotkeys, layout2,%A_Space%
if layout2
Hotkey, %layout2%,layout2
IniRead, layout3, %thisahk%.ini, Hotkeys, layout3,%A_Space%
if layout3
Hotkey, %layout3%,layout3


IniRead, fold, %thisahk%.ini, Hotkeys, fold,%A_Space%
IniRead, call, %thisahk%.ini, Hotkeys, call,%A_Space%
IniRead, raise, %thisahk%.ini, Hotkeys, raise,%A_Space%
IniRead, fold2any, %thisahk%.ini, Hotkeys, fold2any,%A_Space%
if fold
{
;HotKey, IfWinActive, ahk_class QWidget
HotKey, IfWinActive
Hotkey, %fold%,fold
}
if call
{
;HotKey, IfWinActive, ahk_class QWidget
HotKey, IfWinActive
Hotkey, %call%,call
}
if raise
{
;HotKey, IfWinActive, ahk_class QWidget
HotKey, IfWinActive
Hotkey, %raise%,raise
}
if fold2any
{
;HotKey, IfWinActive, ahk_class QWidget
HotKey, IfWinActive
Hotkey, %fold2any%,fold2any
}


IniRead, OpenDef, %thisahk%.ini, BetPotSettings, OpenDef
StringReplace, ddlist1, ddlist1, %OpenDef%, %OpenDef%|
GuiControl, , OpenDef, |%ddlist1%
StringReplace, ddlist1, ddlist1, %OpenDef%|, %OpenDef%
IniRead, RoundDef, %thisahk%.ini, BetPotSettings, RoundDef, 0
IniRead, FixDef, %thisahk%.ini, BetPotSettings, FixDef, 0
IniRead, PotDefPre, %thisahk%.ini, BetPotSettings, PotDefPre, 0
IniRead, PotDefFlop, %thisahk%.ini, BetPotSettings, PotDefFlop, 0
IniRead, PotDefTurn, %thisahk%.ini, BetPotSettings, PotDefTurn, 0
IniRead, PotDefRiver, %thisahk%.ini, BetPotSettings, PotDefRiver, 0

IniRead, Open1, %thisahk%.ini, BetPotSettings, Open1
StringReplace, ddlist1, ddlist1, %Open1%, %Open1%|
GuiControl, , Open1, |%ddlist1%
StringReplace, ddlist1, ddlist1, %Open1%|, %Open1%
IniRead, Round1, %thisahk%.ini, BetPotSettings, Round1, 0
IniRead, Fix1, %thisahk%.ini, BetPotSettings, Fix1, 0
IniRead, Pot1Pre, %thisahk%.ini, BetPotSettings, Pot1Pre, 0
IniRead, Pot1Flop, %thisahk%.ini, BetPotSettings, Pot1Flop, 0
IniRead, Pot1Turn, %thisahk%.ini, BetPotSettings, Pot1Turn, 0
IniRead, Pot1River, %thisahk%.ini, BetPotSettings, Pot1River, 0
IniRead, pot1, %thisahk%.ini, BetPotHotkeys, pot1,%A_Space%
if pot1
{
;HotKey, IfWinActive,ahk_class QWidget
HotKey, IfWinActive
Hotkey, %pot1%,pot1
}
IniRead, Open2, %thisahk%.ini, BetPotSettings, Open2
StringReplace, ddlist1, ddlist1, %Open2%, %Open2%|
GuiControl, , Open2, |%ddlist1%
StringReplace, ddlist1, ddlist1, %Open2%|, %Open2%
IniRead, Round2, %thisahk%.ini, BetPotSettings, Round2, 0
IniRead, Fix2, %thisahk%.ini, BetPotSettings, Fix2, 0
IniRead, Pot2Pre, %thisahk%.ini, BetPotSettings, Pot2Pre, 0
IniRead, Pot2Flop, %thisahk%.ini, BetPotSettings, Pot2Flop, 0
IniRead, Pot2Turn, %thisahk%.ini, BetPotSettings, Pot2Turn, 0
IniRead, Pot2River, %thisahk%.ini, BetPotSettings, Pot2River, 0
IniRead, pot2, %thisahk%.ini, BetPotHotkeys, pot2,%A_Space%
if pot2
{
;HotKey, IfWinActive,ahk_class QWidget
HotKey, IfWinActive
Hotkey, %pot2%,pot2
}
IniRead, Open3, %thisahk%.ini, BetPotSettings, Open3
StringReplace, ddlist1, ddlist1, %Open3%, %Open3%|
GuiControl, , Open3, |%ddlist1%
StringReplace, ddlist1, ddlist1, %Open3%|, %Open3%
IniRead, Round3, %thisahk%.ini, BetPotSettings, Round3, 0
IniRead, Fix3, %thisahk%.ini, BetPotSettings, Fix3, 0
IniRead, Pot3Pre, %thisahk%.ini, BetPotSettings, Pot3Pre, 0
IniRead, Pot3Flop, %thisahk%.ini, BetPotSettings, Pot3Flop, 0
IniRead, Pot3Turn, %thisahk%.ini, BetPotSettings, Pot3Turn, 0
IniRead, Pot3River, %thisahk%.ini, BetPotSettings, Pot3River, 0
IniRead, pot3, %thisahk%.ini, BetPotHotkeys, pot3,%A_Space%
if pot3
{
;HotKey, IfWinActive,ahk_class QWidget
HotKey, IfWinActive
Hotkey, %pot3%,pot3
}

IniRead, incr1, %thisahk%.ini, BetPotSettings, incr1, 0
IniRead, bb1, %thisahk%.ini, BetPotSettings, bb1, 0
IniRead, sb1, %thisahk%.ini, BetPotSettings, sb1, 0
IniRead, alt1, %thisahk%.ini, BetPotHotkeys, alt1, %A_Space%
if alt1
{
HotKey, IfWinActive, ahk_class QWidget
Hotkey, %alt1%,alt1
}
IniRead, incr2, %thisahk%.ini, BetPotSettings, incr2, 0
IniRead, bb2, %thisahk%.ini, BetPotSettings, bb2, 0
IniRead, sb2, %thisahk%.ini, BetPotSettings, sb2, 0
IniRead, alt2, %thisahk%.ini, BetPotHotkeys, alt2, %A_Space%
if alt2
{
HotKey, IfWinActive, ahk_class QWidget
Hotkey, %alt2%,alt2
}
IniRead, incr3, %thisahk%.ini, BetPotSettings, incr3, 0
IniRead, bb3, %thisahk%.ini, BetPotSettings, bb3, 0
IniRead, sb3, %thisahk%.ini, BetPotSettings, sb3, 0
IniRead, alt3, %thisahk%.ini, BetPotHotkeys, alt3, %A_Space%
if alt3
{
HotKey, IfWinActive, ahk_class QWidget
Hotkey, %alt3%,alt3
}
IniRead, incr4, %thisahk%.ini, BetPotSettings, incr4, 0
IniRead, bb4, %thisahk%.ini, BetPotSettings, bb4, 0
IniRead, sb4, %thisahk%.ini, BetPotSettings, sb4, 0
IniRead, alt4, %thisahk%.ini, BetPotHotkeys, alt4, %A_Space%
if alt4
{
HotKey, IfWinActive, ahk_class QWidget
Hotkey, %alt4%,alt4
}

IniRead, autopot, %thisahk%.ini, BetPotSettings, autopot, 0
IniRead, autobet, %thisahk%.ini, BetPotSettings, autobet, 0
IniRead, attempts, %thisahk%.ini, BetPotVariables, attempts, 0
Return
;-----------------------------------------------------------------------------------------------------
MakeIni:
If ClassicTheme
IniWrite, %ClassicTheme%, %thisahk%.ini, Options, ClassicTheme
If Racetrack
IniWrite, %Racetrack%, %thisahk%.ini, Options, Racetrack
if ActOnActiveTable
IniWrite, %ActOnActiveTable%, %thisahk%.ini, Options, ActOnActiveTable
if sendundermouse
IniWrite, %sendundermouse%, %thisahk%.ini, Options, sendundermouse
IniWrite, %activatetableundermouse%, %thisahk%.ini, Settings, activatetableundermouse
IniWrite, %Highlight%, %thisahk%.ini, Settings, Highlight
if highlighthero
IniWrite, %highlighthero%, %thisahk%.ini, Options, highlighthero
if highlightactive
IniWrite, %highlightactive%, %thisahk%.ini, Options, highlightactive
IniWrite, %MoveMouse%, %thisahk%.ini, Settings, MoveMouse
IniWrite, %stealfocus%, %thisahk%.ini, Settings, stealfocus
IniWrite, %Interval1%, %thisahk%.ini, Settings, Interval1
IniWrite, %flicker1%, %thisahk%.ini, Settings, flicker1
IniWrite, %flicker2%, %thisahk%.ini, Settings, flicker2
IniWrite, %dealmein%, %thisahk%.ini, Settings, dealmein
if Toggledealmein
IniWrite, %Toggledealmein%, %thisahk%.ini, Settings, Toggledealmein
IniWrite, %Timebank%, %thisahk%.ini, Settings, Timebank
if SitOutNextAll
IniWrite, %SitOutNextAll%, %thisahk%.ini, Hotkeys, SitOutNextAll
if RemoveSitout
IniWrite, %RemoveSitout%, %thisahk%.ini, Hotkeys, RemoveSitout

if register
IniWrite, %register%, %thisahk%.ini, Settings, register
if unregister
IniWrite, %unregister%, %thisahk%.ini, Settings, unregister
if joinwaitlist
IniWrite, %joinwaitlist%, %thisahk%.ini, Settings, joinwaitlist
if Unjoinwaitlist
IniWrite, %Unjoinwaitlist%, %thisahk%.ini, Settings, Unjoinwaitlist
if ActivateBottomWindow
IniWrite, %ActivateBottomWindow%, %thisahk%.ini, Hotkeys, ActivateBottomWindow
if suspend
IniWrite, %suspend%, %thisahk%.ini, Hotkeys, suspend
if TogglePause
IniWrite, %TogglePause%, %thisahk%.ini, Hotkeys, TogglePause
if layout1
IniWrite, %layout1%, %thisahk%.ini, Hotkeys, layout1
if layout2
IniWrite, %layout2%, %thisahk%.ini, Hotkeys, layout2
if layout3
IniWrite, %layout3%, %thisahk%.ini, Hotkeys, layout3


if fold
IniWrite, %fold%, %thisahk%.ini, Hotkeys, fold
if call
IniWrite, %call%, %thisahk%.ini, Hotkeys, call
if raise
IniWrite, %raise%, %thisahk%.ini, Hotkeys, raise
if fold2any
IniWrite, %fold2any%, %thisahk%.ini, Hotkeys, fold2any


IniWrite, %OpenDef%, %thisahk%.ini, BetPotSettings, OpenDef
IniWrite, %RoundDef%, %thisahk%.ini, BetPotSettings, RoundDef
IniWrite, %FixDef%, %thisahk%.ini, BetPotSettings, FixDef
IniWrite, %PotDefPre%, %thisahk%.ini, BetPotSettings, PotDefPre
IniWrite, %PotDefFlop%, %thisahk%.ini, BetPotSettings, PotDefFlop
IniWrite, %PotDefTurn%, %thisahk%.ini, BetPotSettings, PotDefTurn
IniWrite, %PotDefRiver%, %thisahk%.ini, BetPotSettings, PotDefRiver

IniWrite, %Open1%, %thisahk%.ini, BetPotSettings, Open1
IniWrite, %Round1%, %thisahk%.ini, BetPotSettings, Round1
IniWrite, %Fix1%, %thisahk%.ini, BetPotSettings, Fix1
IniWrite, %Pot1Pre%, %thisahk%.ini, BetPotSettings, Pot1Pre
IniWrite, %Pot1Flop%, %thisahk%.ini, BetPotSettings, Pot1Flop
IniWrite, %Pot1Turn%, %thisahk%.ini, BetPotSettings, Pot1Turn
IniWrite, %Pot1River%, %thisahk%.ini, BetPotSettings, Pot1River
if pot1
IniWrite, %pot1%, %thisahk%.ini, BetPotHotkeys, pot1

IniWrite, %Open2%, %thisahk%.ini, BetPotSettings, Open2
IniWrite, %Round2%, %thisahk%.ini, BetPotSettings, Round2
IniWrite, %Fix2%, %thisahk%.ini, BetPotSettings, Fix2
IniWrite, %Pot2Pre%, %thisahk%.ini, BetPotSettings, Pot2Pre
IniWrite, %Pot2Flop%, %thisahk%.ini, BetPotSettings, Pot2Flop
IniWrite, %Pot2Turn%, %thisahk%.ini, BetPotSettings, Pot2Turn
IniWrite, %Pot2River%, %thisahk%.ini, BetPotSettings, Pot2River
if pot2
IniWrite, %pot2%, %thisahk%.ini, BetPotHotkeys, pot2

IniWrite, %Open3%, %thisahk%.ini, BetPotSettings, Open3
IniWrite, %Round3%, %thisahk%.ini, BetPotSettings, Round3
IniWrite, %Fix3%, %thisahk%.ini, BetPotSettings, Fix3
IniWrite, %Pot3Pre%, %thisahk%.ini, BetPotSettings, Pot3Pre
IniWrite, %Pot3Flop%, %thisahk%.ini, BetPotSettings, Pot3Flop
IniWrite, %Pot3Turn%, %thisahk%.ini, BetPotSettings, Pot3Turn
IniWrite, %Pot3River%, %thisahk%.ini, BetPotSettings, Pot3River
if pot3
IniWrite, %pot3%, %thisahk%.ini, BetPotHotkeys, pot3


IniWrite, %incr1%, %thisahk%.ini, BetPotSettings, incr1
if bb1
IniWrite, %bb1%, %thisahk%.ini, BetPotSettings, bb1
if sb1
IniWrite, %sb1%, %thisahk%.ini, BetPotSettings, sb1
if alt1
IniWrite, %alt1%, %thisahk%.ini, BetPotHotkeys, alt1

IniWrite, %incr2%, %thisahk%.ini, BetPotSettings, incr2
if bb2
IniWrite, %bb2%, %thisahk%.ini, BetPotSettings, bb2
if sb2
IniWrite, %sb2%, %thisahk%.ini, BetPotSettings, sb2
if alt2
IniWrite, %alt2%, %thisahk%.ini, BetPotHotkeys, alt2

IniWrite, %incr3%, %thisahk%.ini, BetPotSettings, incr3
if bb3
IniWrite, %bb3%, %thisahk%.ini, BetPotSettings, bb3
if sb3
IniWrite, %sb3%, %thisahk%.ini, BetPotSettings, sb3
if alt3
IniWrite, %alt3%, %thisahk%.ini, BetPotHotkeys, alt3

IniWrite, %incr4%, %thisahk%.ini, BetPotSettings, incr4
if bb4
IniWrite, %bb4%, %thisahk%.ini, BetPotSettings, bb4
if sb4
IniWrite, %sb4%, %thisahk%.ini, BetPotSettings, sb4
if alt4
IniWrite, %alt4%, %thisahk%.ini, BetPotHotkeys, alt4


IniWrite, %autopot%, %thisahk%.ini, BetPotSettings, autopot
IniWrite, %autobet%, %thisahk%.ini, BetPotSettings, autobet
IniWrite, %attempts%, %thisahk%.ini, BetPotVariables, attempts

Return
;-----------------------------------------------------------------------------------------------------
CreateIni:
Racetrack:=0
ClassicTheme:=1
ActOnActiveTable:=1
sendundermouse:=0
activatetableundermouse:=0
Highlight:=0
highlighthero:=0
highlightactive:=1
MoveMouse:=0
stealfocus:=1

flicker1:=1
flicker2:=0
Interval1:=1
dealmein:=0
Timebank:=0

register=^r
unregister=^u

autopot:=0
autobet:=0
OpenDef=ssnl
Open1=ssnl
Open2=trny
Open3=----
RoundDef:=1
Round1:=1
Round2:=1
Round3:=1
fixDef:=1
fix1:=1
fix2:=1
fix3:=1
PotDefPre:=75
PotDefFlop:=75
PotDefTurn:=66
PotDefRiver:=66
Pot1Pre:=75
Pot1Flop:=75
Pot1Turn:=66
Pot1River:=66
Pot2Pre:=100
Pot2Flop:=80
Pot2Turn:=80
Pot2River:=80
Pot3Pre:=999
Pot3Flop:=100
Pot3Turn:=100
Pot3River:=100
Pot1=mbutton
Pot2=xbutton1
Pot3=xbutton2
incr1:=1
incr2:=1
incr3:=1
incr4:=1
bb1:=1
sb1:=0
bb2:=1
sb2:=0
bb3:=0
sb3:=1
bb4:=0
sb4:=1
alt1=wheelup
alt2=wheeldown
alt3=^wheelup
alt4=^wheeldown
attempts:=1

gosub, MakeIni
gosub, buildgui
return
;-----------------------------------------------------------------------------------------------------
GuiClose:
gosub, cancel
return
;-----------------------------------------------------------------------------------------------------
menuGui:
gosub, getini
winget,id,id, %thisahk% ahk_class AutoHotkeyGUI
if !DllCall( "IsWindowVisible", "UInt",id)
gosub, buildgui
else
winactivate,ahk_id%id%
Gui, Submit,nohide
return
;-----------------------------------------------------------------------------------------------------
reload:
reload
return
;-----------------------------------------------------------------------------------------------------
Save:
Gui, Submit
FileDelete, %thisahk%.ini
gosub, MakeIni
Reload
return
;-----------------------------------------------------------------------------------------------------
Cancel:
Gui, Destroy
Return
;-----------------------------------------------------------------------------------------------------
TogglePause:
pause,toggle
return
;-----------------------------------------------------------------------------------------------------
Suspend:
suspend
if A_IsSuspended=0
{
 T=Off
}
else
{
 T=On
}
Gui, 13:Add, Text,,Suspend: %T%
Gui, 13:+ToolWindow
Gui, 13:Show, w150 h20
Sleep, 1500
Gui, 3:Destroy
return
;-----------------------------------------------------------------------------------------------------
Edit:
edit
return
;-----------------------------------------------------------------------------------------------------
exitSub:
if flicker1
{
Process, Exist, FullTiltPoker.exe
if (ErrorLevel)
{
  FTP := ErrorLevel
  Process, Priority, %FTP%, Normal
;  SetAffinity(FTP)
}
}
;FileDelete, %thisahk%.ini
;gosub, makeini
exitApp
return
;-----------------------------------------------------------------------------------------------------
FTCash - free script for FullTilt cash players. Quote
03-16-2010 , 05:46 PM
I'm at work so I can't check anything right now. I notice the bet amounts and bet button mappings appear to be towards the end of the file (ala "Pot1River:=66"), and that they are under a section entitled "CreateIni:". I also see many references to "%thisahk%.ini" in the script. This implies to me that there is an .INI file I should be editing (if I want different bet amounts, etc.), rather than editing the script directly? I presume a default .INI file is generated upon the first run if one does not exist?
FTCash - free script for FullTilt cash players. Quote
03-16-2010 , 06:01 PM
Quote:
This implies to me that there is an .INI file I should be editing (if I want different bet amounts, etc.), rather than editing the script directly? I presume a default .INI file is generated upon the first run if one does not exist?
Yes, ini file is being generated on first run but you don't have to edit anything manually, all options can be set/changed through Gui.
FTCash - free script for FullTilt cash players. Quote
03-24-2010 , 04:53 PM
Great work. Would love to have a way to use the arrow keys to move between tables in a tiled setup, eg, right arrow activates the table to the right of the current table, up moves up, etc. Working on it now myself, but having to learn ahk is time-consuming. Would be willing to ship some $$ your way if this is something you'd do. If not, no worries. Overall, great stuff.
FTCash - free script for FullTilt cash players. Quote
03-24-2010 , 05:11 PM
It can be done i guess, there is such thing implemented in scripts for PokerStars.
FTCash - free script for FullTilt cash players. Quote
03-25-2010 , 03:27 PM
Can anyone make this compatible (or a script for 'Im back') for SNGs and Tournaments, willing to pay
FTCash - free script for FullTilt cash players. Quote
03-25-2010 , 03:47 PM
I'll try to check if there is any difference fro sng tables compared to cash tables.

Last edited by Max1mums; 03-25-2010 at 03:53 PM.
FTCash - free script for FullTilt cash players. Quote
03-25-2010 , 03:57 PM
Quote:
Originally Posted by Max1mums
I'll try to check if there is any difference fro sng tables compared to cash tables.
tried it, doesn't work (atleast not for me)
FTCash - free script for FullTilt cash players. Quote
03-25-2010 , 04:01 PM
And i've just checked it out, there isn't any difference compared to cash tables, both functions work fine. Are you using some custom table theme?
FTCash - free script for FullTilt cash players. Quote
03-25-2010 , 04:08 PM
Quote:
Originally Posted by Max1mums
And i've just checked it out, there isn't any difference compared to cash tables, both functions work fine. Are you using some custom table theme?
yea, thats prob the problem

Is there a way to use both?
FTCash - free script for FullTilt cash players. Quote
03-26-2010 , 01:01 AM
Quote:
Originally Posted by IamPro
yea, thats prob the problem

Is there a way to use both?
+1
FTCash - free script for FullTilt cash players. Quote
03-26-2010 , 03:32 PM
Yea I can't (and don't want to) undo my custom background so is there any situation to this?
FTCash - free script for FullTilt cash players. Quote
03-26-2010 , 04:10 PM
Script is supposed to be working fine with some custom themes but if it doesn't work with your theme well... enjoy your theme and forget about this script i guess.
I'm not even sure that custom theme is the case, maybe you should follow instructions for Vista/W7 from first page first?
FTCash - free script for FullTilt cash players. Quote
03-26-2010 , 04:14 PM
Quote:
Originally Posted by Max1mums
but if it doesn't work with your theme well... enjoy your theme and forget about this script i guess.
you are the best
FTCash - free script for FullTilt cash players. Quote

      
m