Two Plus Two Publishing LLC
Two Plus Two Publishing LLC
 

Go Back   Two Plus Two Poker Forums > > >

Notices

Free Software Discussion of Free / Freeware / Donationware / Open Source poker software and Free Graphics mods

Reply
 
Thread Tools Display Modes
Old 01-08-2010, 12:59 PM   #101
xPeru
Pooh-Bah
 
xPeru's Avatar
 
Join Date: Sep 2006
Location: SNE @ life; home in Peru
Posts: 4,186
Re: StarsCash - free script for PokerStars containing all functions cash player may need.

8 tabling and after a while it gets laggy again - I'll just buy a faster PC

Last session and I have focus stealing problems. I have right mouse button set up for Pot1 and Numpad1 for Pot2. Pressing either button is shifting focus to another table where I have been dealt cards or have an action waiting.
xPeru is offline   Reply With Quote
Old 01-08-2010, 01:20 PM   #102
tXipiTi
newbie
 
Join Date: May 2007
Posts: 21
Re: StarsCash - free script for PokerStars containing all functions cash player may need.

just one thing, it'll be possible to add an option to "enable keep lobby" and i'm not sure if it is possible, but it'll be possible to auto join waitinglinst without open the tables? thanks!!!
tXipiTi is offline   Reply With Quote
Old 01-08-2010, 01:24 PM   #103
Max1mums
old hand
 
Join Date: Aug 2009
Location: From Russia with code
Posts: 1,672
Re: StarsCash - free script for PokerStars containing all functions cash player may need.

xPeru, hmm 6 tables and no lags, 8 tables and alot of lags? Do lags increase with time passing or just with number of tables opened? Anyone else with such problem? But still is aero theme on or off for you? Rightclick PokerStarsUpdate.exe, go to properties, compatibility, disable desktop composition. Try also setting autohotkey process priority to high and HM process priority to low.
Pot hotkeys will send bet amount to active table only in this version, i guess i'll add "send actions to table under mouse cursor" option in next version.
Max1mums is offline   Reply With Quote
Old 01-08-2010, 01:28 PM   #104
Max1mums
old hand
 
Join Date: Aug 2009
Location: From Russia with code
Posts: 1,672
Re: StarsCash - free script for PokerStars containing all functions cash player may need.

tXipiTi, what should "enable keep lobby" function do exactly, isn't disabling "Minimize main lobby when opening table" option in advanced Multi-table options menu of PokerStars client enough?
Max1mums is offline   Reply With Quote
Old 01-09-2010, 03:43 AM   #105
madlion
old hand
 
madlion's Avatar
 
Join Date: Jan 2009
Location: Island in the Sun
Posts: 1,529
Re: StarsCash - free script for PokerStars containing all functions cash player may need.

No luck with betpot function on slick theme my tables are pretty small 525x384.

I tried on bigger tables and it ran fine.

Is there a work around?
madlion is offline   Reply With Quote
Old 01-09-2010, 09:46 AM   #106
Max1mums
old hand
 
Join Date: Aug 2009
Location: From Russia with code
Posts: 1,672
Re: StarsCash - free script for PokerStars containing all functions cash player may need.

hmm script is working fine for me there. Make sure that you have correct table theme chosen on general tab, set debug:=1 at the script beginning and check if script gets correct numbers from table for BetPot function. Which option did you use exactly, autobet or manual hotkeys?
Max1mums is offline   Reply With Quote
Old 01-09-2010, 11:16 AM   #107
Max1mums
old hand
 
Join Date: Aug 2009
Location: From Russia with code
Posts: 1,672
Re: StarsCash - free script for PokerStars containing all functions cash player may need.

StarsCash v1.30
  • Added option to send actions to active table or table under mouse cursor
  • Added option to activate table under mouse cursor
  • Added option to suspend table hotkeys for chat/notes area
  • Added option to automatically close Pokerstars windows with just OK button
  • Added option to automatically confirm table closing

Code:
; #### StarsCash ####

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


#SingleInstance, Force
#NoEnv
#MaxHotkeysPerInterval 300|
Settitlematchmode, 2
OnExit exitSub

debug:=1

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, Donate, Donation
Menu, Tray, Add, Exit, ExitSub

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

SetBatchLines, 3ms
SetWinDelay, -1
SendMode Input

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

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

boost:=false

;betpot stuff
stars_editbox = PokerStarsSliderEditorClass1
ddlist=
ddlist.="ssnl" . "|"
ddlist.="trny" . "|"
ddlist.="mix" . "|"
ddlist.="----" . "|"

gosub,getini

winget,list,list,Logged In ahk_class PokerStarsTableFrameClass
loop %list%
{
 id:=list%A_index%
 if seated%id% is not number
 {
 loop %list%
  {
   id:=list%A_index%
   seated%id%:=2
  }
 break
 }
}

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

settimer,HeroSeated,1103
settimer,Popupwatcher,147
if CheckWhenFree
settimer,FreeCheck,113
if ClickImBack
settimer,ClickBack,2033
if Timebank
settimer,ClickTimebank,1555
settimer,BetPot,87
settimer,clickwithdelay,99

loop
{
if activatetableundermouse
activatetableundermouse()

IsTableNew()

if Highlight
Highlighter()

if MoveMouse
if IsWindowNew()
MoveMouse()

if leavetable
leavetable()

sleep,100
}



;-----------------------------------------------------------------------------------------------------
IsTableNew()
{
global
winget,list,list,ahk_class PokerStarsTableFrameClass
loop %list%
{
 id:=list%A_index%
 if seated%id% is not number
 {
  wingetpos,xstart%id%,ystart%id%,,,ahk_id%id%
  if move
  WinMove, ahk_id%id%,, xpos,ypos
  if autotakeseat
  {
   if !InStr(tablequeue,id)
   movetolist(id,A_TickCount)
  }
 seated%id%:=1
 }
}
}
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=PokerStarsTableFrameClass
  return 1
  else
  return 0
 }
}
else
return 0
}
;-----------------------------------------------------------------------------------------------------
IsBetBoxNew()
{
global oldid,PotDefPre,PotDefFlop,PotDefTurn,PotDefRiver,RoundDef,OpenDef,FixDef
winget winid,id,A
if (winid<>oldid)
{
 ControlGet, Z, Visible,,PokerStarsSliderClass1, ahk_id %winid%
 if Z
 {
  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
{
 ControlGet, Z, Visible,,PokerStarsSliderClass1, ahk_id %winid%
 if !Z
 oldid=
}
}
return
;-----------------------------------------------------------------------------------------------------
IsMouseInChat(id)
{
wingetpos,,,w,h,ahk_id%id%
coordmode,mouse,relative
mousegetpos,x1,y1
mousex:=0.5000
mousey:=0.7477
relstarsclientpoint(id,mousex,mousey,0)
if ((x1<mousex) and (y1>mousey)) & ((x1>0) & (y1>0) & (y1<h) & (x1<w))
return 1
else
return 0
}
;-----------------------------------------------------------------------------------------------------
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
;-----------------------------------------------------------------------------------------------------
clickwithdelay:
Loop, Parse, tablequeue, `,
{
stringsplit,tab,A_loopfield,-
if abs(tab2-A_TickCount)>300
{
ClickSeats(tab1)
listDelItem(tablequeue, A_Loopfield) 
}
}
return
;-----------------------------------------------------------------------------------------------------
Popupwatcher:

if TakeSeat
TakeSeat()

if closeOKwindow
{
ifwinexist,PokerStars ahk_class #32770
{
ControlGet, Z, Visible,,Button2, PokerStars ahk_class #32770
if !z
ControlGet, Z, Visible,,Button3, PokerStars ahk_class #32770
if !z
controlclick,Button1,PokerStars ahk_class #32770
}
}

if Buyin
{
ifwinexist, Buy-in ahk_class #32770
{
 winget,id,id,Buy-in ahk_class #32770
 ControlGet, v, Visible,,Edit1, ahk_id %id%
 if v
 {
  parent:=DllCall("GetParent","uint",id)
  SetControlDelay, -1
  if max
  {
   Control, Check,, Button1, ahk_id %id%
   sleep,-1
   ControlClick, OK, ahk_id %id%
  }
  if remembered
  {
   ControlClick, OK, ahk_id %id%
  }
  if xbb
  {
   wingettitle,title,ahk_id %parent%
   stringtrimleft,hero,title,InStr(title, A_space,false,0)
   If ((InStr(title, "No Limit") OR InStr(title, "Pot Limit")) AND InStr(title, "Tournament") = 0)
   {
    StringMid, bb, title, InStr(title, "/") + 1, InStr(title, a_space,"", InStr(title, "/")) - InStr(title, "/") - 1
   }
   else if (InStr(title, "No Limit") <> 0 AND InStr(title, "Tournament") <> 0)
   {
    StringMid, bb, title, InStr(title, "/", "", InStr(title, "Blinds")) + 1, InStr(title, a_space, "", InStr(title, "Blinds") + 8) - InStr(title, "/", "", InStr(title, "Blinds")) - 1 ;___so we retrieve the big blind instead
   }
   StringReplace,bb,bb,$,,1  
   StringReplace,bb,bb,,,1 
   StringReplace,bb,bb,Ђ,,1
   StringReplace,bb,bb,Ј,,1
   bb*=bbmultiplier
   bb := Round(bb, 2)
   Control, Check,, Button2, ahk_id %id%
   sleep,-1
   ControlSetText, Edit1, %bb%, ahk_id%id%
   ControlClick, OK, ahk_id %id%
   winwaitclose,ahk_id %id%,,1.5
   if errorlevel
   ControlClick, Cancel, ahk_id %id%
  }
 }
}
}
return
;-----------------------------------------------------------------------------------------------------
FreeCheck:
IfWinExist, PokerStars, Check
{
 SetControlDelay, -1
 ControlFocus, Check
 Sleep, -1
 ControlClick, Check
 Sleep, -1
 ControlSend, Check, {SPACE}
}
return
;-----------------------------------------------------------------------------------------------------
HeroSeated:
winget,list1,list,ahk_class PokerStarsTableFrameClass
loop %list1%
{
 winid:=list1%A_index%
 wingettitle,title,ahk_id%winid%
 col:=PixelColorA(0.0115,0.6800,winid,1)
 if seated%winid%=1
 if instr(title,"Logged In")
 if (instr(col,"15193294")) or (instr(col,"-0-")) or (instr(col,"16777215") or (instr(col,"65331")))
 {
  if move
  {
   if AutoMoveBack 
   {
   WinMove, ahk_id%winid%,, xstart%winid%,ystart%winid%
   seated%winid%:=2
   }
  } 
  if Autopost
  {
   if !instr(title,"fast")
   {
    click_x :=0.0142
    click_y :=0.7224
    PostclickStars(click_x,click_y,winid,0)
   }
  }
  if waitbb
; if ((checkbb=1 & instr(title,"fast")) || (uncheckbb=1 & !instr(title,"fast")))
  { 
   click_x :=0.6629
   click_y :=0.8555
   PostclickStars(click_x,click_y,winid,0)
  }
 if seated%winid%!=2
 seated%winid%:=3
 }
}
return
;-----------------------------------------------------------------------------------------------------
relStarsClientPoint(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
;-----------------------------------------------------------------------------------------------------
PostLeftClick(x, y, table_id, activate=1, control_class="") {
; ### 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%
;critical,6
PostMessage, 0x201, 0x0001, ((y<<16)^x), %control_class%, ahk_id%table_id%
PostMessage, 0x202 , 0, ((y<<16)^x), %control_class%, ahk_id%table_id%
;critical,off
;sleep,-1
}
return
;-----------------------------------------------------------------------------------------------------
PostclickStars(x,y,winid,activate=1,client=1)
{
relStarsClientPoint(winid, x, y,client)
DllCall("SetCapture","Uint",winid)
PostLeftClick(x, y, winid, activate)
DllCall("ReleaseCapture")
}
return
;-----------------------------------------------------------------------------------------------------
PixelColorA(colx,coly,id,region=0,colx1=0,coly1=0,region1=0)
{
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 )
WinGet,ctrls,ControlList,ahk_id %id%
Loop,Parse,ctrls,`n
{
 class:=A_LoopField
 ControlGet,ctrlid,Hwnd,,%class%,ahk_id %id%
 ControlGet,visible,Visible,,,ahk_id %ctrlid%
 If visible=1
 DllCall("RedrawWindow","UInt",ctrlid,"UInt",0,"UInt",0,"UInt", 1|4|64|1024)
}
DllCall("RedrawWindow","UInt",id,"UInt",0,"UInt",0,"UInt", 1|4|64|1024) 
x:=floor(((W-2*xbord)*colx)) + xbord
y:=floor(((H-(2*ybord)-cap)*coly)) + ybord + cap
if region
{
loop 10
{
delta:=A_index
loop 10
{
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
;pix.=p . "*" . p1 . "-"
pix.=p . "-"
}
}
}
else
{
pix := DllCall("GetPixel", "UInt", hdc_buffer, "Int", x, "Int", y) 
SetFormat, IntegerFast, hex
pix += 0
pix .= ""
SetFormat, IntegerFast, d
}

if colx1
{
x:=floor(((W-2*xbord)*colx1)) + xbord
y:=floor(((H-(2*ybord)-cap)*coly1)) + ybord + cap
if region1
{
loop 10
{
delta:=A_index
loop 10
{
delta1:=A_index
p := DllCall("GetPixel", "UInt", hdc_buffer, "Int", x+delta , "Int", y+delta1)
pix1.=p . "-"
}
}
}
else
{
pix1 := DllCall("GetPixel", "UInt", hdc_buffer, "Int", x, "Int", y)
SetFormat, IntegerFast, hex
pix1 += 0
pix1 .= ""
SetFormat, IntegerFast, d
}
}


if region1
pix.="*" . pix1
else
if colx1
pix.="-" . pix1
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\DeleteDC", "Uint", hdc_buffer )
if boost
{
critical,off
sleep,-1
}
return pix
}
;-----------------------------------------------------------------------------------------------------
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
}
;-----------------------------------------------------------------------------------------------------
CloseAllWithNoAction:
settimer,ClickBack,off
SetControlDelay, -1
WinGet, list, List, ahk_class PokerStarsTableFrameClass
Loop, %list%
{
 winid:=list%A_Index%
 wingettitle,title,ahk_id%winid%
 Sittingout:=PixelColorA(0.8125,0.8621,winid)
 If !instr(title,"Logged In") OR ((Sittingout=0x000000) OR (Sittingout=0xDFD9CE) OR (Sittingout=0xD2EBF3) OR (Sittingout=0xB3A39D) OR (Sittingout=0x9D9D9D) OR (Sittingout=0xCCCCCC) OR (Sittingout=0xDEDBCE) OR (Sittingout=0xB5A29c) OR (Sittingout=0xBDAEAD) OR (Sittingout=0x343434)  OR (Sittingout=0x444444)  OR (Sittingout=0x333333))
 WinKill,ahk_id%winid%
}
WinGet, list, List, ahk_class PokerStarsTableFrameClass
Loop, %list%
{
 winid:=list%A_Index%
 Sittingout:=PixelColorA(0.8125,0.8621,winid)
 If !((Sittingout=0x000000) OR (Sittingout=0xDFD9CE) OR (Sittingout=0xD2EBF3) OR (Sittingout=0xB3A39D) OR (Sittingout=0x9D9D9D) OR (Sittingout=0xCCCCCC) OR (Sittingout=0xDEDBCE) OR (Sittingout=0xB5A29c) OR (Sittingout=0xBDAEAD) OR (Sittingout=0x343434)  OR (Sittingout=0x444444)  OR (Sittingout=0x333333))
 {
  back_x:=0.0141
  back_y:=0.6860
  PostClickStars(back_x, back_y, winid, 0) 
 }   
}
sleep,1000
WinGet, list, List, ahk_class PokerStarsTableFrameClass
Loop, %list%
{
 winid:=list%A_Index%
 Sittingout:=PixelColorA(0.8125,0.8621,winid)
 If ((Sittingout=0x000000) OR (Sittingout=0xDFD9CE) OR (Sittingout=0xD2EBF3) OR (Sittingout=0xB3A39D) OR (Sittingout=0x9D9D9D) OR (Sittingout=0xCCCCCC) OR (Sittingout=0xDEDBCE) OR (Sittingout=0xB5A29c) OR (Sittingout=0xBDAEAD) OR (Sittingout=0x343434)  OR (Sittingout=0x444444)  OR (Sittingout=0x333333))
 WinKill,ahk_id%winid%
}  
WinGet, list, List,Table ahk_class #32770
Loop, %list%
{
 winid:=list%A_Index%
 ControlFocus,Button1, ahk_id%winid%
 Sleep, -1
 ControlClick,Button1, ahk_id%winid%
 Sleep, -1
 ControlSend,Button1, {SPACE}, ahk_id%winid%
}
return
;-----------------------------------------------------------------------------------------------------
LeaveTable()
{
settitlematchmode,2
SetControlDelay, -1  
ifwinexist,Table ahk_class #32770
{
winget,winid,id,Table ahk_class #32770
ControlGet, v, Visible,,Button2, ahk_id %winid%
ControlGet, z, Visible,,Button3, ahk_id %winid%
if (v) & (!z)
{
 ControlFocus,Button1, ahk_id%winid%
 Sleep, -1
 ControlClick,Button1, ahk_id%winid%
 Sleep, -1
 ControlSend,Button1, {SPACE}, ahk_id%winid%
}
}
}
return
;-----------------------------------------------------------------------------------------------------
SitOutNextAll:
;ClickImBack:=false
settimer,ClickBack,off
WinGet, list, List,Logged In ahk_class PokerStarsTableFrameClass
Loop, %list%
{
 Z:=list%A_Index%
 WinGetPos,,, W, H, ahk_id %Z%
 Sittingout:=PixelColorA(0.8125,0.8621,Z)
 If !((Sittingout=0x000000) OR (Sittingout=0xDFD9CE) OR (Sittingout=0xD2EBF3) OR (Sittingout=0xB3A39D) OR (Sittingout=0x9D9D9D) OR (Sittingout=0xCCCCCC) OR (Sittingout=0xDEDBCE) OR (Sittingout=0xB5A29c) OR (Sittingout=0xBDAEAD) OR (Sittingout=0x343434)  OR (Sittingout=0x444444)  OR (Sittingout=0x333333))
 {
  back_x:=0.0141
  back_y:=0.6860
  PostClickStars(back_x, back_y, Z, 0) 
 }       
}
return
;-----------------------------------------------------------------------------------------------------
RemoveSitout:
;ClickImBack:=true
if ClickImBack
settimer,ClickBack,1500
WinGet, list, List,Logged In ahk_class PokerStarsTableFrameClass
Loop, %list%
{
 Z:=list%A_Index%
 WinGetPos,,, W, H, ahk_id %Z%
 Sittingout:=PixelColorA(0.8125,0.8621,Z)
 JoinWaitingList:=PixelColorA(0.8625,0.8621,Z)
 If (Sittingout=0x000000) OR (Sittingout=0xDFD9CE) OR (Sittingout=0xD2EBF3) OR (Sittingout=0xB3A39D) OR (Sittingout=0x9D9D9D) OR (Sittingout=0xCCCCCC) OR (Sittingout=0xDEDBCE) OR (Sittingout=0xB5A29c) OR (Sittingout=0xBDAEAD) OR (Sittingout=0x343434)  OR (Sittingout=0x444444)  OR (Sittingout=0x333333)
  If (JoinWaitingList!=0x000000) AND (JoinWaitingList!=0xDFD9CE) AND (JoinWaitingList!=0xDEDBCE) AND (JoinWaitingList!=0x0xB5A29c) AND (JoinWaitingList!=0xBDAEAD)  AND (JoinWaitingList!=0x1f1f1f)  AND (JoinWaitingList!=0x343434) AND (JoinWaitingList!=0x0202020)  AND (JoinWaitingList!=0xe6e6e6) AND (JoinWaitingList!=0xdddddd)  AND (JoinWaitingList!=0x1e1e1e) AND (JoinWaitingList!=0xb0b0b0)
 {
  back_x :=0.7515
  back_y :=0.8468
  PostClickStars(back_x, back_y, Z, 0) 
 }       
}
return
;-----------------------------------------------------------------------------------------------------
ClickBack:
winget,list,list,Logged In ahk_class PokerStarsTableFrameClass
back_x:=0.8031
back_y:=0.8405
join_x:=0.8631
join_y:=0.8405
loop %list%
{
id:=list%A_index%
col:=PixelColorA(back_x,back_y,id,1,join_x,join_y,1)
stringsplit,col,col,*
Sittingout:=col1
JoinWaitingList:=col2 
if (instr(Sittingout,"4473924")) or (instr(Sittingout,"14670286")) or (instr(Sittingout,"-0-")) or (instr(Sittingout,"-0x0-"))
 if !((instr(JoinWaitingList,"3684408")) or (instr(JoinWaitingList,"4473924")) or (instr(JoinWaitingList,"14670286")) or (instr(JoinWaitingList,"-0-")) or (instr(JoinWaitingList,"-0x0-")))
 {
  postclickstars(back_x,back_y,id,0)
 }
}
return
;-----------------------------------------------------------------------------------------------------
Toggleimback:
If (ClickImBack=true)
{
 ClickImBack:=false
 settimer,ClickBack,off
 T=Off
}
else
{
 ClickImBack:=true
 settimer,ClickBack,1500
 T=On
}
Gui, 2:Add, Text,, Auto Click Im Back: %T%
Gui, 2:+ToolWindow
Gui, 2:Show, w150 h20
Sleep, 1000
Gui, 2:Destroy
return
;-----------------------------------------------------------------------------------------------------
ClickTimebank:
winget,list,list,Logged In ahk_class PokerStarsTableFrameClass
loop %list%
{
 id:=list%A_index%
 if SlickTheme
 col:=PixelColorA(0.4920,0.7958,id,1)
 else 
 col:=PixelColorA(0.6500,0.7670,id,1)
; FileAppend, %col%`n`n, test.txt
 if (instr(col,"13484978")) or (instr(col,"1000084")) or (instr(col,"16777215")) 
 {
 if SlickTheme
  { 
  click_x :=0.5047
  click_y :=0.8256
  }
  else
  {
  click_x :=0.6582
  click_y :=0.7729
  }
  PostClickStars(click_x, click_y, id, 0)
 }
}
return
;-----------------------------------------------------------------------------------------------------
Joinwaitlist:
winget,list,list, ahk_class PokerStarsTableFrameClass
loop %list%
{
 id:=list%A_index% 
 ;col:=PixelColorA(0.6165,0.9352,id,1)
 col:=PixelColorA(0.6274,0.9352,id,1)
 ;FileAppend, %col%`n`n, test.txt
 if !(instr(col,"15921906")) & !(instr(col,"16777215"))
 {
  click_x :=0.8625
  click_y :=0.8621
  PostclickStars(click_x,click_y,id,0)
 }
}
return
;-----------------------------------------------------------------------------------------------------
Unjoinwaitlist:
winget,list,list, ahk_class PokerStarsTableFrameClass
loop %list%
{
 id:=list%A_index%
 ;col:=PixelColorA(0.6165,0.9352,id,1)
 col:=PixelColorA(0.6274,0.9352,id,1)
 if InStr(col,"15921906") or (instr(col,"16777215"))
 {
  click_x :=0.8625
  click_y :=0.8621
  PostclickStars(click_x,click_y,id,0)
 }
}
return
;-----------------------------------------------------------------------------------------------------
MoveBackByKey:
ifwinactive, ahk_class PokerStarsTableFrameClass
{
 winget,id,id,A
 if (seated%id%=1) or (seated%id%=3)
 {
  wingettitle,title,ahk_id%id%
  seated%id%:=2
  WinMove, ahk_id%id%,, xstart%id%,ystart%id%
 }
}
return
;-----------------------------------------------------------------------------------------------------
TakeSeat() 
{
global AutoReservedSeat
IfWinExist, PokerStars ahk_class #32770
{
 WinGet, list, list, Seat Available ahk_class #32770
 Loop, %list%
 {
  This_id := list%A_Index%
  ControlFocus, Button2, ahk_id%this_id%
  Sleep, -1
  ControlSend, Button2, {SPACE}, ahk_id%this_id% 
 }
 setwindelay,-1
 if AutoReservedSeat
 if list>0
 {
  sleep,400
  winget,id,id,ahk_class PokerStarsTableFrameClass
  ClickSeats(id)
 }
}
}
return
;-----------------------------------------------------------------------------------------------------
ClickSeats(id)
{ 
 Postclickstars(0.5000,0.6903,id,0)
 Postclickstars(0.2299,0.6536,id,0)
 Postclickstars(0.0697,0.4250,id,0)
 Postclickstars(0.1770,0.1835,id,0)
 Postclickstars(0.3401,0.0867,id,0)
 Postclickstars(0.6566,0.0867,id,0)
 Postclickstars(0.8333,0.1910,id,0)
 Postclickstars(0.9328,0.4250,id,0)
 Postclickstars(0.7764,0.6513,id,0)

 Postclickstars(0.1028,0.5114,id,0)
 Postclickstars(0.1028,0.2591,id,0)
 Postclickstars(0.8876,0.2591,id,0)
 Postclickstars(0.8876,0.5114,id,0)
}
return
;-----------------------------------------------------------------------------------------------------
FindTableToAct:
WinGet, l, List, ahk_class PokerStarsTableFrameClass
found:=false
v:=30
Loop, %l%
{
  winid:=l%A_Index%
  ControlGet, Z, Visible,,PokerStarsSliderClass1, ahk_id %winid%
  If Z
  {
    WinActivate, ahk_id %winid%
    found:=true
    Break
  }
}
if !found
Loop, %l%
{
  winid:=l%A_Index%
  col:=PixelColorA(foldx,foldy,winid,0,foldx1,foldy1,0)
  stringsplit,col,col,-
  if comparecolors(col1,col2,v)=0
  {
  WinActivate, ahk_id %winid%
  break
  }
}
return
;-----------------------------------------------------------------------------------------------------
ActivateBottomWindow:
GroupActivate, StarsTables
return
;-----------------------------------------------------------------------------------------------------
activatetableundermouse()
{
  If winactive("ahk_class PokerStarsTableFrameClass") or winactive("PokerStars Lobby")
  {
    MousegetPos,,,WinID
    WinGetClass, class, ahk_id %WinID%
    WinGetTitle, title, ahk_id %WinID%
    if (class="PokerStarsTableFrameClass") or (instr(title,"PokerStars Lobby"))
    winactivate, ahk_id %WinID%
  }
}
return
;-----------------------------------------------------------------------------------------------------
Cashier:
IfWinExist Cashier ahk_class #32770
{
WinActivate Cashier ahk_class #32770
SetControlDelay -1
ControlClick, PokerStarsButtonClass8, Cashier
}
else
{
WinActivate PokerStars Lobby
WinMenuSelectItem, PokerStars Lobby,, Lobby, Cashier...
}
return
;-----------------------------------------------------------------------------------------------------
Layout1:
layx:=0.5047
layy:=0.1880
layy1:=0.0940
WinGet, WinId, ID, ahk_class PokerStarsTableFrameClass 
if Winid
{
winactivate,ahk_id%winid%
if HyperSimpleTheme
{
relstarsclientpoint(winid,layx,layy1,0)
ControlClick,x%layx% y%layy1%,ahk_id %WinID%,,,,NA
}
else
{
relstarsclientpoint(winid,layx,layy,0)
ControlClick,x%layx% y%layy%,ahk_id %WinID%,,,,NA
}
Loop
{
WinWait, Options
Winactivate, Options
SetControlDelay, -1
ControlClick, Button13, Options,,,,NA
sleep 100
Send {down 5}
Send {Enter}
WinWaitClose, Options,,1
If (!ErrorLevel)	
	Break
}
}
return
;-----------------------------------------------------------------------------------------------------
Layout2:
layx:=0.5047
layy:=0.1880
layy1:=0.0940
WinGet, WinId, ID, ahk_class PokerStarsTableFrameClass 
if Winid
{
winactivate,ahk_id%winid%
if HyperSimpleTheme
{
relstarsclientpoint(winid,layx,layy1,0)
ControlClick,x%layx% y%layy1%,ahk_id %WinID%,,,,NA
}
else
{
relstarsclientpoint(winid,layx,layy,0)
ControlClick,x%layx% y%layy%,ahk_id %WinID%,,,,NA
}
Loop
{
WinWait, Options
Winactivate, Options
SetControlDelay, -1
ControlClick, Button13, Options,,,,NA
sleep 100
Send {down 6}
Send {Enter}
WinWaitClose, Options,,1
If (!ErrorLevel)	
	Break
}
}
return
;-----------------------------------------------------------------------------------------------------
Layout3:
layx:=0.5047
layy:=0.1880
layy1:=0.0940
WinGet, WinId, ID, ahk_class PokerStarsTableFrameClass 
if Winid
{
winactivate,ahk_id%winid%
if HyperSimpleTheme
{
relstarsclientpoint(winid,layx,layy1,0)
ControlClick,x%layx% y%layy1%,ahk_id %WinID%,,,,NA
}
else
{
relstarsclientpoint(winid,layx,layy,0)
ControlClick,x%layx% y%layy%,ahk_id %WinID%,,,,NA
}
Loop
{
WinWait, Options
Winactivate, Options
SetControlDelay, -1
ControlClick, Button13, Options,,,,NA
sleep 100
Send {down 7}
Send {Enter}
WinWaitClose, Options,,1
If (!ErrorLevel)	
	Break
}
}
return
;-----------------------------------------------------------------------------------------------------
HighLighter(Highlight=1)  ;x_mouse=0.75, y_mouse=0.75 
{
global last_table_id
global border_color
global border_size
global trans
;global ActiveX,ActiveY,ActiveW,ActiveH
global OldX,OldX,OldW,OldH
global highlighthero

foldx:=0.5575
foldx1:=0.5079
foldy:=0.9846
foldy1:=0.9846
v:=30

ifwinactive,ahk_class PokerStarsTableFrameClass
{  
 winget,id,id,A
 WinGetActiveStats,ActiveTitle, ActiveW, ActiveH, ActiveX, ActiveY
  relstarsclientpoint(id,foldx,foldy,0)
  pixelgetcolor,fold,foldx,foldy,ahk_id%id%
  relstarsclientpoint(id,foldx1,foldy1,0)
  pixelgetcolor,bacgr,foldx1,foldy1,ahk_id%id%
 if (id != last_table_id) || ((OldX <> ActiveX || OldY <> ActiveY || OldW <> ActiveW || OldH <> ActiveH))    
 {
  OldX := ActiveX
  OldX := 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%
  global xbord
  global cap
  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)
  { 
   ;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 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
;-----------------------------------------------------------------------------------------------------
MoveMouse(x_mouse=0.75, y_mouse=0.75)
{ 
wingetclass,class,A
wingetactivetitle,title
if class=PokerStarsTableFrameClass 
if instr(title,"Logged In") 
{
 winget,id,id,A
 relStarsClientPoint(id, x_mouse, y_mouse,0,1)
 DllCall("SetCursorPos", int, x_mouse, int, y_mouse)
}  
}
return
;-----------------------------------------------------------------------------------------------------
AlterAmount(id, dir="", frac=1, unit="")
{
 global stars_editbox
  WinGetTitle, title, ahk_id%id%
  amount := 0
  StringTrimRight, tablename, title, ( StrLen(title) - (InStr(title, " - ")-1) )
  IfWinExist, ahk_id%id% ahk_group StarsTables
  {
    If ((InStr(title, "No Limit") OR InStr(title, "Pot Limit")) AND InStr(title, "Tournament") = 0)
    {
      StringMid, bb, title, InStr(title, "/") + 1, InStr(title, a_space,"", InStr(title, "/")) - InStr(title, "/") - 1
    }
    else if (InStr(title, "No Limit") <> 0 AND InStr(title, "Tournament") <> 0)
    {
      StringMid, bb, title, InStr(title, "/", "", InStr(title, "Blinds")) + 1, InStr(title, a_space, "", InStr(title, "Blinds") + 8) - InStr(title, "/", "", InStr(title, "Blinds")) - 1 ;___so we retrieve the big blind instead
    }  
  }   
  StringReplace,bb,bb,$,,1
  StringReplace,bb,bb,Ј,,1
  StringReplace,bb,bb,Ђ,,1
  StringReplace,bb,bb,,,1 

  bb++
  bb--
  sb := sb(bb)
  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 StarsTables
    {
      PotSizeStars(id, pot, call, sb, bb, hero_bet, street, hero_position, open)
    } 
    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 StarsTables
  {
    ControlGetText, t, %stars_editbox%, ahk_id%id%
    t := t + amount
    if (t < 0)
    {
      t := 0
    }
    t1 := Round(t, 2)
    t := Round(t, 3)
    if t-t1=0
    t:=t1
    ControlSetText, %stars_editbox%, %t%, ahk_id%id%
    Sleep, -1
    ;ControlGetText, t, %stars_editbox%, ahk_id%id%
    WinSet, Redraw,, ahk_id%id%
  } 
}

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

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

  IfWinExist, ahk_id%id% ahk_group StarsTables
  {
    PotSizeStars(id, pot, call, sb, bb, hero_bet, street, hero_position, open)
  } 

  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 StarsTables
  {
    ControlSetText, %stars_editbox%, %pot%, ahk_id%id%
    Sleep, -1
  }
}

PotSizeStars(id, ByRef pot, ByRef call, ByRef sb, ByRef bb, ByRef hero_bet, ByRef street, ByRef hero_position, ByRef open)
{
  global use_old_stars_buttons, stars_editbox , ClassicTheme , HyperSimpleTheme, SlickTheme
  CoordMode, Pixel, Screen

  if ClassicTheme 
  {
  PotThemeDir := "classic"
  CallThemeDir := "classic"
  pot_x1:=0.4500
  pot_x2:=0.5506
  pot_y1:=0.0140
  pot_y2:=0.0585
  call_x1:=0.7143
  call_y1:=0.9342
  call_y2:=0.9802
  call_x2:=0.7843
  raise_x1:=0.8727
  raise_y1:=0.9342
  raise_y2:=0.9802
  raise_x2:=0.9423
  }
  else 
  if HyperSimpleTheme
  {
  PotThemeDir := "hypersimple"
  CallThemeDir := "hypersimple"
  pot_x1:=0.5000
  pot_x2:=0.5506
  pot_y1:=0.0140
  pot_y2:=0.0585
  call_x1:=0.7143
  call_y1:=0.9342
  call_y2:=0.9802
  call_x2:=0.7843
  raise_x1:=0.8727
  raise_y1:=0.9342
  raise_y2:=0.9802
  raise_x2:=0.9423
  }
  else 
  if SlickTheme
  { 
  PotThemeDir := "slick"
  CallThemeDir := "slick"
  pot_x2:=0.5266
  pot_y2:=0.1445
  pot_x1:=0.4740
  pot_y1:=0.0995
  call_y2:=0.9802
  call_y1:=0.9342
  call_x2:=0.7454
  call_x1:=0.6754
  raise_x1:=0.8474
  raise_y1:=0.9342
  raise_y2:=0.9802
  raise_x2:=0.9304
  }
  else
  {
   return
  }
  if (use_old_stars_buttons)
  {
    CallThemeDir := CallThemeDir . "\old"
  }
  street := GetStreetStars(id)

  WinGetPos, x, y, w, h, ahk_id%id%
  if (w <= 526)
  {
    SizeDir := 0
  }
  else if (w <= 621)
  {
    SizeDir := 1
  }
  else if (w <= 736)
  {
    SizeDir := 2
  }
  else if (w <= 875)
  {
    SizeDir := 3
  }
  else if (w <= 1037)
  {
    SizeDir := 4
  }
  else if (w <= 1227)
  {
    SizeDir := 5
  }
  else
  {
    SizeDir := 6
  } 

  PicDir := "StarsPics"
  potPicDir := PicDir . "\" . PotThemeDir . "\pot\" . SizeDir
  buttonPicDir := PicDir . "\" . CallThemeDir . "\call\" . SizeDir

 winset,alwaysontop,on,ahk_id%id%
  relStarsclientPoint(id, pot_x1, pot_y1,0)
  relStarsclientPoint(id, pot_x2, pot_y2,0)
  loop 3
  {
  pot := DigitSearch(pot_x1, pot_y1, pot_x2, pot_y2, id, potPicDir, "", 50)
  if pot is number
  break
  sleep,10
  }
  relStarsclientPoint(id, call_x1, call_y1,0)
  relStarsclientPoint(id, call_x2, call_y2,0)
  loop 2
  {
  call := DigitSearch(call_x1, call_y1, call_x2, call_y2, id, buttonPicDir, "", 50)
  if call is number
  break
  sleep,10
  }
  call := iif( call, call, 0 )
  bb := GetBBStars(id, GameTypeStars(WinGetTitle(id)))
  sb := sb(bb) 
 winset,alwaysontop,off,ahk_id%id%
  if (street = "pre")
  {
    ControlGetText, t, %stars_editbox%, ahk_id%id%
    ControlSetText, %stars_editbox%, 0, ahk_id%id%
  relStarsclientPoint(id, raise_x1, raise_y1,0)
  relStarsclientPoint(id, raise_x2, raise_y2,0)
 winset,alwaysontop,on,ahk_id%id%
  loop 3
  {
    minraise := DigitSearch(raise_x1, raise_y1, raise_x2, raise_y2, id, buttonPicDir, "", 50)
  if minraise is number
  break
  sleep,10
  }
 winset,alwaysontop,off,ahk_id%id%
    t := Round(t, 2)
    ControlSetText, %stars_editbox%, %t%, ahk_id%id%
    Sleep, -1
    
    if (minraise > (2*bb))
    {
      ;pot has been raised
      if (call = bb)
      {
        ;pot was minraised, and we are the BB
        hero_bet := bb
        hero_position := "bb"
      }
      else if (call < (bb*2))
      {
        ;pot was minraised, and we are the SB
        hero_bet := sb
        hero_position := "sb"
      }
    }
    else if (call = bb)
    {
      ;hero is not a blind, unraised pot, do nothing
    }
    else if (call = 0)
    {
      ;unraised pot, hero is the BB
      hero_bet := bb
      hero_position := "bb"
    }
    else if (call < bb)
    {
      ;unraised pot, hero is the SB
      hero_bet := sb
      hero_position := "sb"

    }
    else
    {
      ;pot has been raised, we are not opening
      open := 0
    }
  }
  else
  {
    ;not pre-flop, no need for open adjustment
    open := 0
  } 
  return
}

DigitSearch(startX,startY,endX,endY,win,dir,ex="",shades=1) {
If ex =
 ex = bmp
batchlines = %A_BatchLines%
SetBatchLines -1
WinGetPos,Xwin,Ywin,,,ahk_id%win%
CoordMode, Pixel, Screen
Loop, 11 {
  i = %a_index%
  If i = 10
    i = 0
  else if i = 11
    i = -1
  lastXpos := startX + Xwin
  Loop { 
    x1 := lastXpos + 1
    y1 := startY + Ywin
    x2 :=  endX + Xwin
    y2 := endY + Ywin    
    ImageSearch, lastXpos,, x1, y1, x2, y2, *%shades% %dir%\%i%.%ex%   
    If ( errorLevel )
    {
      break
    }
    p++
    p%p% = %lastXpos%
    If i = -1
      t = .
    else
      t = %i%
    StringReplace, xpos, lastXpos, -, _
    c%xpos% = %t%
   }
 }
Loop, %p%
 p_all := p_all "," p%a_index%
Sort, p_all, N D, U
Loop, Parse, p_all, `,
{
 StringReplace, xpos, a_loopfield, -, _
    
 amount := amount "" c%xpos%
} 
CoordMode, Pixel, Relative
SetBatchLines %batchlines%
return amount
}

; 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
}

GetBBStars(id, game_type) {
WinGetTitle, title, ahk_id%id% 
  StringReplace,title,title,,,1 
  StringReplace,title,title,Ђ,,1 
  StringReplace,title,title,Ј,,1
If (game_type = "NL Ring")
 return StrRep(StrMid(title,"/",a_space), "$")
else if (game_type = "NL Tourney")
 return StrRep(StrMid(title,"/",a_space,InStr(title," - Blinds")),"$")
}

GameTypeStars(title) {
If InStr(title, " - Limit Stud")
 return "Stud"
else if ((InStr(title, "NL Hold'em") || InStr(title, " - Pot Limit Hold'em") || InStr(title, " - No Limit Hold'em") || InStr(title, "PL Hold'em"))
  && InStr(title, "Tournament"))
 return "NL Tourney"
else if (InStr(title, " - No Limit Hold'em") || InStr(title, " - Pot Limit Hold'em"))
 return "NL Ring"
else
 return "Limit"
}

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
}

GetStreetStars(id)
{
  global debug
  CoordMode, Pixel, Screen
  street := "pre" 
  x1 := 0.6168
  y1 := 0.3615
  x2 := 0.6260
  y2 := 0.3711
  relStarsClientPoint(id, x1, y1,0,1)
  relStarsClientPoint(id, x2, y2,0,1)

  If ( GetPixelCount(x1, y1, x2, y2, 0xffffff) > 5 )
  {
    street := "river"
    return street
  }  
  x1 := 0.5494
  y1 := 0.3615
  x2 := 0.5587
  y2 := 0.3711
  relStarsClientPoint(id, x1, y1,0,1)
  relStarsClientPoint(id, x2, y2,0,1)

  If ( GetPixelCount(x1, y1, x2, y2, 0xffffff) > 5 )
  {
    street := "turn"
    return street
  }
  x1 := 0.3473
  y1 := 0.3615
  x2 := 0.3567
  y2 := 0.3711
  relStarsClientPoint(id, x1, y1,0,1)
  relStarsClientPoint(id, x2, y2,0,1)

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

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
}

WinGetTitle(win) {
WinGetTitle, title, ahk_id%win%
return title
}

FoldStars(id)
{
  PostClickStars(0.59,0.9241,id)
 ; Sleep, 20
 ; PostStarsClickpot(416,478,id)
}
CallStars(id)
{
  PostClickStars(0.7462,0.9241,id)
}
RaiseStars(id)
{
  PostClickStars(0.8860,0.9241,id)
}
Fold2anyStars(id)
{
  PostClickStars(0.0158,0.6467,id)
}


fold:
If ActOnActiveTable
WinGet, Id, ID, A
else
MousegetPos,,,ID
wingetclass,class,ahk_id%id%
if class=PokerStarsTableFrameClass
{
 if suspendforchat
 {
 ; If ActOnActiveTable
  if IsMouseInChat(id)
  {
   ControlGetFocus, ctrl, ahk_id%id%
   ControlSend,%ctrl% , %fold%, ahk_id%id%
  }
  else
  FoldStars(id)
 }
 else
 FoldStars(id)
}
else
{
ControlGetFocus,ctrl,ahk_id%id%
ControlSend,%ctrl%,%fold%,ahk_id%id%
}
return



call:
If ActOnActiveTable
WinGet, Id, ID, A
else
MousegetPos,,,ID
wingetclass,class,ahk_id%id%
if class=PokerStarsTableFrameClass
{
 if suspendforchat
 {
 ; If ActOnActiveTable
  if IsMouseInChat(id)
  {
   ControlGetFocus, ctrl, ahk_id%id%
   ControlSend,%ctrl% , %call%, ahk_id%id%
  }
  else
  callStars(id)
 }
 else
 callStars(id)
}
else
{
ControlGetFocus,ctrl,ahk_id%id%
ControlSend,%ctrl%,%call%,ahk_id%id%
}
return

raise:
If ActOnActiveTable
WinGet, Id, ID, A
else
MousegetPos,,,ID
wingetclass,class,ahk_id%id%
if class=PokerStarsTableFrameClass
{
 if suspendforchat
 {
 ; If ActOnActiveTable
  if IsMouseInChat(id)
  {
   ControlGetFocus, ctrl, ahk_id%id%
   ControlSend,%ctrl% , %raise%, ahk_id%id%
  }
  else
  raiseStars(id)
 }
 else
 raiseStars(id)
}
else
{
ControlGetFocus,ctrl,ahk_id%id%
ControlSend,%ctrl%,%raise%,ahk_id%id%
}
return

fold2any:
If ActOnActiveTable
WinGet, Id, ID, A
else
MousegetPos,,,ID
wingetclass,class,ahk_id%id%
if class=PokerStarsTableFrameClass
{
 if suspendforchat
 {
 ; If ActOnActiveTable
  if IsMouseInChat(id)
  {
   ControlGetFocus, ctrl, ahk_id%id%
   ControlSend,%ctrl% , %fold2any%, ahk_id%id%
  }
  else
  fold2anyStars(id)
 }
 else
 fold2anyStars(id)
}
else
{
ControlGetFocus,ctrl,ahk_id%id%
ControlSend,%ctrl%,%fold2any%,ahk_id%id%
}
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
raisestars(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
raisestars(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
raisestars(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, StarsTables, ahk_class PokerStarsTableFrameClass ,,, PokerStars Lobby
if autopot
{
isbetboxnew()
}
return
;-----------------------------------------------------------------------------------------------------
BuildGui:
Gui, color, white
;Gui, font, cOlive
Gui, add, tab, h450 w270, General|Time|Annoyances|Table moving|BetPot|Table hotkeys|Global hotkeys
Gui, Tab, General
Gui, Add, Radio, x26 y50 w180 h20 Checked%ClassicTheme% vClassicTheme, Classic Theme
Gui, Add, Radio, x26 y70 w180 h20 Checked%HyperSimpleTheme% vHyperSimpleTheme, HyperSimple Theme
Gui, Add, Radio, x26 y90 w180 h20 Checked%BlackTheme% vBlackTheme, Black Theme
Gui, Add, Radio, x26 y110 w180 h20 Checked%SlickTheme% vSlickTheme, Slick Theme
Gui, add, text, y145 x25, Highlight table
Gui, add, Checkbox, y145 x100 Checked%Highlight% VHighlight
Gui, Add, Radio, x126 y140 w120 h15 Checked%highlightactive% vhighlightactive, Active
Gui, Add, Radio, x126 y155 w120 h15 Checked%highlighthero% vhighlighthero, With action on hero
Gui, add, text, y185 x25, Move mouse to action buttons
Gui, add, Checkbox, y185 x220 Checked%MoveMouse% VMoveMouse
Gui, add, text, y205 x65, Move mouse from nonstars app
Gui, add, Checkbox, y205 x220 Checked%stealfocus% Vstealfocus
Gui, add, text, y235 x25, Suspend hotkey for chat/notes area
Gui, add, Checkbox, y235 x220 Checked%suspendforchat% Vsuspendforchat
Gui, Add, Radio, x26 y280 w220 h15 Checked%ActOnActiveTable% vActOnActiveTable, Send actions to active table
Gui, Add, Radio, x26 y295 w220 h15 Checked%sendundermouse% vsendundermouse, Send actions to table under mouse
Gui, add, text, y325 x25, Activate table under mouse
Gui, add, Checkbox, y325 x220 Checked%activatetableundermouse% Vactivatetableundermouse


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

Gui, Tab, Global hotkeys

Gui, Add, Text, x25 y105 ,Find table needing action
Gui, Add, Edit, x220 y102 w50 h20 vfindtabletoact, %findtabletoact%
Gui, Add, Text, x25 y125 ,Activate next table
Gui, Add, Edit, x220 y122 w50 h20 vActivateBottomWindow, %ActivateBottomWindow%
Gui, Add, Text, x25 y155 ,Close all tables with hero not in a hand
Gui, Add, Edit, x220 y152 w50 h20 vCloseAllWithNoAction, %CloseAllWithNoAction%
Gui, Add, Text, x25 y55 ,Suspend all hotkeys
Gui, Add, Edit, x220 y52 w50 h20 vsuspend, %suspend%
Gui, Add, Text, x25 y75 ,Pause/unpause
Gui, Add, Edit, x220 y72 w50 h20 vTogglePause, %TogglePause%
Gui, Add, Text, x25 y185 ,Cashier
Gui, Add, Edit, x220 y182 w50 h20 vCashier, %Cashier%
Gui, Add, Text, x25 y225 ,Custom layout 1
Gui, Add, Edit, x220 y222 w50 h20 vlayout1, %layout1%
Gui, Add, Text, x25 y245 ,Custom layout 2
Gui, Add, Edit, x220 y242 w50 h20 vlayout2, %layout2%
Gui, Add, Text, x25 y265 ,Custom layout 3
Gui, Add, Edit, x220 y262 w50 h20 vlayout3, %layout3%


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

Gui, Tab, Table moving
Gui, add, text, y55 x25, Move new table
Gui, add, Checkbox, y55 x120 Checked%move% Vmove
Gui, add, text, y75 x35, to position
Gui, Add, Text, x25 y95 w120 h20 , x
Gui, Add, Edit, x50 y95 w50 h20 vxpos, %xpos%
Gui, Add, Text, x25 y115 ,y
Gui, Add, Edit, x50 y115 w50 h20 vypos, %ypos%
Gui, add, Checkbox, y145 x180 Checked%automoveback% Vautomoveback
Gui, add, text, y145 x25,Move table back automatically
Gui, Add, Text, x25 y165 ,Move table back manually
Gui, Add, Edit, x180 y162 w50 h20 vmovebackByKey, %movebackByKey%

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

Gui, Tab, Annoyances

Gui, add, Checkbox, y55 x190 Checked%Autopost% VAutopost
Gui, add, text, y55 x25,Auto post blinds
Gui, add, Checkbox, y75 x190 Checked%Waitbb% VWaitbb
Gui, add, text, y75 x25,Uncheck wait for big blind
Gui, add, Checkbox, y100 x190 Checked%CheckWhenFree% VCheckWhenFree
Gui, add, text, y100 x25,Never fold for free
Gui, add, Checkbox, y120 x250 Checked%closeOKwindow% VcloseOKwindow
Gui, add, text, y120 x25,Close PokerStars windows with just OK button
Gui, add, Checkbox, y160 x90 Checked%Buyin% VBuyin
Gui, add, text, y160 x25,Auto Buy-in
Gui, Add, Radio, x120 y150 w100 h20 Checked%max% vmax, Maximum
Gui, Add, Radio, x120 y170 w120 h20 Checked%remembered% vremembered, Remembered/default
Gui, Add, Radio, x120 y190 w20 h20 Checked%xbb% vxbb
Gui, Add, Edit, x140 y190 w30 h20 vbbmultiplier, %bbmultiplier%
Gui, Add, Text, x170 y193,BB
Gui, add, Checkbox, y220 x190 Checked%TakeSeat% VTakeSeat
Gui, add, text, y220 x25,Auto Take Seat (from waiting list)
Gui, add, Checkbox, y240 x190 Checked%AutoReservedSeat% VAutoReservedSeat
Gui, add, text, y240 x55,Auto take reserved seat
Gui, add, Checkbox, y265 x190 Checked%autoTakeSeat% VautoTakeSeat
Gui, add, text, y265 x25,Auto Seat on new table
Gui, add, Checkbox, y290 x190 Checked%leavetable% Vleavetable
Gui, add, text, y290 x25,Auto leaving table confirmation


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

Gui, Tab, Time

Gui, add, Checkbox, y50 x180 Checked%ClickImBack% VClickImBack
Gui, add, text, y50 x25,Click Im Back automatically
Gui, Add, Text, x25 y70 ,Toggle Click Im Back
Gui, Add, Edit, x180 y67 w50 h20 vToggleImBack, %ToggleImBack%
Gui, add, Checkbox, y110 x180 Checked%Timebank% VTimebank
Gui, add, text, y110 x25,Click Timebank automatically
Gui, Add, Text, x25 y150 ,Sitout on all tables
Gui, Add, Edit, x180 y147 w50 h20 vSitOutNextAll, %SitOutNextAll%
Gui, Add, Text, x25 y175 ,Remove sitout on all tables
Gui, Add, Edit, x180 y172 w50 h20 vRemoveSitout, %RemoveSitout%

Gui, Add, Text, x25 y220 ,Join waiting list on all tables
Gui, Add, Edit, x180 y217 w50 h20 vjoinwaitlist, %joinwaitlist%
Gui, Add, Text, x25 y245 ,Unjoin waiting list on all tables
Gui, Add, Edit, x180 y242 w50 h20 vunjoinwaitlist, %unjoinwaitlist%

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, %ddlist%
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, %ddlist%
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, %ddlist%
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, %ddlist%
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 w50 h15 Checked%bb1% vbb1,bb
Gui, Add, Radio, x125 y295 w50 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 w50 h15 Checked%bb2% vbb2,bb
Gui, Add, Radio, x125 y325 w50 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 w50 h15 Checked%bb3% vbb3,bb
Gui, Add, Radio, x125 y355 w50 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 w50 h15 Checked%bb4% vbb4,bb
Gui, Add, Radio, x125 y385 w50 h15 Checked%sb4% vsb4,sb
Gui, Add, Edit, x190 y372 w80 h20 valt4, %alt4%

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

Gui, Add, Button, x75 y420 w55 h20 gSave,Submit
Gui, Add, Button, x135 y420 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

gosub,getini
Gui, show, w286, %thisahk%
Return
;-----------------------------------------------------------------------------------------------------
GetIni:
IfNotExist, %thisahk%.ini
gosub, CreateIni
IniRead, ClassicTheme,%thisahk%.ini, Options, ClassicTheme,0
IniRead, HyperSimpleTheme,%thisahk%.ini, Options, HyperSimpleTheme,0
IniRead, SlickTheme,%thisahk%.ini, Options, SlickTheme,0
IniRead, BlackTheme,%thisahk%.ini, Options, BlackTheme,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, suspendforchat, %thisahk%.ini, Settings, suspendforchat, 0
IniRead, ActOnActiveTable, %thisahk%.ini, Options, ActOnActiveTable, 0
IniRead, sendundermouse, %thisahk%.ini, Options, sendundermouse, 0
IniRead, activatetableundermouse, %thisahk%.ini, Settings, activatetableundermouse, 0
IniRead, ActivateBottomWindow, %thisahk%.ini, Hotkeys, ActivateBottomWindow,%A_Space%
if ActivateBottomWindow
Hotkey, %ActivateBottomWindow%,ActivateBottomWindow
IniRead, findtabletoact, %thisahk%.ini, Hotkeys, findtabletoact,%A_Space%
if findtabletoact
Hotkey, %findtabletoact%,findtabletoact
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, CloseAllWithNoAction, %thisahk%.ini, Hotkeys, CloseAllWithNoAction,%A_Space%
if CloseAllWithNoAction
Hotkey, %CloseAllWithNoAction%,CloseAllWithNoAction
IniRead, Cashier, %thisahk%.ini, Hotkeys, Cashier,%A_Space%
if Cashier
Hotkey, %Cashier%,Cashier
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, ClickImBack, %thisahk%.ini, Settings, ClickImBack, 0
IniRead, Toggleimback, %thisahk%.ini, Hotkeys, Toggleimback,%A_Space%
IniRead, TakeSeat, %thisahk%.ini, Settings, TakeSeat, 0
IniRead, autoTakeSeat, %thisahk%.ini, Settings, autoTakeSeat, 0
IniRead, AutoReservedSeat, %thisahk%.ini, Settings, AutoReservedSeat, 0
IniRead, Timebank, %thisahk%.ini, Settings, Timebank, 0
IniRead, Autopost, %thisahk%.ini, Settings, Autopost, 0 
IniRead, Waitbb, %thisahk%.ini, Settings, Waitbb, 0
IniRead, CheckWhenFree, %thisahk%.ini, Settings, CheckWhenFree, 0
IniRead, checkbb, %thisahk%.ini, Settings, checkbb, 0
IniRead, uncheckbb, %thisahk%.ini, Settings, uncheckbb, 0
IniRead, closeOKwindow, %thisahk%.ini, Settings, closeOKwindow, 0
IniRead, Buyin, %thisahk%.ini, Settings, Buyin, 0
IniRead, max, %thisahk%.ini, Settings, max, 0
IniRead, remembered, %thisahk%.ini, Settings, remembered, 0
IniRead, xbb, %thisahk%.ini, Settings, xbb, 0
IniRead, bbmultiplier, %thisahk%.ini, Variables, bbmultiplier,0
IniRead, SitOutNextAll, %thisahk%.ini, Hotkeys, SitOutNextAll,%A_Space%
IniRead, RemoveSitout, %thisahk%.ini, Hotkeys, RemoveSitout,%A_Space%
IniRead, joinwaitlist, %thisahk%.ini, Hotkeys, joinwaitlist,%A_Space%
IniRead, unjoinwaitlist, %thisahk%.ini, Hotkeys, unjoinwaitlist,%A_Space%

if SitOutNextAll
Hotkey, %SitOutNextAll%,SitOutNextAll
if RemoveSitout
Hotkey, %RemoveSitout%,RemoveSitout
if joinwaitlist
Hotkey, %joinwaitlist%,joinwaitlist
if Unjoinwaitlist
Hotkey, %Unjoinwaitlist%,Unjoinwaitlist
If Toggleimback
{
HotKey, IfWinActive
Hotkey, %Toggleimback%, Toggleimback
}
IniRead, leavetable, %thisahk%.ini, Settings, leavetable,0
IniRead, move, %thisahk%.ini, Settings, move, 0
IniRead, automoveback, %thisahk%.ini, Settings, automoveback, 0
IniRead, movebackByKey, %thisahk%.ini, Hotkeys, movebackByKey,%A_Space%
IniRead, ypos, %thisahk%.ini, Variables, ypos,0
IniRead, xpos, %thisahk%.ini, Variables, xpos,0
if MoveBackByKey
Hotkey, %MoveBackByKey%,MoveBackByKey

IniRead, OpenDef, %thisahk%.ini, BetPotSettings, OpenDef
StringReplace, ddlist, ddlist, %OpenDef%, %OpenDef%|
GuiControl, , OpenDef, |%ddlist%
StringReplace, ddlist, ddlist, %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, ddlist, ddlist, %Open1%, %Open1%|
GuiControl, , Open1, |%ddlist%
StringReplace, ddlist, ddlist, %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 PokerStarsTableFrameClass
Hotkey, %pot1%,pot1
}
IniRead, Open2, %thisahk%.ini, BetPotSettings, Open2
StringReplace, ddlist, ddlist, %Open2%, %Open2%|
GuiControl, , Open2, |%ddlist%
StringReplace, ddlist, ddlist, %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 PokerStarsTableFrameClass
Hotkey, %pot2%,pot2
}
IniRead, Open3, %thisahk%.ini, BetPotSettings, Open3
StringReplace, ddlist, ddlist, %Open3%, %Open3%|
GuiControl, , Open3, |%ddlist%
StringReplace, ddlist, ddlist, %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 PokerStarsTableFrameClass
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 PokerStarsTableFrameClass
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 PokerStarsTableFrameClass
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 PokerStarsTableFrameClass
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 PokerStarsTableFrameClass
Hotkey, %alt4%,alt4
}

IniRead, autopot, %thisahk%.ini, BetPotSettings, autopot, 0
IniRead, autobet, %thisahk%.ini, BetPotSettings, autobet, 0

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 PokerStarsTableFrameClass
HotKey, IfWinActive
Hotkey, %fold%,fold
}
if call
{
;HotKey, IfWinActive, ahk_class PokerStarsTableFrameClass
HotKey, IfWinActive
Hotkey, %call%,call
}
if raise
{
;HotKey, IfWinActive, ahk_class PokerStarsTableFrameClass
HotKey, IfWinActive
Hotkey, %raise%,raise
}
if fold2any
{
;HotKey, IfWinActive, ahk_class PokerStarsTableFrameClass
HotKey, IfWinActive
Hotkey, %fold2any%,fold2any
}
Return
;-----------------------------------------------------------------------------------------------------
MakeIni:
If ClassicTheme
IniWrite, %ClassicTheme%, %thisahk%.ini, Options, ClassicTheme
If HyperSimpleTheme
IniWrite, %HyperSimpleTheme%, %thisahk%.ini, Options, HyperSimpleTheme
If SlickTheme
IniWrite, %SlickTheme%, %thisahk%.ini, Options, SlickTheme 
If BlackTheme
IniWrite, %BlackTheme%, %thisahk%.ini, Options, BlackTheme
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, %suspendforchat%, %thisahk%.ini, Settings, suspendforchat
if ActOnActiveTable
IniWrite, %ActOnActiveTable%, %thisahk%.ini, Options, ActOnActiveTable
if sendundermouse
IniWrite, %sendundermouse%, %thisahk%.ini, Options, sendundermouse
IniWrite, %activatetableundermouse%, %thisahk%.ini, Settings, activatetableundermouse
if ActivateBottomWindow
IniWrite, %ActivateBottomWindow%, %thisahk%.ini, Hotkeys, ActivateBottomWindow
if findtabletoact
IniWrite, %findtabletoact%, %thisahk%.ini, Hotkeys, findtabletoact
if suspend
IniWrite, %suspend%, %thisahk%.ini, Hotkeys, suspend
if TogglePause
IniWrite, %TogglePause%, %thisahk%.ini, Hotkeys, TogglePause
if CloseAllWithNoAction
IniWrite, %CloseAllWithNoAction%, %thisahk%.ini, Hotkeys, CloseAllWithNoAction
if Cashier
IniWrite, %Cashier%, %thisahk%.ini, Hotkeys, Cashier
if layout1
IniWrite, %layout1%, %thisahk%.ini, Hotkeys, layout1
if layout2
IniWrite, %layout2%, %thisahk%.ini, Hotkeys, layout2
if layout3
IniWrite, %layout3%, %thisahk%.ini, Hotkeys, layout3
IniWrite, %ClickImBack%, %thisahk%.ini, Settings, ClickImBack
IniWrite, %TakeSeat%, %thisahk%.ini, Settings, TakeSeat
IniWrite, %autoTakeSeat%, %thisahk%.ini, Settings, autoTakeSeat
IniWrite, %AutoReservedSeat%, %thisahk%.ini, Settings, AutoReservedSeat
IniWrite, %Timebank%, %thisahk%.ini, Settings, Timebank
IniWrite, %Autopost%, %thisahk%.ini, Settings, Autopost
IniWrite, %Waitbb%, %thisahk%.ini, Settings, Waitbb
IniWrite, %closeOKwindow%, %thisahk%.ini, Settings, closeOKwindow
IniWrite, %CheckWhenFree%, %thisahk%.ini, Settings, CheckWhenFree
IniWrite, %Buyin%, %thisahk%.ini, Settings, Buyin
if max
IniWrite, %max%, %thisahk%.ini, Settings, max
if remembered
IniWrite, %remembered%, %thisahk%.ini, Settings, remembered
if xbb
IniWrite, %xbb%, %thisahk%.ini, Settings, xbb
IniWrite, %bbmultiplier%, %thisahk%.ini, Variables, bbmultiplier
if SitOutNextAll
IniWrite, %SitOutNextAll%, %thisahk%.ini, Hotkeys, SitOutNextAll
if RemoveSitout
IniWrite, %RemoveSitout%, %thisahk%.ini, Hotkeys, RemoveSitout
if joinwaitlist
IniWrite, %joinwaitlist%, %thisahk%.ini, Hotkeys, joinwaitlist
if Unjoinwaitlist
IniWrite, %unjoinwaitlist%, %thisahk%.ini, Hotkeys, unjoinwaitlist
if Toggleimback
IniWrite, %Toggleimback%, %thisahk%.ini, Hotkeys, Toggleimback 
IniWrite, %leavetable%, %thisahk%.ini, Settings, leavetable
IniWrite, %move%, %thisahk%.ini, Settings, move
IniWrite, %automoveback%, %thisahk%.ini, Settings, automoveback
if moveback
IniWrite, %moveback%, %thisahk%.ini, Hotkeys, moveback
if MoveBackByKey
IniWrite, %MoveBackByKey%, %thisahk%.ini, Hotkeys, MoveBackByKey
IniWrite, %ypos%, %thisahk%.ini, Variables, ypos
IniWrite, %xpos%, %thisahk%.ini, Variables, xpos

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

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
Return
;-----------------------------------------------------------------------------------------------------
CreateIni:
HyperSimpleTheme:=1
ClassicTheme:=0
SlickTheme:=0
BlackTheme:=0
Highlight:=0
highlightactive:=1
highlighthero:=0
MoveMouse:=0
stealfocus:=1
ActOnActiveTable:=1
sendundermouse:=0
activatetableundermouse:=0
suspendforchat:=0
TakeSeat:=0
autoTakeSeat:=0
AutoReservedSeat:=0
Timebank:=0
Autopost:=0
Waitbb:=0
closeOKwindow:=1
CheckWhenFree:=1
Buyin:=0
remembered:=1
bbmultiplier:=50
ClickImBack:=0
leavetable:=0
move:=0
automoveback:=0
xpos:=100
ypos:=100
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
bb2:=1
sb3:=1
sb4:=1
alt1=wheelup
alt2=wheeldown
alt3=^wheelup
alt4=^wheeldown
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
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
return
;-----------------------------------------------------------------------------------------------------
Edit:
edit
return
;-----------------------------------------------------------------------------------------------------
donation:
WinMenuSelectItem, PokerStars Lobby,, Requests, Transfer Funds...
WinWait, Transfer Funds ahk_class #32770, , 10
WinGet, tf, id
ControlFocus, Edit2, ahk_id%tf%
ControlSetText, Edit2, Max1mums
ControlFocus, Edit1, ahk_id%tf%
Sleep, -1
ControlSetText, Edit1,
GuiControl, Disable, Donate
return
;-----------------------------------------------------------------------------------------------------
exitSub:
;FileDelete, %thisahk%.ini
;gosub, makeini
exitApp
return
;-----------------------------------------------------------------------------------------------------
StarsPics (needed for BetPot function only) can be found here: http://depositfiles.com/en/files/cgcmiearw
Don't forget to choose correct table theme on General tab.

Waiting for bug reports.
Max1mums is offline   Reply With Quote
Old 01-09-2010, 04:36 PM   #108
xPeru
Pooh-Bah
 
xPeru's Avatar
 
Join Date: Sep 2006
Location: SNE @ life; home in Peru
Posts: 4,186
Re: StarsCash - free script for PokerStars containing all functions cash player may need.

First session with 1.30.

This is coming along v nicely Max1mums well done:

1.. Focus stealing. 7 tabling, and I hit a stretch where I am on one table where an action is required and there is at least one other table waiting for action (it may be a minimum of 2, not sure). Using any of the assigned hot keys fails to make a bet, but instead activates the next table.

2. Then hit another stretch where the next table was not brought to the front after an action ie I click raise, and the next waiting table does not move to the front. I assigned numpadmult as the hotkey to find table needing action and this didn't work either. Even worse, I then "lost" a table. I could hear the actions on that table, and continued to post blinds etc, but could not see the table. It was minimised on my task bar, but clicking on the icon did not activate it. After closing all other tables, I closed PS and it warned me that I was still playing on one table. I cancelled the close, and after right clicking on the minimised table and selecting maximise, the table was reacquired.

3. The icon popup with the betpot numbers in is useful for testing but a real pain in the ass because it uses vital screen real estate

Great work! This will very soon be an essential for us cash players.

FWIW that was my first session where I actually made a profit while using Starscash!
xPeru is offline   Reply With Quote
Old 01-09-2010, 04:45 PM   #109
Max1mums
old hand
 
Join Date: Aug 2009
Location: From Russia with code
Posts: 1,672
Re: StarsCash - free script for PokerStars containing all functions cash player may need.

Can you just point to exact bugs so that i could fix them? As i already said i'm not cash player and can't test script hard so you (cash players) should point me to bugs if you want them to get fixed.
btw xPeru, didn't you notice that you were the only one here blessing script work? Maybe you misconfigurated script (eg binded same hotkeys for different functions), or you are using some other scripts/programs along like tableninja?
I've just tested script, hotkeys work as they should, table/BetPot hotkeys will work for active table only with "send actions to active table" option chosen and to table under mouse with "send actions to table under mouse cursor" chosen. Which option do you have chosen? Which table theme are you using and which theme you have chosen in gui? Did you run script as admin under Vista/W7? Is aero theme on or off? Did you try running script without HM working? Try creating new file with different name instead of replacing existing code.

Can anyone report on latest version please, everything is working perfectly for me, don't know what might make script work incorrectly. Except that i forgot to disable debug mode for BetPot function, just set debug:=0 at the script beginning.

Last edited by Max1mums; 01-09-2010 at 05:02 PM.
Max1mums is offline   Reply With Quote
Old 01-09-2010, 06:08 PM   #110
madlion
old hand
 
madlion's Avatar
 
Join Date: Jan 2009
Location: Island in the Sun
Posts: 1,529
Re: StarsCash - free script for PokerStars containing all functions cash player may need.

Quote:
Originally Posted by Max1mums View Post
hmm script is working fine for me there. Make sure that you have correct table theme chosen on general tab, set debug:=1 at the script beginning and check if script gets correct numbers from table for BetPot function. Which option did you use exactly, autobet or manual hotkeys?
I will have another play sometime, def correct table theme and was using autobet.
madlion is offline   Reply With Quote
Old 01-09-2010, 06:24 PM   #111
george999
stranger
 
Join Date: Apr 2009
Posts: 14
Re: StarsCash - free script for PokerStars containing all functions cash player may need.

For me is still lagging.First 10-15 min is working ok but after 45 min. is almost unplayable.
Tested with 16 tables.
george999 is offline   Reply With Quote
Old 01-09-2010, 06:27 PM   #112
NathanFSu
centurion
 
Join Date: Feb 2007
Posts: 147
Re: StarsCash - free script for PokerStars containing all functions cash player may need.

Does this software work for no image theme ?
NathanFSu is offline   Reply With Quote
Old 01-09-2010, 07:35 PM   #113
Max1mums
old hand
 
Join Date: Aug 2009
Location: From Russia with code
Posts: 1,672
Re: StarsCash - free script for PokerStars containing all functions cash player may need.

george999, ok will check every inch of code. Do lags seem to increase with time or with number of tables and which settings/options are you using?
NathanFSu, don't really know, tou can try and tell us
Max1mums is offline   Reply With Quote
Old 01-09-2010, 07:42 PM   #114
NathanFSu
centurion
 
Join Date: Feb 2007
Posts: 147
Re: StarsCash - free script for PokerStars containing all functions cash player may need.

Windows 7 without aero
Stars
Theme: No image theme from PS
It is working almost everything but auto time bank, choose seat and betpot
Betpot is not working at all, with any theme or configuration when I click the hotkey it puts 0 in the money box
NathanFSu is offline   Reply With Quote
Old 01-09-2010, 11:07 PM   #115
Max1mums
old hand
 
Join Date: Aug 2009
Location: From Russia with code
Posts: 1,672
Re: StarsCash - free script for PokerStars containing all functions cash player may need.

StarsCash v1.33
All functions have been set to independent timers (should solve lags issue), BetPot function for small sized tables has been fixed.
Code:
; #### StarsCash ####

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


#SingleInstance, Force
#NoEnv
#MaxHotkeysPerInterval 300|
Settitlematchmode, 2
OnExit exitSub

debug:=0

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, Donate, Donation
Menu, Tray, Add, Exit, ExitSub

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

SetBatchLines,-1
SetWinDelay,-1
SendMode Input

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

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

boost:=false

;betpot stuff
stars_editbox = PokerStarsSliderEditorClass1
ddlist=
ddlist.="ssnl" . "|"
ddlist.="trny" . "|"
ddlist.="mix" . "|"
ddlist.="----" . "|"

gosub,getini

Gui 11:Show, w1 1 x1 y1, PokerWindow
WinGet,PokerWindowID, id, PokerWindow
Gui 11:Show,hide, w1 h1 x1 y1, PokerWindow

winget,list,list,Logged In ahk_class PokerStarsTableFrameClass
loop %list%
{
 id:=list%A_index%
 if seated%id% is not number
 {
 loop %list%
  {
   id:=list%A_index%
   seated%id%:=2
  }
 break
 }
}

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

settimer,HeroSeated,1103
settimer,Popupwatcher,139
if CheckWhenFree
settimer,FreeCheck,77
if ClickImBack
settimer,ClickBack,2033
if Timebank
settimer,ClickTimebank,1555
settimer,BetPot,47
settimer,clickwithdelay,153
settimer,IsTableNew,67
if Highlight
settimer,Highlighter,54
if activatetableundermouse
settimer,activatetableundermouse,133
if MoveMouse
settimer,MouseMove,119
if leavetable
settimer,closetable,249

return
;-----------------------------------------------------------------------------------------------------
IsTableNew:
winget,list,list,ahk_class PokerStarsTableFrameClass
loop %list%
{
 id:=list%A_index%
 if seated%id% is not number
 {
  wingetpos,xstart%id%,ystart%id%,,,ahk_id%id%
  if move
  WinMove, ahk_id%id%,, xpos,ypos
  if autotakeseat
  {
   if !InStr(tablequeue,id)
   movetolist(id,A_TickCount)
  }
 seated%id%:=1
 }
}
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=PokerStarsTableFrameClass
  return 1
  else
  return 0
 }
}
else
return 0
}
;-----------------------------------------------------------------------------------------------------
IsBetBoxNew()
{
global oldid,PotDefPre,PotDefFlop,PotDefTurn,PotDefRiver,RoundDef,OpenDef,FixDef
winget winid,id,A
if (winid<>oldid)
{
 ControlGet, Z, Visible,,PokerStarsSliderClass1, ahk_id %winid%
 if Z
 {
  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
{
 ControlGet, Z, Visible,,PokerStarsSliderClass1, ahk_id %winid%
 if !Z
 oldid=
}
}
return
;-----------------------------------------------------------------------------------------------------
IsMouseInChat(id)
{
wingetpos,,,w,h,ahk_id%id%
coordmode,mouse,relative
mousegetpos,x1,y1
mousex:=0.5000
mousey:=0.7477
relstarsclientpoint(id,mousex,mousey,0)
if ((x1<mousex) and (y1>mousey)) & ((x1>0) & (y1>0) & (y1<h) & (x1<w))
return 1
else
return 0
}
;-----------------------------------------------------------------------------------------------------
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
;-----------------------------------------------------------------------------------------------------
clickwithdelay:
Loop, Parse, tablequeue, `,
{
stringsplit,tab,A_loopfield,-
if abs(tab2-A_TickCount)>300
{
ClickSeats(tab1)
listDelItem(tablequeue, A_Loopfield) 
}
}
return

clickok()
{
ifwinexist,PokerStars ahk_class #32770
{
ControlGet, Z, Visible,,Button2, PokerStars ahk_class #32770
if !z
ControlGet, Z, Visible,,Button3, PokerStars ahk_class #32770
if !z
controlclick,Button1,PokerStars ahk_class #32770
}
}
return

autobuy()
{
global max,remembered,xbb,bbmultiplier
ifwinexist, Buy-in ahk_class #32770
{
 winget,id,id,Buy-in ahk_class #32770
 ControlGet, v, Visible,,Edit1, ahk_id %id%
 if v
 {
  SetControlDelay, -1
  if max
  {
   Control, Check,, Button1, ahk_id %id%
   sleep,-1
   ControlClick, OK, ahk_id %id%
  }
  if remembered
  {
   ControlClick, OK, ahk_id %id%
  }
  if xbb
  {
   parent:=DllCall("GetParent","uint",id)
   wingettitle,title,ahk_id %parent%
   stringtrimleft,hero,title,InStr(title, A_space,false,0)
   If ((InStr(title, "No Limit") OR InStr(title, "Pot Limit")) AND InStr(title, "Tournament") = 0)
   {
    StringMid, bb, title, InStr(title, "/") + 1, InStr(title, a_space,"", InStr(title, "/")) - InStr(title, "/") - 1
   }
   else if (InStr(title, "No Limit") <> 0 AND InStr(title, "Tournament") <> 0)
   {
    StringMid, bb, title, InStr(title, "/", "", InStr(title, "Blinds")) + 1, InStr(title, a_space, "", InStr(title, "Blinds") + 8) - InStr(title, "/", "", InStr(title, "Blinds")) - 1 ;___so we retrieve the big blind instead
   }
   StringReplace,bb,bb,$,,1  
   StringReplace,bb,bb,€,,1 
   StringReplace,bb,bb,Ђ,,1
   StringReplace,bb,bb,Ј,,1
   bb*=bbmultiplier
   bb := Round(bb, 2)
   Control, Check,, Button2, ahk_id %id%
   sleep,-1
   ControlSetText, Edit1, %bb%, ahk_id%id%
   ControlClick, OK, ahk_id %id%
   winwaitclose,ahk_id %id%,,1.5
   if errorlevel
   ControlClick, Cancel, ahk_id %id%
  }
 }
}
}
return
;-----------------------------------------------------------------------------------------------------
Popupwatcher:

if TakeSeat
TakeSeat()

if Buyin
autobuy()

if closeOKwindow
clickok()

return
;-----------------------------------------------------------------------------------------------------
FreeCheck:
IfWinExist, PokerStars, Check
{
 SetControlDelay, -1
 ControlFocus, Check
 Sleep, -1
 ControlClick, Check
 Sleep, -1
 ControlSend, Check, {SPACE}
}
return
;-----------------------------------------------------------------------------------------------------
HeroSeated:
winget,list1,list,ahk_class PokerStarsTableFrameClass
loop %list1%
{
 winid:=list1%A_index%
 wingettitle,title,ahk_id%winid%
 col:=PixelColorA(0.0115,0.6800,winid,1)
 if seated%winid%=1
 if instr(title,"Logged In")
 if (instr(col,"15193294")) or (instr(col,"-0-")) or (instr(col,"16777215") or (instr(col,"65331")))
 {
  if move
  {
   if AutoMoveBack 
   {
   WinMove, ahk_id%winid%,, xstart%winid%,ystart%winid%
   seated%winid%:=2
   }
  } 
  if Autopost
  {
   if !instr(title,"fast")
   {
    click_x :=0.0142
    click_y :=0.7224
    PostclickStars(click_x,click_y,winid,0)
   }
  }
  if waitbb
  { 
   click_x :=0.6629
   click_y :=0.8555
   PostclickStars(click_x,click_y,winid,0)
  }
 if seated%winid%!=2
 seated%winid%:=3
 }
}
return
;-----------------------------------------------------------------------------------------------------
relStarsClientPoint(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
;-----------------------------------------------------------------------------------------------------
PostLeftClick(x, y, table_id, activate=1, control_class="") {
; ### 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%
critical,6
PostMessage, 0x201, 0x0001, ((y<<16)^x), %control_class%, ahk_id%table_id%
PostMessage, 0x202 , 0, ((y<<16)^x), %control_class%, ahk_id%table_id%
critical,off
sleep,-1
}
return
;-----------------------------------------------------------------------------------------------------
PostclickStars(x,y,winid,activate=1,client=1)
{
relStarsClientPoint(winid, x, y,client)
DllCall("SetCapture","Uint",winid)
PostLeftClick(x, y, winid, activate)
DllCall("ReleaseCapture")
}
return
;-----------------------------------------------------------------------------------------------------
PixelColorA(colx,coly,id,region=0,colx1=0,coly1=0,region1=0)
{
global boost,xbord,ybord,cap
hdc_frame := DllCall( "GetDC", "UInt",PokerWindowID)
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 )
WinGet,ctrls,ControlList,ahk_id %id%
Loop,Parse,ctrls,`n
{
 class:=A_LoopField
 ControlGet,ctrlid,Hwnd,,%class%,ahk_id %id%
 ControlGet,visible,Visible,,,ahk_id %ctrlid%
 If visible=1
 DllCall("RedrawWindow","UInt",ctrlid,"UInt",0,"UInt",0,"UInt", 1|4|64|1024)
}
DllCall("RedrawWindow","UInt",id,"UInt",0,"UInt",0,"UInt", 1|4|64|1024) 
x:=floor(((W-2*xbord)*colx)) + xbord
y:=floor(((H-(2*ybord)-cap)*coly)) + ybord + cap
if region
{
loop 10
{
delta:=A_index
loop 10
{
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
;pix.=p . "*" . p1 . "-"
pix.=p . "-"
}
}
}
else
{
pix := DllCall("GetPixel", "UInt", hdc_buffer, "Int", x, "Int", y) 
SetFormat, IntegerFast, hex
pix += 0
pix .= ""
SetFormat, IntegerFast, d
}

if colx1
{
x:=floor(((W-2*xbord)*colx1)) + xbord
y:=floor(((H-(2*ybord)-cap)*coly1)) + ybord + cap
if region1
{
loop 10
{
delta:=A_index
loop 10
{
delta1:=A_index
p := DllCall("GetPixel", "UInt", hdc_buffer, "Int", x+delta , "Int", y+delta1)
pix1.=p . "-"
}
}
}
else
{
pix1 := DllCall("GetPixel", "UInt", hdc_buffer, "Int", x, "Int", y)
SetFormat, IntegerFast, hex
pix1 += 0
pix1 .= ""
SetFormat, IntegerFast, d
}
}


if region1
pix.="*" . pix1
else
if colx1
pix.="-" . pix1
sleep,1
DllCall( "gdi32.dll\DeleteObject","Uint",hbm_buffer)
DllCall( "gdi32.dll\ReleaseDC","Uint",hdc_buffer)
DllCall( "gdi32.dll\DeleteDC","Uint",hdc_buffer)
DllCall( "gdi32.dll\ReleaseDC","Uint",hdc_frame)
DllCall( "gdi32.dll\DeleteDC","Uint",hdc_frame)
return pix
}
;-----------------------------------------------------------------------------------------------------
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
}
;-----------------------------------------------------------------------------------------------------
CloseAllWithNoAction:
settimer,ClickBack,off
SetControlDelay, -1
WinGet, list, List, ahk_class PokerStarsTableFrameClass
Loop, %list%
{
 winid:=list%A_Index%
 wingettitle,title,ahk_id%winid%
 Sittingout:=PixelColorA(0.8125,0.8621,winid)
 If !instr(title,"Logged In") OR ((Sittingout=0x000000) OR (Sittingout=0xDFD9CE) OR (Sittingout=0xD2EBF3) OR (Sittingout=0xB3A39D) OR (Sittingout=0x9D9D9D) OR (Sittingout=0xCCCCCC) OR (Sittingout=0xDEDBCE) OR (Sittingout=0xB5A29c) OR (Sittingout=0xBDAEAD) OR (Sittingout=0x343434)  OR (Sittingout=0x444444)  OR (Sittingout=0x333333))
 WinKill,ahk_id%winid%
}
WinGet, list, List, ahk_class PokerStarsTableFrameClass
Loop, %list%
{
 winid:=list%A_Index%
 Sittingout:=PixelColorA(0.8125,0.8621,winid)
 If !((Sittingout=0x000000) OR (Sittingout=0xDFD9CE) OR (Sittingout=0xD2EBF3) OR (Sittingout=0xB3A39D) OR (Sittingout=0x9D9D9D) OR (Sittingout=0xCCCCCC) OR (Sittingout=0xDEDBCE) OR (Sittingout=0xB5A29c) OR (Sittingout=0xBDAEAD) OR (Sittingout=0x343434)  OR (Sittingout=0x444444)  OR (Sittingout=0x333333))
 {
  back_x:=0.0141
  back_y:=0.6860
  PostClickStars(back_x, back_y, winid, 0) 
 }   
}
sleep,1000
WinGet, list, List, ahk_class PokerStarsTableFrameClass
Loop, %list%
{
 winid:=list%A_Index%
 Sittingout:=PixelColorA(0.8125,0.8621,winid)
 If ((Sittingout=0x000000) OR (Sittingout=0xDFD9CE) OR (Sittingout=0xD2EBF3) OR (Sittingout=0xB3A39D) OR (Sittingout=0x9D9D9D) OR (Sittingout=0xCCCCCC) OR (Sittingout=0xDEDBCE) OR (Sittingout=0xB5A29c) OR (Sittingout=0xBDAEAD) OR (Sittingout=0x343434)  OR (Sittingout=0x444444)  OR (Sittingout=0x333333))
 WinKill,ahk_id%winid%
}  
WinGet, list, List,Table ahk_class #32770
Loop, %list%
{
 winid:=list%A_Index%
 ControlFocus,Button1, ahk_id%winid%
 Sleep, -1
 ControlClick,Button1, ahk_id%winid%
 Sleep, -1
 ControlSend,Button1, {SPACE}, ahk_id%winid%
}
return
;-----------------------------------------------------------------------------------------------------
closetable:
LeaveTable()
return

LeaveTable()
{
settitlematchmode,2
SetControlDelay, -1  
ifwinexist,Table ahk_class #32770
{
winget,winid,id,Table ahk_class #32770
ControlGet, v, Visible,,Button2, ahk_id %winid%
ControlGet, z, Visible,,Button3, ahk_id %winid%
if (v) & (!z)
{
 ControlFocus,Button1, ahk_id%winid%
 Sleep, -1
 ControlClick,Button1, ahk_id%winid%
 Sleep, -1
 ControlSend,Button1, {SPACE}, ahk_id%winid%
}
}
}
return
;-----------------------------------------------------------------------------------------------------
SitOutNextAll:
;ClickImBack:=false
settimer,ClickBack,off
WinGet, list, List,Logged In ahk_class PokerStarsTableFrameClass
Loop, %list%
{
 Z:=list%A_Index%
 WinGetPos,,, W, H, ahk_id %Z%
 Sittingout:=PixelColorA(0.8125,0.8621,Z)
 If !((Sittingout=0x000000) OR (Sittingout=0xDFD9CE) OR (Sittingout=0xD2EBF3) OR (Sittingout=0xB3A39D) OR (Sittingout=0x9D9D9D) OR (Sittingout=0xCCCCCC) OR (Sittingout=0xDEDBCE) OR (Sittingout=0xB5A29c) OR (Sittingout=0xBDAEAD) OR (Sittingout=0x343434)  OR (Sittingout=0x444444)  OR (Sittingout=0x333333))
 {
  back_x:=0.0141
  back_y:=0.6860
  PostClickStars(back_x, back_y, Z, 0) 
 }       
}
return
;-----------------------------------------------------------------------------------------------------
RemoveSitout:
;ClickImBack:=true
if ClickImBack
settimer,ClickBack,1500
WinGet, list, List,Logged In ahk_class PokerStarsTableFrameClass
Loop, %list%
{
 Z:=list%A_Index%
 WinGetPos,,, W, H, ahk_id %Z%
 Sittingout:=PixelColorA(0.8125,0.8621,Z)
 JoinWaitingList:=PixelColorA(0.8625,0.8621,Z)
 If (Sittingout=0x000000) OR (Sittingout=0xDFD9CE) OR (Sittingout=0xD2EBF3) OR (Sittingout=0xB3A39D) OR (Sittingout=0x9D9D9D) OR (Sittingout=0xCCCCCC) OR (Sittingout=0xDEDBCE) OR (Sittingout=0xB5A29c) OR (Sittingout=0xBDAEAD) OR (Sittingout=0x343434)  OR (Sittingout=0x444444)  OR (Sittingout=0x333333)
  If (JoinWaitingList!=0x000000) AND (JoinWaitingList!=0xDFD9CE) AND (JoinWaitingList!=0xDEDBCE) AND (JoinWaitingList!=0x0xB5A29c) AND (JoinWaitingList!=0xBDAEAD)  AND (JoinWaitingList!=0x1f1f1f)  AND (JoinWaitingList!=0x343434) AND (JoinWaitingList!=0x0202020)  AND (JoinWaitingList!=0xe6e6e6) AND (JoinWaitingList!=0xdddddd)  AND (JoinWaitingList!=0x1e1e1e) AND (JoinWaitingList!=0xb0b0b0)
 {
  back_x :=0.7515
  back_y :=0.8468
  PostClickStars(back_x, back_y, Z, 0) 
 }       
}
return
;-----------------------------------------------------------------------------------------------------
ClickBack:
imback()
return
;-----------------------------------------------------------------------------------------------------
imback()
{
winget,list,list,Logged In ahk_class PokerStarsTableFrameClass
back_x:=0.8031
back_y:=0.8405
join_x:=0.8631
join_y:=0.8405
loop %list%
{
id:=list%A_index%
col:=PixelColorA(back_x,back_y,id,1,join_x,join_y,1)
stringsplit,col,col,*
Sittingout:=col1
JoinWaitingList:=col2 
if (instr(Sittingout,"4473924")) or (instr(Sittingout,"14670286")) or (instr(Sittingout,"-0-")) or (instr(Sittingout,"-0x0-"))
 if !((instr(JoinWaitingList,"3684408")) or (instr(JoinWaitingList,"4473924")) or (instr(JoinWaitingList,"14670286")) or (instr(JoinWaitingList,"-0-")) or (instr(JoinWaitingList,"-0x0-")))
 {
  postclickstars(back_x,back_y,id,0)
 }
}
}
return
;-----------------------------------------------------------------------------------------------------
Toggleimback:
If (ClickImBack=true)
{
 ClickImBack:=false
 settimer,ClickBack,off
 T=Off
}
else
{
 ClickImBack:=true
 settimer,ClickBack,1500
 T=On
}
Gui, 2:Add, Text,, Auto Click Im Back: %T%
Gui, 2:+ToolWindow
Gui, 2:Show, w150 h20
Sleep, 1000
Gui, 2:Destroy
return
;-----------------------------------------------------------------------------------------------------
ClickTimebank:
clicktime()
return
;-----------------------------------------------------------------------------------------------------
clicktime()
{
global SlickTheme
winget,list,list,Logged In ahk_class PokerStarsTableFrameClass
loop %list%
{
 id:=list%A_index%
 if SlickTheme
 col:=PixelColorA(0.4920,0.7958,id,1)
 else 
 col:=PixelColorA(0.6500,0.7670,id,1)
; FileAppend, %col%`n`n, test.txt
 if (instr(col,"13484978")) or (instr(col,"1000084")) or (instr(col,"16777215")) 
 {
 if SlickTheme
  { 
  click_x :=0.5047
  click_y :=0.8256
  }
  else
  {
  click_x :=0.6582
  click_y :=0.7729
  }
  PostClickStars(click_x, click_y, id, 0)
 }
}
}
return
;-----------------------------------------------------------------------------------------------------
Joinwaitlist:
winget,list,list, ahk_class PokerStarsTableFrameClass
loop %list%
{
 id:=list%A_index% 
 ;col:=PixelColorA(0.6165,0.9352,id,1)
 col:=PixelColorA(0.6274,0.9352,id,1)
 ;FileAppend, %col%`n`n, test.txt
 if !(instr(col,"15921906")) & !(instr(col,"16777215"))
 {
  click_x :=0.8625
  click_y :=0.8621
  PostclickStars(click_x,click_y,id,0)
 }
}
return
;-----------------------------------------------------------------------------------------------------
Unjoinwaitlist:
winget,list,list, ahk_class PokerStarsTableFrameClass
loop %list%
{
 id:=list%A_index%
 ;col:=PixelColorA(0.6165,0.9352,id,1)
 col:=PixelColorA(0.6274,0.9352,id,1)
 if InStr(col,"15921906") or (instr(col,"16777215"))
 {
  click_x :=0.8625
  click_y :=0.8621
  PostclickStars(click_x,click_y,id,0)
 }
}
return
;-----------------------------------------------------------------------------------------------------
MoveBackByKey:
ifwinactive, ahk_class PokerStarsTableFrameClass
{
 winget,id,id,A
 if (seated%id%=1) or (seated%id%=3)
 {
  wingettitle,title,ahk_id%id%
  seated%id%:=2
  WinMove, ahk_id%id%,, xstart%id%,ystart%id%
 }
}
return
;-----------------------------------------------------------------------------------------------------
TakeSeat() 
{
global AutoReservedSeat
IfWinExist, PokerStars ahk_class #32770
{
 WinGet, list, list, Seat Available ahk_class #32770
 Loop, %list%
 {
  This_id := list%A_Index%
  ControlFocus, Button2, ahk_id%this_id%
  Sleep, -1
  ControlSend, Button2, {SPACE}, ahk_id%this_id% 
 }
 setwindelay,-1
 if AutoReservedSeat
 if list>0
 {
  sleep,400
  winget,id,id,ahk_class PokerStarsTableFrameClass
  ClickSeats(id)
 }
}
}
return
;-----------------------------------------------------------------------------------------------------
ClickSeats(id)
{ 
 Postclickstars(0.5000,0.6903,id,0)
 Postclickstars(0.2299,0.6536,id,0)
 Postclickstars(0.0697,0.4250,id,0)
 Postclickstars(0.1770,0.1835,id,0)
 Postclickstars(0.3401,0.0867,id,0)
 Postclickstars(0.6566,0.0867,id,0)
 Postclickstars(0.8333,0.1910,id,0)
 Postclickstars(0.9328,0.4250,id,0)
 Postclickstars(0.7764,0.6513,id,0)

 Postclickstars(0.1028,0.5114,id,0)
 Postclickstars(0.1028,0.2591,id,0)
 Postclickstars(0.8876,0.2591,id,0)
 Postclickstars(0.8876,0.5114,id,0)
}
return
;-----------------------------------------------------------------------------------------------------
FindTableToAct:
findactivetable()
return
;-----------------------------------------------------------------------------------------------------
findactivetable()
{
WinGet, l, List, ahk_class PokerStarsTableFrameClass
found:=false
v:=30
Loop, %l%
{
  winid:=l%A_Index%
  ControlGet, Z, Visible,,PokerStarsSliderClass1, ahk_id %winid%
  If Z
  {
    WinActivate, ahk_id %winid%
    found:=true
    Break
  }
}
if !found
Loop, %l%
{
  winid:=l%A_Index%
  col:=PixelColorA(foldx,foldy,winid,0,foldx1,foldy1,0)
  stringsplit,col,col,-
  if comparecolors(col1,col2,v)=0
  {
  WinActivate, ahk_id %winid%
  break
  }
}
}
return
;-----------------------------------------------------------------------------------------------------
ActivateBottomWindow:
GroupActivate, StarsTables
return
;-----------------------------------------------------------------------------------------------------
activatetableundermouse:
activatetableundermouse()
return

activatetableundermouse()
{
  If winactive("ahk_class PokerStarsTableFrameClass") or winactive("PokerStars Lobby")
  {
    MousegetPos,,,WinID
    WinGetClass, class, ahk_id %WinID%
    WinGetTitle, title, ahk_id %WinID%
    if (class="PokerStarsTableFrameClass") or (instr(title,"PokerStars Lobby"))
    winactivate, ahk_id %WinID%
  }
}
return
;-----------------------------------------------------------------------------------------------------
Cashier:
IfWinExist Cashier ahk_class #32770
{
WinActivate Cashier ahk_class #32770
SetControlDelay -1
ControlClick, PokerStarsButtonClass8, Cashier
}
else
{
WinActivate PokerStars Lobby
WinMenuSelectItem, PokerStars Lobby,, Lobby, Cashier...
}
return
;-----------------------------------------------------------------------------------------------------
Layout1:
layx:=0.5047
layy:=0.1880
layy1:=0.0940
WinGet, WinId, ID, ahk_class PokerStarsTableFrameClass 
if Winid
{
winactivate,ahk_id%winid%
if HyperSimpleTheme
{
relstarsclientpoint(winid,layx,layy1,0)
ControlClick,x%layx% y%layy1%,ahk_id %WinID%,,,,NA
}
else
{
relstarsclientpoint(winid,layx,layy,0)
ControlClick,x%layx% y%layy%,ahk_id %WinID%,,,,NA
}
Loop
{
WinWait, Options
Winactivate, Options
SetControlDelay, -1
ControlClick, Button13, Options,,,,NA
sleep 100
Send {down 5}
Send {Enter}
WinWaitClose, Options,,1
If (!ErrorLevel)	
	Break
}
}
return
;-----------------------------------------------------------------------------------------------------
Layout2:
layx:=0.5047
layy:=0.1880
layy1:=0.0940
WinGet, WinId, ID, ahk_class PokerStarsTableFrameClass 
if Winid
{
winactivate,ahk_id%winid%
if HyperSimpleTheme
{
relstarsclientpoint(winid,layx,layy1,0)
ControlClick,x%layx% y%layy1%,ahk_id %WinID%,,,,NA
}
else
{
relstarsclientpoint(winid,layx,layy,0)
ControlClick,x%layx% y%layy%,ahk_id %WinID%,,,,NA
}
Loop
{
WinWait, Options
Winactivate, Options
SetControlDelay, -1
ControlClick, Button13, Options,,,,NA
sleep 100
Send {down 6}
Send {Enter}
WinWaitClose, Options,,1
If (!ErrorLevel)	
	Break
}
}
return
;-----------------------------------------------------------------------------------------------------
Layout3:
layx:=0.5047
layy:=0.1880
layy1:=0.0940
WinGet, WinId, ID, ahk_class PokerStarsTableFrameClass 
if Winid
{
winactivate,ahk_id%winid%
if HyperSimpleTheme
{
relstarsclientpoint(winid,layx,layy1,0)
ControlClick,x%layx% y%layy1%,ahk_id %WinID%,,,,NA
}
else
{
relstarsclientpoint(winid,layx,layy,0)
ControlClick,x%layx% y%layy%,ahk_id %WinID%,,,,NA
}
Loop
{
WinWait, Options
Winactivate, Options
SetControlDelay, -1
ControlClick, Button13, Options,,,,NA
sleep 100
Send {down 7}
Send {Enter}
WinWaitClose, Options,,1
If (!ErrorLevel)	
	Break
}
}
return
;-----------------------------------------------------------------------------------------------------
Highlighter:
HighLighter(1)
return

HighLighter(Highlight=1) 
{
global last_table_id
global border_color
global border_size
global trans
;global ActiveX,ActiveY,ActiveW,ActiveH
global OldX,OldY,OldW,OldH
global highlighthero

foldx:=0.5575
foldx1:=0.5079
foldy:=0.9846
foldy1:=0.9846
v:=25

ifwinactive,ahk_class PokerStarsTableFrameClass
{  
 winget,id,id,A
 WinGetActiveStats,ActiveTitle, ActiveW, ActiveH, ActiveX, ActiveY
  relstarsclientpoint(id,foldx,foldy,0)
  pixelgetcolor,fold,foldx,foldy,ahk_id%id%
  relstarsclientpoint(id,foldx1,foldy1,0)
  pixelgetcolor,bacgr,foldx1,foldy1,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%
  global xbord
  global cap
  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)
  { 
   ;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 comparecolors(fold,bacgr,v)=1
 {
  Gui, 2: Cancel
  Gui, 3: Cancel
  Gui, 4: Cancel
  Gui, 5: Cancel
  last_table_id=
 }        
 }
 else
 if highlighthero 
 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.75, y_mouse=0.75)
{
if IsWindowNew()
{ 
wingetclass,class,A
wingetactivetitle,title
if class=PokerStarsTableFrameClass 
if instr(title,"Logged In") 
{
 winget,id,id,A
 relStarsClientPoint(id, x_mouse, y_mouse,0,1)
 DllCall("SetCursorPos", int, x_mouse, int, y_mouse)
}  
}
}
return
;-----------------------------------------------------------------------------------------------------
AlterAmount(id, dir="", frac=1, unit="")
{
 global stars_editbox
  WinGetTitle, title, ahk_id%id%
  amount := 0
  StringTrimRight, tablename, title, ( StrLen(title) - (InStr(title, " - ")-1) )
  IfWinExist, ahk_id%id% ahk_group StarsTables
  {
    If ((InStr(title, "No Limit") OR InStr(title, "Pot Limit")) AND InStr(title, "Tournament") = 0)
    {
      StringMid, bb, title, InStr(title, "/") + 1, InStr(title, a_space,"", InStr(title, "/")) - InStr(title, "/") - 1
    }
    else if (InStr(title, "No Limit") <> 0 AND InStr(title, "Tournament") <> 0)
    {
      StringMid, bb, title, InStr(title, "/", "", InStr(title, "Blinds")) + 1, InStr(title, a_space, "", InStr(title, "Blinds") + 8) - InStr(title, "/", "", InStr(title, "Blinds")) - 1 ;___so we retrieve the big blind instead
    }  
  }   
  StringReplace,bb,bb,$,,1
  StringReplace,bb,bb,Ј,,1
  StringReplace,bb,bb,Ђ,,1
  StringReplace,bb,bb,€,,1 

  bb++
  bb--
  sb := sb(bb)
  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 StarsTables
    {
      PotSizeStars(id, pot, call, sb, bb, hero_bet, street, hero_position, open)
    } 
    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 StarsTables
  {
    ControlGetText, t, %stars_editbox%, ahk_id%id%
    t := t + amount
    if (t < 0)
    {
      t := 0
    }
    t1 := Round(t, 2)
    t := Round(t, 3)
    if t-t1=0
    t:=t1
    ControlSetText, %stars_editbox%, %t%, ahk_id%id%
    Sleep, -1
    ;ControlGetText, t, %stars_editbox%, ahk_id%id%
    WinSet, Redraw,, ahk_id%id%
  } 
}

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

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

  IfWinExist, ahk_id%id% ahk_group StarsTables
  {
    PotSizeStars(id, pot, call, sb, bb, hero_bet, street, hero_position, open)
  } 

  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 StarsTables
  {
    ControlSetText, %stars_editbox%, %pot%, ahk_id%id%
    Sleep, -1
  }
}

PotSizeStars(id, ByRef pot, ByRef call, ByRef sb, ByRef bb, ByRef hero_bet, ByRef street, ByRef hero_position, ByRef open)
{
  global use_old_stars_buttons, stars_editbox , ClassicTheme , HyperSimpleTheme, SlickTheme
  CoordMode, Pixel, Screen

  if ClassicTheme 
  {
  PotThemeDir := "classic"
  CallThemeDir := "classic"
  pot_x1:=0.4400
  pot_x2:=0.5706
  pot_y1:=0.0140
  pot_y2:=0.0685
  call_x1:=0.7143
  call_y1:=0.9342
  call_y2:=0.9802
  call_x2:=0.7843
  raise_x1:=0.8727
  raise_y1:=0.9342
  raise_y2:=0.9802
  raise_x2:=0.9423
  }
  else 
  if HyperSimpleTheme
  {
  PotThemeDir := "hypersimple"
  CallThemeDir := "hypersimple"
  pot_x1:=0.4900
  pot_x2:=0.5706
  pot_y1:=0.0140
  pot_y2:=0.0885
  call_x1:=0.7143
  call_y1:=0.9342
  call_y2:=0.9802
  call_x2:=0.7843
  raise_x1:=0.8727
  raise_y1:=0.9342
  raise_y2:=0.9802
  raise_x2:=0.9423
  }
  else 
  if SlickTheme
  { 
  PotThemeDir := "slick"
  CallThemeDir := "slick"
  pot_x2:=0.5466
  pot_y2:=0.1645
  pot_x1:=0.4640
  pot_y1:=0.0895
  call_y2:=0.9802
  call_y1:=0.9342
  call_x2:=0.7454
  call_x1:=0.6754
  raise_x1:=0.8474
  raise_y1:=0.9342
  raise_y2:=0.9802
  raise_x2:=0.9304
  }
  else
  {
   return
  }
  if (use_old_stars_buttons)
  {
    CallThemeDir := CallThemeDir . "\old"
  }
  street := GetStreetStars(id)

  WinGetPos, x, y, w, h, ahk_id%id%
  if (w <= 526)
  {
    SizeDir := 0
  }
  else if (w <= 621)
  {
    SizeDir := 1
  }
  else if (w <= 736)
  {
    SizeDir := 2
  }
  else if (w <= 875)
  {
    SizeDir := 3
  }
  else if (w <= 1037)
  {
    SizeDir := 4
  }
  else if (w <= 1227)
  {
    SizeDir := 5
  }
  else
  {
    SizeDir := 6
  } 

  PicDir := "StarsPics"
  potPicDir := PicDir . "\" . PotThemeDir . "\pot\" . SizeDir
  buttonPicDir := PicDir . "\" . CallThemeDir . "\call\" . SizeDir

 winset,alwaysontop,on,ahk_id%id%
  relStarsclientPoint(id, pot_x1, pot_y1,0)
  relStarsclientPoint(id, pot_x2, pot_y2,0)
  loop 3
  {
  pot := DigitSearch(pot_x1, pot_y1, pot_x2, pot_y2, id, potPicDir, "", 50)
  if pot is number
  break
  sleep,10
  }
  relStarsclientPoint(id, call_x1, call_y1,0)
  relStarsclientPoint(id, call_x2, call_y2,0)
  loop 2
  {
  call := DigitSearch(call_x1, call_y1, call_x2, call_y2, id, buttonPicDir, "", 50)
  if call is number
  break
  sleep,10
  }
  call := iif( call, call, 0 )
  bb := GetBBStars(id, GameTypeStars(WinGetTitle(id)))
  sb := sb(bb) 
 winset,alwaysontop,off,ahk_id%id%
  if (street = "pre")
  {
    ControlGetText, t, %stars_editbox%, ahk_id%id%
    ControlSetText, %stars_editbox%, 0, ahk_id%id%
  relStarsclientPoint(id, raise_x1, raise_y1,0)
  relStarsclientPoint(id, raise_x2, raise_y2,0)
 winset,alwaysontop,on,ahk_id%id%
  loop 3
  {
    minraise := DigitSearch(raise_x1, raise_y1, raise_x2, raise_y2, id, buttonPicDir, "", 50)
  if minraise is number
  break
  sleep,10
  }
 winset,alwaysontop,off,ahk_id%id%
    t := Round(t, 2)
    ControlSetText, %stars_editbox%, %t%, ahk_id%id%
    Sleep, -1
    
    if (minraise > (2*bb))
    {
      ;pot has been raised
      if (call = bb)
      {
        ;pot was minraised, and we are the BB
        hero_bet := bb
        hero_position := "bb"
      }
      else if (call < (bb*2))
      {
        ;pot was minraised, and we are the SB
        hero_bet := sb
        hero_position := "sb"
      }
    }
    else if (call = bb)
    {
      ;hero is not a blind, unraised pot, do nothing
    }
    else if (call = 0)
    {
      ;unraised pot, hero is the BB
      hero_bet := bb
      hero_position := "bb"
    }
    else if (call < bb)
    {
      ;unraised pot, hero is the SB
      hero_bet := sb
      hero_position := "sb"

    }
    else
    {
      ;pot has been raised, we are not opening
      open := 0
    }
  }
  else
  {
    ;not pre-flop, no need for open adjustment
    open := 0
  } 
  return
}

DigitSearch(startX,startY,endX,endY,win,dir,ex="",shades=1) {
If ex =
 ex = bmp
batchlines = %A_BatchLines%
SetBatchLines -1
WinGetPos,Xwin,Ywin,,,ahk_id%win%
CoordMode, Pixel, Screen
Loop, 11 {
  i = %a_index%
  If i = 10
    i = 0
  else if i = 11
    i = -1
  lastXpos := startX + Xwin
  Loop { 
    x1 := lastXpos + 1
    y1 := startY + Ywin
    x2 :=  endX + Xwin
    y2 := endY + Ywin    
    ImageSearch, lastXpos,, x1, y1, x2, y2, *%shades% %dir%\%i%.%ex%   
    If ( errorLevel )
    {
      break
    }
    p++
    p%p% = %lastXpos%
    If i = -1
      t = .
    else
      t = %i%
    StringReplace, xpos, lastXpos, -, _
    c%xpos% = %t%
   }
 }
Loop, %p%
 p_all := p_all "," p%a_index%
Sort, p_all, N D, U
Loop, Parse, p_all, `,
{
 StringReplace, xpos, a_loopfield, -, _
    
 amount := amount "" c%xpos%
} 
CoordMode, Pixel, Relative
SetBatchLines %batchlines%
return amount
}

; 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
}

GetBBStars(id, game_type) {
WinGetTitle, title, ahk_id%id% 
  StringReplace,title,title,€,,1 
  StringReplace,title,title,Ђ,,1 
  StringReplace,title,title,Ј,,1
If (game_type = "NL Ring")
 return StrRep(StrMid(title,"/",a_space), "$")
else if (game_type = "NL Tourney")
 return StrRep(StrMid(title,"/",a_space,InStr(title," - Blinds")),"$")
}

GameTypeStars(title) {
If InStr(title, " - Limit Stud")
 return "Stud"
else if ((InStr(title, "NL Hold'em") || InStr(title, " - Pot Limit Hold'em") || InStr(title, " - No Limit Hold'em") || InStr(title, "PL Hold'em"))
  && InStr(title, "Tournament"))
 return "NL Tourney"
else if (InStr(title, " - No Limit Hold'em") || InStr(title, " - Pot Limit Hold'em"))
 return "NL Ring"
else
 return "Limit"
}

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
}

GetStreetStars(id)
{
  global debug
  CoordMode, Pixel, Screen
  street := "pre" 
  x1 := 0.6168
  y1 := 0.3315
  x2 := 0.6660
  y2 := 0.3811
  relStarsClientPoint(id, x1, y1,0,1)
  relStarsClientPoint(id, x2, y2,0,1)

  If ( GetPixelCount(x1, y1, x2, y2, 0xffffff) > 10 )
  {
    street := "river"
    return street
  }  
  x1 := 0.5394
  y1 := 0.3315
  x2 := 0.5887
  y2 := 0.3811
  relStarsClientPoint(id, x1, y1,0,1)
  relStarsClientPoint(id, x2, y2,0,1)

  If ( GetPixelCount(x1, y1, x2, y2, 0xffffff) > 10 )
  {
    street := "turn"
    return street
  }
  x1 := 0.3373
  y1 := 0.3315
  x2 := 0.3867
  y2 := 0.3811
  relStarsClientPoint(id, x1, y1,0,1)
  relStarsClientPoint(id, x2, y2,0,1)

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

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
}

WinGetTitle(win) {
WinGetTitle, title, ahk_id%win%
return title
}

FoldStars(id)
{
  PostClickStars(0.59,0.9241,id)
 ; Sleep, 20
 ; PostStarsClickpot(416,478,id)
}
CallStars(id)
{
  PostClickStars(0.7462,0.9241,id)
}
RaiseStars(id)
{
  PostClickStars(0.8860,0.9241,id)
}
Fold2anyStars(id)
{
  PostClickStars(0.0158,0.6467,id)
}


fold:
If ActOnActiveTable
WinGet, Id, ID, A
else
MousegetPos,,,ID
wingetclass,class,ahk_id%id%
if class=PokerStarsTableFrameClass
{
 if suspendforchat
 {
 ; If ActOnActiveTable
  if IsMouseInChat(id)
  {
   ControlGetFocus, ctrl, ahk_id%id%
   ControlSend,%ctrl% , %fold%, ahk_id%id%
  }
  else
  FoldStars(id)
 }
 else
 FoldStars(id)
}
else
{
ControlGetFocus,ctrl,ahk_id%id%
ControlSend,%ctrl%,%fold%,ahk_id%id%
}
return



call:
If ActOnActiveTable
WinGet, Id, ID, A
else
MousegetPos,,,ID
wingetclass,class,ahk_id%id%
if class=PokerStarsTableFrameClass
{
 if suspendforchat
 {
 ; If ActOnActiveTable
  if IsMouseInChat(id)
  {
   ControlGetFocus, ctrl, ahk_id%id%
   ControlSend,%ctrl% , %call%, ahk_id%id%
  }
  else
  callStars(id)
 }
 else
 callStars(id)
}
else
{
ControlGetFocus,ctrl,ahk_id%id%
ControlSend,%ctrl%,%call%,ahk_id%id%
}
return

raise:
If ActOnActiveTable
WinGet, Id, ID, A
else
MousegetPos,,,ID
wingetclass,class,ahk_id%id%
if class=PokerStarsTableFrameClass
{
 if suspendforchat
 {
 ; If ActOnActiveTable
  if IsMouseInChat(id)
  {
   ControlGetFocus, ctrl, ahk_id%id%
   ControlSend,%ctrl% , %raise%, ahk_id%id%
  }
  else
  raiseStars(id)
 }
 else
 raiseStars(id)
}
else
{
ControlGetFocus,ctrl,ahk_id%id%
ControlSend,%ctrl%,%raise%,ahk_id%id%
}
return

fold2any:
If ActOnActiveTable
WinGet, Id, ID, A
else
MousegetPos,,,ID
wingetclass,class,ahk_id%id%
if class=PokerStarsTableFrameClass
{
 if suspendforchat
 {
 ; If ActOnActiveTable
  if IsMouseInChat(id)
  {
   ControlGetFocus, ctrl, ahk_id%id%
   ControlSend,%ctrl% , %fold2any%, ahk_id%id%
  }
  else
  fold2anyStars(id)
 }
 else
 fold2anyStars(id)
}
else
{
ControlGetFocus,ctrl,ahk_id%id%
ControlSend,%ctrl%,%fold2any%,ahk_id%id%
}
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
raisestars(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
raisestars(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
raisestars(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, StarsTables, ahk_class PokerStarsTableFrameClass ,,, PokerStars Lobby
if autopot
{
isbetboxnew()
}
return
;-----------------------------------------------------------------------------------------------------
BuildGui:
Gui, color, white
;Gui, font, cOlive
Gui, add, tab, h450 w270, General|Time|Annoyances|Table moving|BetPot|Table hotkeys|Global hotkeys
Gui, Tab, General
Gui, Add, Radio, x26 y50 w180 h20 Checked%ClassicTheme% vClassicTheme, Classic Theme
Gui, Add, Radio, x26 y70 w180 h20 Checked%HyperSimpleTheme% vHyperSimpleTheme, HyperSimple Theme
Gui, Add, Radio, x26 y90 w180 h20 Checked%BlackTheme% vBlackTheme, Black Theme
Gui, Add, Radio, x26 y110 w180 h20 Checked%SlickTheme% vSlickTheme, Slick Theme
Gui, add, text, y145 x25, Highlight table
Gui, add, Checkbox, y145 x100 Checked%Highlight% VHighlight
Gui, Add, Radio, x126 y140 w120 h15 Checked%highlightactive% vhighlightactive, Active
Gui, Add, Radio, x126 y155 w120 h15 Checked%highlighthero% vhighlighthero, With action on hero
Gui, add, text, y185 x25, Move mouse to action buttons
Gui, add, Checkbox, y185 x220 Checked%MoveMouse% VMoveMouse
Gui, add, text, y205 x65, Move mouse from nonstars app
Gui, add, Checkbox, y205 x220 Checked%stealfocus% Vstealfocus
Gui, add, text, y235 x25, Suspend hotkey for chat/notes area
Gui, add, Checkbox, y235 x220 Checked%suspendforchat% Vsuspendforchat
Gui, Add, Radio, x26 y280 w220 h15 Checked%ActOnActiveTable% vActOnActiveTable, Send actions to active table
Gui, Add, Radio, x26 y295 w220 h15 Checked%sendundermouse% vsendundermouse, Send actions to table under mouse
Gui, add, text, y325 x25, Activate table under mouse
Gui, add, Checkbox, y325 x220 Checked%activatetableundermouse% Vactivatetableundermouse


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

Gui, Tab, Global hotkeys

Gui, Add, Text, x25 y105 ,Find table needing action
Gui, Add, Edit, x220 y102 w50 h20 vfindtabletoact, %findtabletoact%
Gui, Add, Text, x25 y125 ,Activate next table
Gui, Add, Edit, x220 y122 w50 h20 vActivateBottomWindow, %ActivateBottomWindow%
Gui, Add, Text, x25 y155 ,Close all tables with hero not in a hand
Gui, Add, Edit, x220 y152 w50 h20 vCloseAllWithNoAction, %CloseAllWithNoAction%
Gui, Add, Text, x25 y55 ,Suspend all hotkeys
Gui, Add, Edit, x220 y52 w50 h20 vsuspend, %suspend%
Gui, Add, Text, x25 y75 ,Pause/unpause
Gui, Add, Edit, x220 y72 w50 h20 vTogglePause, %TogglePause%
Gui, Add, Text, x25 y185 ,Cashier
Gui, Add, Edit, x220 y182 w50 h20 vCashier, %Cashier%
Gui, Add, Text, x25 y225 ,Custom layout 1
Gui, Add, Edit, x220 y222 w50 h20 vlayout1, %layout1%
Gui, Add, Text, x25 y245 ,Custom layout 2
Gui, Add, Edit, x220 y242 w50 h20 vlayout2, %layout2%
Gui, Add, Text, x25 y265 ,Custom layout 3
Gui, Add, Edit, x220 y262 w50 h20 vlayout3, %layout3%


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

Gui, Tab, Table moving
Gui, add, text, y55 x25, Move new table
Gui, add, Checkbox, y55 x120 Checked%move% Vmove
Gui, add, text, y75 x35, to position
Gui, Add, Text, x25 y95 w120 h20 , x
Gui, Add, Edit, x50 y95 w50 h20 vxpos, %xpos%
Gui, Add, Text, x25 y115 ,y
Gui, Add, Edit, x50 y115 w50 h20 vypos, %ypos%
Gui, add, Checkbox, y145 x180 Checked%automoveback% Vautomoveback
Gui, add, text, y145 x25,Move table back automatically
Gui, Add, Text, x25 y165 ,Move table back manually
Gui, Add, Edit, x180 y162 w50 h20 vmovebackByKey, %movebackByKey%

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

Gui, Tab, Annoyances

Gui, add, Checkbox, y55 x190 Checked%Autopost% VAutopost
Gui, add, text, y55 x25,Auto post blinds
Gui, add, Checkbox, y75 x190 Checked%Waitbb% VWaitbb
Gui, add, text, y75 x25,Uncheck wait for big blind
Gui, add, Checkbox, y100 x190 Checked%CheckWhenFree% VCheckWhenFree
Gui, add, text, y100 x25,Never fold for free
Gui, add, Checkbox, y120 x250 Checked%closeOKwindow% VcloseOKwindow
Gui, add, text, y120 x25,Close PokerStars windows with just OK button
Gui, add, Checkbox, y160 x90 Checked%Buyin% VBuyin
Gui, add, text, y160 x25,Auto Buy-in
Gui, Add, Radio, x120 y150 w100 h20 Checked%max% vmax, Maximum
Gui, Add, Radio, x120 y170 w120 h20 Checked%remembered% vremembered, Remembered/default
Gui, Add, Radio, x120 y190 w20 h20 Checked%xbb% vxbb
Gui, Add, Edit, x140 y190 w30 h20 vbbmultiplier, %bbmultiplier%
Gui, Add, Text, x170 y193,BB
Gui, add, Checkbox, y220 x190 Checked%TakeSeat% VTakeSeat
Gui, add, text, y220 x25,Auto Take Seat (from waiting list)
Gui, add, Checkbox, y240 x190 Checked%AutoReservedSeat% VAutoReservedSeat
Gui, add, text, y240 x55,Auto take reserved seat
Gui, add, Checkbox, y265 x190 Checked%autoTakeSeat% VautoTakeSeat
Gui, add, text, y265 x25,Auto Seat on new table
Gui, add, Checkbox, y290 x190 Checked%leavetable% Vleavetable
Gui, add, text, y290 x25,Auto leaving table confirmation


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

Gui, Tab, Time

Gui, add, Checkbox, y50 x180 Checked%ClickImBack% VClickImBack
Gui, add, text, y50 x25,Click Im Back automatically
Gui, Add, Text, x25 y70 ,Toggle Click Im Back
Gui, Add, Edit, x180 y67 w50 h20 vToggleImBack, %ToggleImBack%
Gui, add, Checkbox, y110 x180 Checked%Timebank% VTimebank
Gui, add, text, y110 x25,Click Timebank automatically
Gui, Add, Text, x25 y150 ,Sitout on all tables
Gui, Add, Edit, x180 y147 w50 h20 vSitOutNextAll, %SitOutNextAll%
Gui, Add, Text, x25 y175 ,Remove sitout on all tables
Gui, Add, Edit, x180 y172 w50 h20 vRemoveSitout, %RemoveSitout%

Gui, Add, Text, x25 y220 ,Join waiting list on all tables
Gui, Add, Edit, x180 y217 w50 h20 vjoinwaitlist, %joinwaitlist%
Gui, Add, Text, x25 y245 ,Unjoin waiting list on all tables
Gui, Add, Edit, x180 y242 w50 h20 vunjoinwaitlist, %unjoinwaitlist%

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, %ddlist%
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, %ddlist%
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, %ddlist%
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, %ddlist%
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 w50 h15 Checked%bb1% vbb1,bb
Gui, Add, Radio, x125 y295 w50 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 w50 h15 Checked%bb2% vbb2,bb
Gui, Add, Radio, x125 y325 w50 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 w50 h15 Checked%bb3% vbb3,bb
Gui, Add, Radio, x125 y355 w50 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 w50 h15 Checked%bb4% vbb4,bb
Gui, Add, Radio, x125 y385 w50 h15 Checked%sb4% vsb4,sb
Gui, Add, Edit, x190 y372 w80 h20 valt4, %alt4%

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

Gui, Add, Button, x75 y420 w55 h20 gSave,Submit
Gui, Add, Button, x135 y420 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

gosub,getini
Gui, show, w286, %thisahk%
Return
;-----------------------------------------------------------------------------------------------------
GetIni:
IfNotExist, %thisahk%.ini
gosub, CreateIni
IniRead, ClassicTheme,%thisahk%.ini, Options, ClassicTheme,0
IniRead, HyperSimpleTheme,%thisahk%.ini, Options, HyperSimpleTheme,0
IniRead, SlickTheme,%thisahk%.ini, Options, SlickTheme,0
IniRead, BlackTheme,%thisahk%.ini, Options, BlackTheme,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, suspendforchat, %thisahk%.ini, Settings, suspendforchat, 0
IniRead, ActOnActiveTable, %thisahk%.ini, Options, ActOnActiveTable, 0
IniRead, sendundermouse, %thisahk%.ini, Options, sendundermouse, 0
IniRead, activatetableundermouse, %thisahk%.ini, Settings, activatetableundermouse, 0
IniRead, ActivateBottomWindow, %thisahk%.ini, Hotkeys, ActivateBottomWindow,%A_Space%
if ActivateBottomWindow
Hotkey, %ActivateBottomWindow%,ActivateBottomWindow
IniRead, findtabletoact, %thisahk%.ini, Hotkeys, findtabletoact,%A_Space%
if findtabletoact
Hotkey, %findtabletoact%,findtabletoact
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, CloseAllWithNoAction, %thisahk%.ini, Hotkeys, CloseAllWithNoAction,%A_Space%
if CloseAllWithNoAction
Hotkey, %CloseAllWithNoAction%,CloseAllWithNoAction
IniRead, Cashier, %thisahk%.ini, Hotkeys, Cashier,%A_Space%
if Cashier
Hotkey, %Cashier%,Cashier
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, ClickImBack, %thisahk%.ini, Settings, ClickImBack, 0
IniRead, Toggleimback, %thisahk%.ini, Hotkeys, Toggleimback,%A_Space%
IniRead, TakeSeat, %thisahk%.ini, Settings, TakeSeat, 0
IniRead, autoTakeSeat, %thisahk%.ini, Settings, autoTakeSeat, 0
IniRead, AutoReservedSeat, %thisahk%.ini, Settings, AutoReservedSeat, 0
IniRead, Timebank, %thisahk%.ini, Settings, Timebank, 0
IniRead, Autopost, %thisahk%.ini, Settings, Autopost, 0 
IniRead, Waitbb, %thisahk%.ini, Settings, Waitbb, 0
IniRead, CheckWhenFree, %thisahk%.ini, Settings, CheckWhenFree, 0
IniRead, checkbb, %thisahk%.ini, Settings, checkbb, 0
IniRead, uncheckbb, %thisahk%.ini, Settings, uncheckbb, 0
IniRead, closeOKwindow, %thisahk%.ini, Settings, closeOKwindow, 0
IniRead, Buyin, %thisahk%.ini, Settings, Buyin, 0
IniRead, max, %thisahk%.ini, Settings, max, 0
IniRead, remembered, %thisahk%.ini, Settings, remembered, 0
IniRead, xbb, %thisahk%.ini, Settings, xbb, 0
IniRead, bbmultiplier, %thisahk%.ini, Variables, bbmultiplier,0
IniRead, SitOutNextAll, %thisahk%.ini, Hotkeys, SitOutNextAll,%A_Space%
IniRead, RemoveSitout, %thisahk%.ini, Hotkeys, RemoveSitout,%A_Space%
IniRead, joinwaitlist, %thisahk%.ini, Hotkeys, joinwaitlist,%A_Space%
IniRead, unjoinwaitlist, %thisahk%.ini, Hotkeys, unjoinwaitlist,%A_Space%

if SitOutNextAll
Hotkey, %SitOutNextAll%,SitOutNextAll
if RemoveSitout
Hotkey, %RemoveSitout%,RemoveSitout
if joinwaitlist
Hotkey, %joinwaitlist%,joinwaitlist
if Unjoinwaitlist
Hotkey, %Unjoinwaitlist%,Unjoinwaitlist
If Toggleimback
{
HotKey, IfWinActive
Hotkey, %Toggleimback%, Toggleimback
}
IniRead, leavetable, %thisahk%.ini, Settings, leavetable,0
IniRead, move, %thisahk%.ini, Settings, move, 0
IniRead, automoveback, %thisahk%.ini, Settings, automoveback, 0
IniRead, movebackByKey, %thisahk%.ini, Hotkeys, movebackByKey,%A_Space%
IniRead, ypos, %thisahk%.ini, Variables, ypos,0
IniRead, xpos, %thisahk%.ini, Variables, xpos,0
if MoveBackByKey
Hotkey, %MoveBackByKey%,MoveBackByKey

IniRead, OpenDef, %thisahk%.ini, BetPotSettings, OpenDef
StringReplace, ddlist, ddlist, %OpenDef%, %OpenDef%|
GuiControl, , OpenDef, |%ddlist%
StringReplace, ddlist, ddlist, %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, ddlist, ddlist, %Open1%, %Open1%|
GuiControl, , Open1, |%ddlist%
StringReplace, ddlist, ddlist, %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 PokerStarsTableFrameClass
Hotkey, %pot1%,pot1
}
IniRead, Open2, %thisahk%.ini, BetPotSettings, Open2
StringReplace, ddlist, ddlist, %Open2%, %Open2%|
GuiControl, , Open2, |%ddlist%
StringReplace, ddlist, ddlist, %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 PokerStarsTableFrameClass
Hotkey, %pot2%,pot2
}
IniRead, Open3, %thisahk%.ini, BetPotSettings, Open3
StringReplace, ddlist, ddlist, %Open3%, %Open3%|
GuiControl, , Open3, |%ddlist%
StringReplace, ddlist, ddlist, %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 PokerStarsTableFrameClass
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 PokerStarsTableFrameClass
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 PokerStarsTableFrameClass
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 PokerStarsTableFrameClass
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 PokerStarsTableFrameClass
Hotkey, %alt4%,alt4
}

IniRead, autopot, %thisahk%.ini, BetPotSettings, autopot, 0
IniRead, autobet, %thisahk%.ini, BetPotSettings, autobet, 0

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 PokerStarsTableFrameClass
HotKey, IfWinActive
Hotkey, %fold%,fold
}
if call
{
;HotKey, IfWinActive, ahk_class PokerStarsTableFrameClass
HotKey, IfWinActive
Hotkey, %call%,call
}
if raise
{
;HotKey, IfWinActive, ahk_class PokerStarsTableFrameClass
HotKey, IfWinActive
Hotkey, %raise%,raise
}
if fold2any
{
;HotKey, IfWinActive, ahk_class PokerStarsTableFrameClass
HotKey, IfWinActive
Hotkey, %fold2any%,fold2any
}
Return
;-----------------------------------------------------------------------------------------------------
MakeIni:
If ClassicTheme
IniWrite, %ClassicTheme%, %thisahk%.ini, Options, ClassicTheme
If HyperSimpleTheme
IniWrite, %HyperSimpleTheme%, %thisahk%.ini, Options, HyperSimpleTheme
If SlickTheme
IniWrite, %SlickTheme%, %thisahk%.ini, Options, SlickTheme 
If BlackTheme
IniWrite, %BlackTheme%, %thisahk%.ini, Options, BlackTheme
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, %suspendforchat%, %thisahk%.ini, Settings, suspendforchat
if ActOnActiveTable
IniWrite, %ActOnActiveTable%, %thisahk%.ini, Options, ActOnActiveTable
if sendundermouse
IniWrite, %sendundermouse%, %thisahk%.ini, Options, sendundermouse
IniWrite, %activatetableundermouse%, %thisahk%.ini, Settings, activatetableundermouse
if ActivateBottomWindow
IniWrite, %ActivateBottomWindow%, %thisahk%.ini, Hotkeys, ActivateBottomWindow
if findtabletoact
IniWrite, %findtabletoact%, %thisahk%.ini, Hotkeys, findtabletoact
if suspend
IniWrite, %suspend%, %thisahk%.ini, Hotkeys, suspend
if TogglePause
IniWrite, %TogglePause%, %thisahk%.ini, Hotkeys, TogglePause
if CloseAllWithNoAction
IniWrite, %CloseAllWithNoAction%, %thisahk%.ini, Hotkeys, CloseAllWithNoAction
if Cashier
IniWrite, %Cashier%, %thisahk%.ini, Hotkeys, Cashier
if layout1
IniWrite, %layout1%, %thisahk%.ini, Hotkeys, layout1
if layout2
IniWrite, %layout2%, %thisahk%.ini, Hotkeys, layout2
if layout3
IniWrite, %layout3%, %thisahk%.ini, Hotkeys, layout3
IniWrite, %ClickImBack%, %thisahk%.ini, Settings, ClickImBack
IniWrite, %TakeSeat%, %thisahk%.ini, Settings, TakeSeat
IniWrite, %autoTakeSeat%, %thisahk%.ini, Settings, autoTakeSeat
IniWrite, %AutoReservedSeat%, %thisahk%.ini, Settings, AutoReservedSeat
IniWrite, %Timebank%, %thisahk%.ini, Settings, Timebank
IniWrite, %Autopost%, %thisahk%.ini, Settings, Autopost
IniWrite, %Waitbb%, %thisahk%.ini, Settings, Waitbb
IniWrite, %closeOKwindow%, %thisahk%.ini, Settings, closeOKwindow
IniWrite, %CheckWhenFree%, %thisahk%.ini, Settings, CheckWhenFree
IniWrite, %Buyin%, %thisahk%.ini, Settings, Buyin
if max
IniWrite, %max%, %thisahk%.ini, Settings, max
if remembered
IniWrite, %remembered%, %thisahk%.ini, Settings, remembered
if xbb
IniWrite, %xbb%, %thisahk%.ini, Settings, xbb
IniWrite, %bbmultiplier%, %thisahk%.ini, Variables, bbmultiplier
if SitOutNextAll
IniWrite, %SitOutNextAll%, %thisahk%.ini, Hotkeys, SitOutNextAll
if RemoveSitout
IniWrite, %RemoveSitout%, %thisahk%.ini, Hotkeys, RemoveSitout
if joinwaitlist
IniWrite, %joinwaitlist%, %thisahk%.ini, Hotkeys, joinwaitlist
if Unjoinwaitlist
IniWrite, %unjoinwaitlist%, %thisahk%.ini, Hotkeys, unjoinwaitlist
if Toggleimback
IniWrite, %Toggleimback%, %thisahk%.ini, Hotkeys, Toggleimback 
IniWrite, %leavetable%, %thisahk%.ini, Settings, leavetable
IniWrite, %move%, %thisahk%.ini, Settings, move
IniWrite, %automoveback%, %thisahk%.ini, Settings, automoveback
if moveback
IniWrite, %moveback%, %thisahk%.ini, Hotkeys, moveback
if MoveBackByKey
IniWrite, %MoveBackByKey%, %thisahk%.ini, Hotkeys, MoveBackByKey
IniWrite, %ypos%, %thisahk%.ini, Variables, ypos
IniWrite, %xpos%, %thisahk%.ini, Variables, xpos

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

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
Return
;-----------------------------------------------------------------------------------------------------
CreateIni:
HyperSimpleTheme:=1
ClassicTheme:=0
SlickTheme:=0
BlackTheme:=0
Highlight:=0
highlightactive:=1
highlighthero:=0
MoveMouse:=0
stealfocus:=1
ActOnActiveTable:=1
sendundermouse:=0
activatetableundermouse:=0
suspendforchat:=0
TakeSeat:=0
autoTakeSeat:=0
AutoReservedSeat:=0
Timebank:=0
Autopost:=0
Waitbb:=0
closeOKwindow:=1
CheckWhenFree:=1
Buyin:=0
remembered:=1
bbmultiplier:=50
ClickImBack:=0
leavetable:=0
move:=0
automoveback:=0
xpos:=100
ypos:=100
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
bb2:=1
sb3:=1
sb4:=1
alt1=wheelup
alt2=wheeldown
alt3=^wheelup
alt4=^wheeldown
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
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
return
;-----------------------------------------------------------------------------------------------------
Edit:
edit
return
;-----------------------------------------------------------------------------------------------------
donation:
WinMenuSelectItem, PokerStars Lobby,, Requests, Transfer Funds...
WinWait, Transfer Funds ahk_class #32770, , 10
WinGet, tf, id
ControlFocus, Edit2, ahk_id%tf%
ControlSetText, Edit2, Max1mums
ControlFocus, Edit1, ahk_id%tf%
Sleep, -1
ControlSetText, Edit1,
GuiControl, Disable, Donate
return
;-----------------------------------------------------------------------------------------------------
exitSub:
;FileDelete, %thisahk%.ini
;gosub, makeini
exitApp
return
;-----------------------------------------------------------------------------------------------------
StarsPics (needed for BetPot function only) can be found here: http://depositfiles.com/en/files/cgcmiearw
Don't forget to choose correct table theme on General tab.

Last edited by Max1mums; 01-09-2010 at 11:19 PM.
Max1mums is offline   Reply With Quote
Old 01-10-2010, 04:26 AM   #116
george999
stranger
 
Join Date: Apr 2009
Posts: 14
Re: StarsCash - free script for PokerStars containing all functions cash player may need.

Max1mums,
Lag increase with passing time.After 15-20 min. I hear the sound but the action table is bringed to front after almost a second, and when many tables needs atention is very annoying .I used tableninja with 24 tables without any problem on my core2duo laptop with 2 gb of ram; maybe on faster computers this problem do not apear...
Too bad it's not working for me because you made a wonderful tool.
george999 is offline   Reply With Quote
Old 01-10-2010, 09:00 AM   #117
Max1mums
old hand
 
Join Date: Aug 2009
Location: From Russia with code
Posts: 1,672
Re: StarsCash - free script for PokerStars containing all functions cash player may need.

Can anybody else confirm lag problem with latest version?
Max1mums is offline   Reply With Quote
Old 01-10-2010, 11:55 AM   #118
NathanFSu
centurion
 
Join Date: Feb 2007
Posts: 147
Re: StarsCash - free script for PokerStars containing all functions cash player may need.

No lag for me, Betpot is working as well with starpics

Thank You
NathanFSu is offline   Reply With Quote
Old 01-10-2010, 01:11 PM   #119
xPeru
Pooh-Bah
 
xPeru's Avatar
 
Join Date: Sep 2006
Location: SNE @ life; home in Peru
Posts: 4,186
Re: StarsCash - free script for PokerStars containing all functions cash player may need.

I still have the lag with the latest version. It starts fine, then gets worse with time. It is associated with putting the wrong bets in the betbox - sometimes 0, sometimes strange numbers eg at 5c/10c 6 max, open raising 75c with betpot set to 100%, or $2.60, or $13.55.

I am using Windows XP Pro. Using Pokerstars Classic theme with no images, which works exactly the same for me as the slick theme - as in I have exactly the same problems with slick theme/ and hypersimple.

When it gets so laggy it's locking up tables, the problem cured itself as soon as I exited starscash, and did not reappear when I immediately opened a standalone version of betpot.

It maybe that really fast pcs don't notice, but I'm running a pentium 1.6ghz laptop at the moment and it's very apparent.
xPeru is offline   Reply With Quote
Old 01-10-2010, 01:18 PM   #120
Max1mums
old hand
 
Join Date: Aug 2009
Location: From Russia with code
Posts: 1,672
Re: StarsCash - free script for PokerStars containing all functions cash player may need.

I'll try to clean code a bit more but you can just reload script with menu reload option as soon as you mention lags starting for now...
Athlon 64 3000mhz for me, can't call it a really fast cpu.

I need more reports, please guys post here if you experience any problems with script.

Last edited by Max1mums; 01-10-2010 at 01:25 PM.
Max1mums is offline   Reply With Quote
Old 01-10-2010, 01:50 PM   #121
NathanFSu
centurion
 
Join Date: Feb 2007
Posts: 147
Re: StarsCash - free script for PokerStars containing all functions cash player may need.

One problem for me is that it opens the option window when it tries to take a new seat
NathanFSu is offline   Reply With Quote
Old 01-10-2010, 03:27 PM   #122
Max1mums
old hand
 
Join Date: Aug 2009
Location: From Russia with code
Posts: 1,672
Re: StarsCash - free script for PokerStars containing all functions cash player may need.

Don't know how that is possible, do you have classic theme chosen in options? Try unbinding layout hotkeys, options window could be opened by them.
Max1mums is offline   Reply With Quote
Old 01-10-2010, 03:39 PM   #123
NathanFSu
centurion
 
Join Date: Feb 2007
Posts: 147
Re: StarsCash - free script for PokerStars containing all functions cash player may need.

Quote:
Originally Posted by Max1mums View Post
Don't know how that is possible, do you have classic theme chosen in options? Try unbinding layout hotkeys, options window could be opened by them.
I'm using classic theme, The problem just happens on waiting tables or/and with small tables ...

What do you mean by unbinding layout hotkeys ?
Right-Click table to show table theme is unchecked

Last edited by NathanFSu; 01-10-2010 at 03:55 PM.
NathanFSu is offline   Reply With Quote
Old 01-10-2010, 04:41 PM   #124
Max1mums
old hand
 
Join Date: Aug 2009
Location: From Russia with code
Posts: 1,672
Re: StarsCash - free script for PokerStars containing all functions cash player may need.

I've been checking version 1.33 for 1.5 hours in a row with 12 nl tables and all options turned on, haven't noticed any lag at all, neither cpu/memory load have grown. Anyway here is new version, all variables have been made local if possible, added option to choose number of attempts to take pot/call amount from screen: 1 is fastest of course, increasing number may solve getting 0 in betbox problem.

StarsCash v1.35
Code:
; #### StarsCash ####

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


#SingleInstance, Force
#NoEnv
#MaxHotkeysPerInterval 500|
Settitlematchmode, 2
OnExit exitSub

debug:=0

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, Donate, Donation
Menu, Tray, Add, Exit, ExitSub

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

SetBatchLines,1ms
SetWinDelay,-1
SendMode Input

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

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

boost:=false

;betpot stuff
stars_editbox = PokerStarsSliderEditorClass1
ddlist=
ddlist.="ssnl" . "|"
ddlist.="trny" . "|"
ddlist.="mix" . "|"
ddlist.="----" . "|"

gosub,getini

Gui 11:Show, w1 1 x1 y1, PokerWindow
WinGet,PokerWindowID, id, PokerWindow
Gui 11:Show,hide, w1 h1 x1 y1, PokerWindow

Init()

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

settimer,HeroSeated,1103
settimer,Popupwatcher,139
if CheckWhenFree
settimer,FreeCheck,77
if ClickImBack
settimer,ClickBack,2033
if Timebank
settimer,ClickTimebank,1555
settimer,BetPot,37
settimer,clickwithdelay,93
settimer,NewTable,67
if Highlight
settimer,Highlighter,70
if activatetableundermouse
settimer,activateundermouse,133
if MoveMouse
settimer,MouseMove,119
if leavetable
settimer,closetable,249

return
;-----------------------------------------------------------------------------------------------------
Init()
{
local list,winid
winget,list,list,Logged In ahk_class PokerStarsTableFrameClass
loop %list%
{
 id:=list%A_index%
 if seated%id% is not number
 {
 loop %list%
  {
   id:=list%A_index%
   seated%id%:=2
  }
 break
 }
}
}
return
;-----------------------------------------------------------------------------------------------------
NewTable:
IsTableNew()
return

IsTableNew()
{
local list,id
winget,list,list,ahk_class PokerStarsTableFrameClass
loop %list%
{
 id:=list%A_index%
 if seated%id% is not number
 {
  wingetpos,xstart%id%,ystart%id%,,,ahk_id%id%
  if move
  WinMove, ahk_id%id%,, xpos,ypos
  if autotakeseat
  {
   if !InStr(tablequeue,id)
   movetolist(id,A_TickCount)
  }
 seated%id%:=1
 }
}
}
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=PokerStarsTableFrameClass
  return 1
  else
  return 0
 }
}
else
return 0
}
;-----------------------------------------------------------------------------------------------------
IsBetBoxNew()
{
global oldid,PotDefPre,PotDefFlop,PotDefTurn,PotDefRiver,RoundDef,OpenDef,FixDef
winget winid,id,A
if (winid<>oldid)
{
 ControlGet, Z, Visible,,PokerStarsSliderClass1, ahk_id %winid%
 if Z
 {
  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
{
 ControlGet, Z, Visible,,PokerStarsSliderClass1, ahk_id %winid%
 if !Z
 oldid=
}
}
return
;-----------------------------------------------------------------------------------------------------
IsMouseInChat(id)
{
wingetpos,,,w,h,ahk_id%id%
coordmode,mouse,relative
mousegetpos,x1,y1
mousex:=0.5000
mousey:=0.7477
relstarsclientpoint(id,mousex,mousey,0)
if ((x1<mousex) and (y1>mousey)) & ((x1>0) & (y1>0) & (y1<h) & (x1<w))
return 1
else
return 0
}
;-----------------------------------------------------------------------------------------------------
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
;-----------------------------------------------------------------------------------------------------
clickwithdelay:
clickdelay()
return
;-----------------------------------------------------------------------------------------------------
clickdelay()
{
global tablequeue
Loop, Parse, tablequeue, `,
{
stringsplit,tab,A_loopfield,-
if abs(tab2-A_TickCount)>500
{
ClickSeats(tab1)
listDelItem(tablequeue, A_Loopfield) 
}
}
}
return
;-----------------------------------------------------------------------------------------------------
clickok()
{
ifwinexist,PokerStars ahk_class #32770
{
ControlGet, Z, Visible,,Button2, PokerStars ahk_class #32770
if !z
ControlGet, Z, Visible,,Button3, PokerStars ahk_class #32770
if !z
controlclick,Button1,PokerStars ahk_class #32770
}
}
return
;-----------------------------------------------------------------------------------------------------
autobuy()
{
global max,remembered,xbb,bbmultiplier
ifwinexist, Buy-in ahk_class #32770
{
 winget,id,id,Buy-in ahk_class #32770
 ControlGet, v, Visible,,Edit1, ahk_id %id%
 if v
 {
  SetControlDelay, -1
  if max
  {
   Control, Check,, Button1, ahk_id %id%
   sleep,-1
   ControlClick, OK, ahk_id %id%
  }
  if remembered
  {
   ControlClick, OK, ahk_id %id%
  }
  if xbb
  {
   parent:=DllCall("GetParent","uint",id)
   wingettitle,title,ahk_id %parent%
   stringtrimleft,hero,title,InStr(title, A_space,false,0)
   If ((InStr(title, "No Limit") OR InStr(title, "Pot Limit")) AND InStr(title, "Tournament") = 0)
   {
    StringMid, bb, title, InStr(title, "/") + 1, InStr(title, a_space,"", InStr(title, "/")) - InStr(title, "/") - 1
   }
   else if (InStr(title, "No Limit") <> 0 AND InStr(title, "Tournament") <> 0)
   {
    StringMid, bb, title, InStr(title, "/", "", InStr(title, "Blinds")) + 1, InStr(title, a_space, "", InStr(title, "Blinds") + 8) - InStr(title, "/", "", InStr(title, "Blinds")) - 1 ;___so we retrieve the big blind instead
   }
   StringReplace,bb,bb,$,,1  
   StringReplace,bb,bb,€,,1 
   StringReplace,bb,bb,Ђ,,1
   StringReplace,bb,bb,Ј,,1
   bb*=bbmultiplier
   bb := Round(bb, 2)
   Control, Check,, Button2, ahk_id %id%
   sleep,-1
   ControlSetText, Edit1, %bb%, ahk_id%id%
   ControlClick, OK, ahk_id %id%
   winwaitclose,ahk_id %id%,,1.5
   if errorlevel
   ControlClick, Cancel, ahk_id %id%
  }
 }
}
}
return
;-----------------------------------------------------------------------------------------------------
Popupwatcher:

if TakeSeat
TakeSeat()

if Buyin
autobuy()

if closeOKwindow
clickok()

return
;-----------------------------------------------------------------------------------------------------
FreeCheck:
IfWinExist, PokerStars, Check
{
 SetControlDelay, -1
 ControlFocus, Check
 Sleep, -1
 ControlClick, Check
 Sleep, -1
 ControlSend, Check, {SPACE}
}
return
;-----------------------------------------------------------------------------------------------------
HeroSeated:
IsHeroSeared()
return

IsHeroSeared()
{
local list,winid,title
local col,click_x,click_y
winget,list,list,ahk_class PokerStarsTableFrameClass
loop %list%
{
 winid:=list%A_index%
 wingettitle,title,ahk_id%winid%
 col:=PixelColorA(0.0115,0.6800,winid,1)
 if seated%winid%=1
 if instr(title,"Logged In")
 if (instr(col,"15193294")) or (instr(col,"-0-")) or (instr(col,"16777215") or (instr(col,"65331")))
 {
  if move
  {
   if AutoMoveBack 
   {
   WinMove, ahk_id%winid%,, xstart%winid%,ystart%winid%
   seated%winid%:=2
   }
  } 
  if Autopost
  {
   if !instr(title,"fast")
   {
    click_x :=0.0142
    click_y :=0.7224
    PostclickStars(click_x,click_y,winid,0)
   }
  }
  if waitbb
  { 
   click_x :=0.6629
   click_y :=0.8555
   PostclickStars(click_x,click_y,winid,0)
  }
 if seated%winid%!=2
 seated%winid%:=3
 }
}
}
return
;-----------------------------------------------------------------------------------------------------
relStarsClientPoint(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
;-----------------------------------------------------------------------------------------------------
PostLeftClick(x, y, table_id, activate=1, control_class="") {
; ### 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%
critical,6
PostMessage, 0x201, 0x0001, ((y<<16)^x), %control_class%, ahk_id%table_id%
PostMessage, 0x202 , 0, ((y<<16)^x), %control_class%, ahk_id%table_id%
critical,off
sleep,-1
}
return
;-----------------------------------------------------------------------------------------------------
PostclickStars(x,y,winid,activate=1,client=1)
{
relStarsClientPoint(winid, x, y,client)
DllCall("SetCapture","Uint",winid)
PostLeftClick(x, y, winid, activate)
DllCall("ReleaseCapture")
}
return
;-----------------------------------------------------------------------------------------------------
PixelColorA(colx,coly,id,region=0,colx1=0,coly1=0,region1=0)
{
global xbord,ybord,cap
hdc_frame := DllCall( "GetDC", "UInt",PokerWindowID)
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 )
WinGet,ctrls,ControlList,ahk_id %id%
Loop,Parse,ctrls,`n
{
 class:=A_LoopField
 ControlGet,ctrlid,Hwnd,,%class%,ahk_id %id%
 ControlGet,visible,Visible,,,ahk_id %ctrlid%
 If visible=1
 DllCall("RedrawWindow","UInt",ctrlid,"UInt",0,"UInt",0,"UInt", 1|4|64|1024)
}
DllCall("RedrawWindow","UInt",id,"UInt",0,"UInt",0,"UInt", 1|4|64|1024) 
x:=floor(((W-2*xbord)*colx)) + xbord
y:=floor(((H-(2*ybord)-cap)*coly)) + ybord + cap
if region
{
loop 10
{
delta:=A_index
loop 10
{
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
;pix.=p . "*" . p1 . "-"
pix.=p . "-"
}
}
}
else
{
pix := DllCall("GetPixel", "UInt", hdc_buffer, "Int", x, "Int", y) 
SetFormat, IntegerFast, hex
pix += 0
pix .= ""
SetFormat, IntegerFast, d
}

if colx1
{
x:=floor(((W-2*xbord)*colx1)) + xbord
y:=floor(((H-(2*ybord)-cap)*coly1)) + ybord + cap
if region1
{
loop 10
{
delta:=A_index
loop 10
{
delta1:=A_index
p := DllCall("GetPixel", "UInt", hdc_buffer, "Int", x+delta , "Int", y+delta1)
pix1.=p . "-"
}
}
}
else
{
pix1 := DllCall("GetPixel", "UInt", hdc_buffer, "Int", x, "Int", y)
SetFormat, IntegerFast, hex
pix1 += 0
pix1 .= ""
SetFormat, IntegerFast, d
}
}


if region1
pix.="*" . pix1
else
if colx1
pix.="-" . pix1
sleep,1
DllCall( "gdi32.dll\DeleteObject","Uint",hbm_buffer)
DllCall( "gdi32.dll\ReleaseDC","Uint",hdc_buffer)
DllCall( "gdi32.dll\DeleteDC","Uint",hdc_buffer)
DllCall( "gdi32.dll\ReleaseDC","Uint",hdc_frame)
DllCall( "gdi32.dll\DeleteDC","Uint",hdc_frame)
return pix
}
;-----------------------------------------------------------------------------------------------------
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
}
;-----------------------------------------------------------------------------------------------------
CloseAllWithNoAction:
settimer,ClickBack,off
SetControlDelay, -1
WinGet, list, List, ahk_class PokerStarsTableFrameClass
Loop, %list%
{
 winid:=list%A_Index%
 wingettitle,title,ahk_id%winid%
 Sittingout:=PixelColorA(0.8125,0.8621,winid)
 If !instr(title,"Logged In") OR ((Sittingout=0x000000) OR (Sittingout=0xDFD9CE) OR (Sittingout=0xD2EBF3) OR (Sittingout=0xB3A39D) OR (Sittingout=0x9D9D9D) OR (Sittingout=0xCCCCCC) OR (Sittingout=0xDEDBCE) OR (Sittingout=0xB5A29c) OR (Sittingout=0xBDAEAD) OR (Sittingout=0x343434)  OR (Sittingout=0x444444)  OR (Sittingout=0x333333))
 WinKill,ahk_id%winid%
}
WinGet, list, List, ahk_class PokerStarsTableFrameClass
Loop, %list%
{
 winid:=list%A_Index%
 Sittingout:=PixelColorA(0.8125,0.8621,winid)
 If !((Sittingout=0x000000) OR (Sittingout=0xDFD9CE) OR (Sittingout=0xD2EBF3) OR (Sittingout=0xB3A39D) OR (Sittingout=0x9D9D9D) OR (Sittingout=0xCCCCCC) OR (Sittingout=0xDEDBCE) OR (Sittingout=0xB5A29c) OR (Sittingout=0xBDAEAD) OR (Sittingout=0x343434)  OR (Sittingout=0x444444)  OR (Sittingout=0x333333))
 {
  back_x:=0.0141
  back_y:=0.6860
  PostClickStars(back_x, back_y, winid, 0) 
 }   
}
sleep,1000
WinGet, list, List, ahk_class PokerStarsTableFrameClass
Loop, %list%
{
 winid:=list%A_Index%
 Sittingout:=PixelColorA(0.8125,0.8621,winid)
 If ((Sittingout=0x000000) OR (Sittingout=0xDFD9CE) OR (Sittingout=0xD2EBF3) OR (Sittingout=0xB3A39D) OR (Sittingout=0x9D9D9D) OR (Sittingout=0xCCCCCC) OR (Sittingout=0xDEDBCE) OR (Sittingout=0xB5A29c) OR (Sittingout=0xBDAEAD) OR (Sittingout=0x343434)  OR (Sittingout=0x444444)  OR (Sittingout=0x333333))
 WinKill,ahk_id%winid%
}  
WinGet, list, List,Table ahk_class #32770
Loop, %list%
{
 winid:=list%A_Index%
 ControlFocus,Button1, ahk_id%winid%
 Sleep, -1
 ControlClick,Button1, ahk_id%winid%
 Sleep, -1
 ControlSend,Button1, {SPACE}, ahk_id%winid%
}
return
;-----------------------------------------------------------------------------------------------------
closeTable:
LeaveTable()
return

LeaveTable()
{
settitlematchmode,2
SetControlDelay, -1  
ifwinexist,Table ahk_class #32770
{
winget,winid,id,Table ahk_class #32770
ControlGet, v, Visible,,Button2, ahk_id %winid%
ControlGet, z, Visible,,Button3, ahk_id %winid%
if (v) & (!z)
{
 ControlFocus,Button1, ahk_id%winid%
 Sleep, -1
 ControlClick,Button1, ahk_id%winid%
 Sleep, -1
 ControlSend,Button1, {SPACE}, ahk_id%winid%
}
}
}
return
;-----------------------------------------------------------------------------------------------------
SitOutNextAll:
;ClickImBack:=false
settimer,ClickBack,off
WinGet, list, List,Logged In ahk_class PokerStarsTableFrameClass
Loop, %list%
{
 Z:=list%A_Index%
 WinGetPos,,, W, H, ahk_id %Z%
 Sittingout:=PixelColorA(0.8125,0.8621,Z)
 If !((Sittingout=0x000000) OR (Sittingout=0xDFD9CE) OR (Sittingout=0xD2EBF3) OR (Sittingout=0xB3A39D) OR (Sittingout=0x9D9D9D) OR (Sittingout=0xCCCCCC) OR (Sittingout=0xDEDBCE) OR (Sittingout=0xB5A29c) OR (Sittingout=0xBDAEAD) OR (Sittingout=0x343434)  OR (Sittingout=0x444444)  OR (Sittingout=0x333333))
 {
  back_x:=0.0141
  back_y:=0.6860
  PostClickStars(back_x, back_y, Z, 0) 
 }       
}
return
;-----------------------------------------------------------------------------------------------------
RemoveSitout:
;ClickImBack:=true
if ClickImBack
settimer,ClickBack,1500
WinGet, list, List,Logged In ahk_class PokerStarsTableFrameClass
Loop, %list%
{
 Z:=list%A_Index%
 WinGetPos,,, W, H, ahk_id %Z%
 Sittingout:=PixelColorA(0.8125,0.8621,Z)
 JoinWaitingList:=PixelColorA(0.8625,0.8621,Z)
 If (Sittingout=0x000000) OR (Sittingout=0xDFD9CE) OR (Sittingout=0xD2EBF3) OR (Sittingout=0xB3A39D) OR (Sittingout=0x9D9D9D) OR (Sittingout=0xCCCCCC) OR (Sittingout=0xDEDBCE) OR (Sittingout=0xB5A29c) OR (Sittingout=0xBDAEAD) OR (Sittingout=0x343434)  OR (Sittingout=0x444444)  OR (Sittingout=0x333333)
  If (JoinWaitingList!=0x000000) AND (JoinWaitingList!=0xDFD9CE) AND (JoinWaitingList!=0xDEDBCE) AND (JoinWaitingList!=0x0xB5A29c) AND (JoinWaitingList!=0xBDAEAD)  AND (JoinWaitingList!=0x1f1f1f)  AND (JoinWaitingList!=0x343434) AND (JoinWaitingList!=0x0202020)  AND (JoinWaitingList!=0xe6e6e6) AND (JoinWaitingList!=0xdddddd)  AND (JoinWaitingList!=0x1e1e1e) AND (JoinWaitingList!=0xb0b0b0)
 {
  back_x :=0.7515
  back_y :=0.8468
  PostClickStars(back_x, back_y, Z, 0) 
 }       
}
return
;-----------------------------------------------------------------------------------------------------
ClickBack:
imback()
return
;-----------------------------------------------------------------------------------------------------
imback()
{
winget,list,list,Logged In ahk_class PokerStarsTableFrameClass
back_x:=0.8031
back_y:=0.8405
join_x:=0.8631
join_y:=0.8405
loop %list%
{
id:=list%A_index%
col:=PixelColorA(back_x,back_y,id,1,join_x,join_y,1)
stringsplit,col,col,*
Sittingout:=col1
JoinWaitingList:=col2 
if (instr(Sittingout,"4473924")) or (instr(Sittingout,"14670286")) or (instr(Sittingout,"-0-")) or (instr(Sittingout,"-0x0-"))
 if !((instr(JoinWaitingList,"3684408")) or (instr(JoinWaitingList,"4473924")) or (instr(JoinWaitingList,"14670286")) or (instr(JoinWaitingList,"-0-")) or (instr(JoinWaitingList,"-0x0-")))
 {
  postclickstars(back_x,back_y,id,0)
 }
}
}
return
;-----------------------------------------------------------------------------------------------------
Toggleimback:
If (ClickImBack=true)
{
 ClickImBack:=false
 settimer,ClickBack,off
 T=Off
}
else
{
 ClickImBack:=true
 settimer,ClickBack,1500
 T=On
}
Gui, 2:Add, Text,, Auto Click Im Back: %T%
Gui, 2:+ToolWindow
Gui, 2:Show, w150 h20
Sleep, 1000
Gui, 2:Destroy
return
;-----------------------------------------------------------------------------------------------------
ClickTimebank:
clicktime()
return
;-----------------------------------------------------------------------------------------------------
clicktime()
{
global SlickTheme
winget,list,list,Logged In ahk_class PokerStarsTableFrameClass
loop %list%
{
 id:=list%A_index%
 if SlickTheme
 col:=PixelColorA(0.4920,0.7958,id,1)
 else 
 col:=PixelColorA(0.6500,0.7670,id,1)
; FileAppend, %col%`n`n, test.txt
 if (instr(col,"13484978")) or (instr(col,"1000084")) or (instr(col,"16777215")) 
 {
 if SlickTheme
  { 
  click_x :=0.5047
  click_y :=0.8256
  }
  else
  {
  click_x :=0.6582
  click_y :=0.7729
  }
  PostClickStars(click_x, click_y, id, 0)
 }
}
}
return
;-----------------------------------------------------------------------------------------------------
Joinwaitlist:
winget,list,list, ahk_class PokerStarsTableFrameClass
loop %list%
{
 id:=list%A_index% 
 ;col:=PixelColorA(0.6165,0.9352,id,1)
 col:=PixelColorA(0.6274,0.9352,id,1)
 ;FileAppend, %col%`n`n, test.txt
 if !(instr(col,"15921906")) & !(instr(col,"16777215"))
 {
  click_x :=0.8625
  click_y :=0.8621
  PostclickStars(click_x,click_y,id,0)
 }
}
return
;-----------------------------------------------------------------------------------------------------
Unjoinwaitlist:
winget,list,list, ahk_class PokerStarsTableFrameClass
loop %list%
{
 id:=list%A_index%
 ;col:=PixelColorA(0.6165,0.9352,id,1)
 col:=PixelColorA(0.6274,0.9352,id,1)
 if InStr(col,"15921906") or (instr(col,"16777215"))
 {
  click_x :=0.8625
  click_y :=0.8621
  PostclickStars(click_x,click_y,id,0)
 }
}
return
;-----------------------------------------------------------------------------------------------------
MoveBackByKey:
ifwinactive, ahk_class PokerStarsTableFrameClass
{
 winget,id,id,A
 if (seated%id%=1) or (seated%id%=3)
 {
  wingettitle,title,ahk_id%id%
  seated%id%:=2
  WinMove, ahk_id%id%,, xstart%id%,ystart%id%
 }
}
return
;-----------------------------------------------------------------------------------------------------
TakeSeat() 
{
global AutoReservedSeat
IfWinExist, PokerStars ahk_class #32770
{
 WinGet, list, list, Seat Available ahk_class #32770
 Loop, %list%
 {
  This_id := list%A_Index%
  ControlFocus, Button2, ahk_id%this_id%
  Sleep, -1
  ControlSend, Button2, {SPACE}, ahk_id%this_id% 
 }
 setwindelay,-1
 if AutoReservedSeat
 if list>0
 {
  sleep,400
  winget,id,id,ahk_class PokerStarsTableFrameClass
  ClickSeats(id)
 }
}
}
return
;-----------------------------------------------------------------------------------------------------
ClickSeats(id)
{ 
 Postclickstars(0.5000,0.6903,id,0)
 Postclickstars(0.2299,0.6536,id,0)
 Postclickstars(0.0697,0.4250,id,0)
 Postclickstars(0.1770,0.1835,id,0)
 Postclickstars(0.3401,0.0867,id,0)
 Postclickstars(0.6566,0.0867,id,0)
 Postclickstars(0.8333,0.1910,id,0)
 Postclickstars(0.9328,0.4250,id,0)
 Postclickstars(0.7764,0.6513,id,0)

 Postclickstars(0.1028,0.5114,id,0)
 Postclickstars(0.1028,0.2591,id,0)
 Postclickstars(0.8876,0.2591,id,0)
 Postclickstars(0.8876,0.5114,id,0)
}
return
;-----------------------------------------------------------------------------------------------------
FindTableToAct:
findactivetable()
return
;-----------------------------------------------------------------------------------------------------
findactivetable()
{
WinGet, l, List, ahk_class PokerStarsTableFrameClass
found:=false
v:=30
foldx:=0.5575
foldy:=0.9846
foldx1:=0.5063
foldy1:=0.9846
Loop, %l%
{
  winid:=l%A_Index%
  ControlGet, Z, Visible,,PokerStarsSliderClass1, ahk_id %winid%
  If Z
  {
    WinActivate, ahk_id %winid%
    found:=true
    Break
  }
}
if !found
Loop, %l%
{
  winid:=l%A_Index%
  col:=PixelColorA(foldx,foldy,winid,0,foldx1,foldy1,0)
  stringsplit,col,col,-
  if comparecolors(col1,col2,v)=0
  {
  WinActivate, ahk_id %winid%
  break
  }
}
}
return
;-----------------------------------------------------------------------------------------------------
ActivateBottomWindow:
GroupActivate, StarsTables
return
;-----------------------------------------------------------------------------------------------------
activateundermouse:
activatetableundermouse()
return

activatetableundermouse()
{
  If winactive("ahk_class PokerStarsTableFrameClass") or winactive("PokerStars Lobby")
  {
    MousegetPos,,,WinID
    WinGetClass, class, ahk_id %WinID%
    WinGetTitle, title, ahk_id %WinID%
    if (class="PokerStarsTableFrameClass") or (instr(title,"PokerStars Lobby"))
    winactivate, ahk_id %WinID%
  }
}
return
;-----------------------------------------------------------------------------------------------------
Cashier:
IfWinExist Cashier ahk_class #32770
{
WinActivate Cashier ahk_class #32770
SetControlDelay -1
ControlClick, PokerStarsButtonClass8, Cashier
}
else
{
WinActivate PokerStars Lobby
WinMenuSelectItem, PokerStars Lobby,, Lobby, Cashier...
}
return
;-----------------------------------------------------------------------------------------------------
Layout1:
layx:=0.5047
layy:=0.1880
layy1:=0.0940
WinGet, WinId, ID, ahk_class PokerStarsTableFrameClass 
if Winid
{
winactivate,ahk_id%winid%
if HyperSimpleTheme
{
relstarsclientpoint(winid,layx,layy1,0)
ControlClick,x%layx% y%layy1%,ahk_id %WinID%,,,,NA
}
else
{
relstarsclientpoint(winid,layx,layy,0)
ControlClick,x%layx% y%layy%,ahk_id %WinID%,,,,NA
}
Loop
{
WinWait, Options
Winactivate, Options
SetControlDelay, -1
ControlClick, Button13, Options,,,,NA
sleep 100
Send {down 5}
Send {Enter}
WinWaitClose, Options,,1
If (!ErrorLevel)	
	Break
}
}
return
;-----------------------------------------------------------------------------------------------------
Layout2:
layx:=0.5047
layy:=0.1880
layy1:=0.0940
WinGet, WinId, ID, ahk_class PokerStarsTableFrameClass 
if Winid
{
winactivate,ahk_id%winid%
if HyperSimpleTheme
{
relstarsclientpoint(winid,layx,layy1,0)
ControlClick,x%layx% y%layy1%,ahk_id %WinID%,,,,NA
}
else
{
relstarsclientpoint(winid,layx,layy,0)
ControlClick,x%layx% y%layy%,ahk_id %WinID%,,,,NA
}
Loop
{
WinWait, Options
Winactivate, Options
SetControlDelay, -1
ControlClick, Button13, Options,,,,NA
sleep 100
Send {down 6}
Send {Enter}
WinWaitClose, Options,,1
If (!ErrorLevel)	
	Break
}
}
return
;-----------------------------------------------------------------------------------------------------
Layout3:
layx:=0.5047
layy:=0.1880
layy1:=0.0940
WinGet, WinId, ID, ahk_class PokerStarsTableFrameClass 
if Winid
{
winactivate,ahk_id%winid%
if HyperSimpleTheme
{
relstarsclientpoint(winid,layx,layy1,0)
ControlClick,x%layx% y%layy1%,ahk_id %WinID%,,,,NA
}
else
{
relstarsclientpoint(winid,layx,layy,0)
ControlClick,x%layx% y%layy%,ahk_id %WinID%,,,,NA
}
Loop
{
WinWait, Options
Winactivate, Options
SetControlDelay, -1
ControlClick, Button13, Options,,,,NA
sleep 100
Send {down 7}
Send {Enter}
WinWaitClose, Options,,1
If (!ErrorLevel)	
	Break
}
}
return
;-----------------------------------------------------------------------------------------------------
Highlighter:
HighLighter(1)
return

HighLighter(Highlight=1) 
{
global last_table_id
global border_color
global border_size
global trans
;global ActiveX,ActiveY,ActiveW,ActiveH
global OldX,OldY,OldW,OldH
global highlighthero

foldx:=0.5575
foldx1:=0.5079
foldy:=0.9846
foldy1:=0.9846
v:=25

ifwinactive,ahk_class PokerStarsTableFrameClass
{  
 winget,id,id,A
 WinGetActiveStats,ActiveTitle, ActiveW, ActiveH, ActiveX, ActiveY
  relstarsclientpoint(id,foldx,foldy,0)
  pixelgetcolor,fold,foldx,foldy,ahk_id%id%
  relstarsclientpoint(id,foldx1,foldy1,0)
  pixelgetcolor,bacgr,foldx1,foldy1,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%
  global xbord
  global cap
  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)
  { 
   ;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 comparecolors(fold,bacgr,v)=1
 {
  Gui, 2: Cancel
  Gui, 3: Cancel
  Gui, 4: Cancel
  Gui, 5: Cancel
  last_table_id=
 }        
 }
 else
 if highlighthero 
 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.75, y_mouse=0.75)
{
if IsWindowNew()
{ 
wingetclass,class,A
wingetactivetitle,title
if class=PokerStarsTableFrameClass 
if instr(title,"Logged In") 
{
 winget,id,id,A
 relStarsClientPoint(id, x_mouse, y_mouse,0,1)
 DllCall("SetCursorPos", int, x_mouse, int, y_mouse)
}  
}
}
return
;-----------------------------------------------------------------------------------------------------
AlterAmount(id, dir="", frac=1, unit="")
{
 global stars_editbox
  WinGetTitle, title, ahk_id%id%
  amount := 0
  StringTrimRight, tablename, title, ( StrLen(title) - (InStr(title, " - ")-1) )
  IfWinExist, ahk_id%id% ahk_group StarsTables
  {
    If ((InStr(title, "No Limit") OR InStr(title, "Pot Limit")) AND InStr(title, "Tournament") = 0)
    {
      StringMid, bb, title, InStr(title, "/") + 1, InStr(title, a_space,"", InStr(title, "/")) - InStr(title, "/") - 1
    }
    else if (InStr(title, "No Limit") <> 0 AND InStr(title, "Tournament") <> 0)
    {
      StringMid, bb, title, InStr(title, "/", "", InStr(title, "Blinds")) + 1, InStr(title, a_space, "", InStr(title, "Blinds") + 8) - InStr(title, "/", "", InStr(title, "Blinds")) - 1 ;___so we retrieve the big blind instead
    }  
  }   
  StringReplace,bb,bb,$,,1
  StringReplace,bb,bb,Ј,,1
  StringReplace,bb,bb,Ђ,,1
  StringReplace,bb,bb,€,,1 

  bb++
  bb--
  sb := sb(bb)
  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 StarsTables
    {
      PotSizeStars(id, pot, call, sb, bb, hero_bet, street, hero_position, open)
    } 
    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 StarsTables
  {
    ControlGetText, t, %stars_editbox%, ahk_id%id%
    t := t + amount
    if (t < 0)
    {
      t := 0
    }
    t1 := Round(t, 2)
    t := Round(t, 3)
    if t-t1=0
    t:=t1
    ControlSetText, %stars_editbox%, %t%, ahk_id%id%
    Sleep, -1
    ;ControlGetText, t, %stars_editbox%, ahk_id%id%
    WinSet, Redraw,, ahk_id%id%
  } 
}

Pot(id, frac=1, round_bet=0.2, open_adjust="", fixblinds=0)
{
  global debug
  global stars_editbox
  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 StarsTables
  {
   ; PotSizeStars(id, pot, call, sb, bb, hero_bet, street, hero_position, open)
   ; if pot<=0
    loop %attempts%
    {
     PotSizeStars(id, pot, call, sb, bb, hero_bet, street, hero_position, open)
     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 StarsTables
  {
    ControlSetText, %stars_editbox%, %pot%, ahk_id%id%
    Sleep, -1
  }
}

PotSizeStars(id, ByRef pot, ByRef call, ByRef sb, ByRef bb, ByRef hero_bet, ByRef street, ByRef hero_position, ByRef open)
{
  global use_old_stars_buttons, stars_editbox , ClassicTheme , HyperSimpleTheme, SlickTheme
  CoordMode, Pixel, Screen
  setwindelay,-1
  if ClassicTheme 
  {
  PotThemeDir := "classic"
  CallThemeDir := "classic"
  pot_x1:=0.4400
  pot_x2:=0.5706
  pot_y1:=0.0140
  pot_y2:=0.0685
  call_x1:=0.7143
  call_y1:=0.9342
  call_y2:=0.9802
  call_x2:=0.7843
  raise_x1:=0.8727
  raise_y1:=0.9342
  raise_y2:=0.9802
  raise_x2:=0.9423
  }
  else 
  if HyperSimpleTheme
  {
  PotThemeDir := "hypersimple"
  CallThemeDir := "hypersimple"
  pot_x1:=0.4900
  pot_x2:=0.5706
  pot_y1:=0.0140
  pot_y2:=0.0885
  call_x1:=0.7143
  call_y1:=0.9342
  call_y2:=0.9802
  call_x2:=0.7843
  raise_x1:=0.8727
  raise_y1:=0.9342
  raise_y2:=0.9802
  raise_x2:=0.9423
  }
  else 
  if SlickTheme
  { 
  PotThemeDir := "slick"
  CallThemeDir := "slick"
  pot_x2:=0.5466
  pot_y2:=0.1645
  pot_x1:=0.4640
  pot_y1:=0.0895
  call_y2:=0.9802
  call_y1:=0.9342
  call_x2:=0.7454
  call_x1:=0.6754
  raise_x1:=0.8474
  raise_y1:=0.9342
  raise_y2:=0.9802
  raise_x2:=0.9304
  }
  else
  {
   return
  }
  if (use_old_stars_buttons)
  {
    CallThemeDir := CallThemeDir . "\old"
  }
  street := GetStreetStars(id)

  WinGetPos, x, y, w, h, ahk_id%id%
  if (w <= 526)
  {
    SizeDir := 0
  }
  else if (w <= 621)
  {
    SizeDir := 1
  }
  else if (w <= 736)
  {
    SizeDir := 2
  }
  else if (w <= 875)
  {
    SizeDir := 3
  }
  else if (w <= 1037)
  {
    SizeDir := 4
  }
  else if (w <= 1227)
  {
    SizeDir := 5
  }
  else
  {
    SizeDir := 6
  } 

  PicDir := "StarsPics"
  potPicDir := PicDir . "\" . PotThemeDir . "\pot\" . SizeDir
  buttonPicDir := PicDir . "\" . CallThemeDir . "\call\" . SizeDir

; winset,alwaysontop,on,ahk_id%id%
  relStarsclientPoint(id, pot_x1, pot_y1,0)
  relStarsclientPoint(id, pot_x2, pot_y2,0)
;  loop 2
;  {
  pot := DigitSearch(pot_x1, pot_y1, pot_x2, pot_y2, id, potPicDir, "", 50)
;  if pot>0
;  {
;   break
;  }
;  sleep,15
;  }
  relStarsclientPoint(id, call_x1, call_y1,0)
  relStarsclientPoint(id, call_x2, call_y2,0)
  call := DigitSearch(call_x1, call_y1, call_x2, call_y2, id, buttonPicDir, "", 50)
  call := iif( call, call, 0 )
  bb := GetBBStars(id, GameTypeStars(WinGetTitle(id)))
  sb := sb(bb) 
; winset,alwaysontop,off,ahk_id%id%
  if (street = "pre")
  {
    ControlGetText, t, %stars_editbox%, ahk_id%id%
    ControlSetText, %stars_editbox%, 0, ahk_id%id%
  relStarsclientPoint(id, raise_x1, raise_y1,0)
  relStarsclientPoint(id, raise_x2, raise_y2,0)
; winset,alwaysontop,on,ahk_id%id%
   minraise := DigitSearch(raise_x1, raise_y1, raise_x2, raise_y2, id, buttonPicDir, "", 50)
; winset,alwaysontop,off,ahk_id%id%
    t := Round(t, 2)
    ControlSetText, %stars_editbox%, %t%, ahk_id%id%
    Sleep, -1 
    if (minraise > (2*bb))
    {
      ;pot has been raised
      if (call = bb)
      {
        ;pot was minraised, and we are the BB
        hero_bet := bb
        hero_position := "bb"
      }
      else if (call < (bb*2))
      {
        ;pot was minraised, and we are the SB
        hero_bet := sb
        hero_position := "sb"
      }
    }
    else if (call = bb)
    {
      ;hero is not a blind, unraised pot, do nothing
    }
    else if (call = 0)
    {
      ;unraised pot, hero is the BB
      hero_bet := bb
      hero_position := "bb"
    }
    else if (call < bb)
    {
      ;unraised pot, hero is the SB
      hero_bet := sb
      hero_position := "sb"

    }
    else
    {
      ;pot has been raised, we are not opening
      open := 0
    }
  }
  else
  {
    ;not pre-flop, no need for open adjustment
    open := 0
  } 
  return
}

DigitSearch(startX,startY,endX,endY,win,dir,ex="",shades=1) {
If ex =
 ex = bmp
batchlines = %A_BatchLines%
SetBatchLines -1
WinGetPos,Xwin,Ywin,,,ahk_id%win%
CoordMode, Pixel, Screen
Loop, 11 {
  i = %a_index%
  If i = 10
    i = 0
  else if i = 11
    i = -1
  lastXpos := startX + Xwin
  Loop { 
    x1 := lastXpos + 1
    y1 := startY + Ywin
    x2 :=  endX + Xwin
    y2 := endY + Ywin    
    ImageSearch, lastXpos,, x1, y1, x2, y2, *%shades% %dir%\%i%.%ex%   
    If ( errorLevel )
    {
      break
    }
    p++
    p%p% = %lastXpos%
    If i = -1
      t = .
    else
      t = %i%
    StringReplace, xpos, lastXpos, -, _
    c%xpos% = %t%
   }
 }
Loop, %p%
 p_all := p_all "," p%a_index%
Sort, p_all, N D, U
Loop, Parse, p_all, `,
{
 StringReplace, xpos, a_loopfield, -, _
    
 amount := amount "" c%xpos%
} 
CoordMode, Pixel, Relative
SetBatchLines %batchlines%
return amount
}

; 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
}

GetBBStars(id, game_type) {
WinGetTitle, title, ahk_id%id% 
  StringReplace,title,title,€,,1 
  StringReplace,title,title,Ђ,,1 
  StringReplace,title,title,Ј,,1
If (game_type = "NL Ring")
 return StrRep(StrMid(title,"/",a_space), "$")
else if (game_type = "NL Tourney")
 return StrRep(StrMid(title,"/",a_space,InStr(title," - Blinds")),"$")
}

GameTypeStars(title) {
If InStr(title, " - Limit Stud")
 return "Stud"
else if ((InStr(title, "NL Hold'em") || InStr(title, " - Pot Limit Hold'em") || InStr(title, " - No Limit Hold'em") || InStr(title, "PL Hold'em"))
  && InStr(title, "Tournament"))
 return "NL Tourney"
else if (InStr(title, " - No Limit Hold'em") || InStr(title, " - Pot Limit Hold'em"))
 return "NL Ring"
else
 return "Limit"
}

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
}

GetStreetStars(id)
{
  global debug
  CoordMode, Pixel, Screen
  street := "pre" 
  x1 := 0.6168
  y1 := 0.3315
  x2 := 0.6660
  y2 := 0.3811
  relStarsClientPoint(id, x1, y1,0,1)
  relStarsClientPoint(id, x2, y2,0,1)

  If ( GetPixelCount(x1, y1, x2, y2, 0xffffff) > 10 )
  {
    street := "river"
    return street
  }  
  x1 := 0.5394
  y1 := 0.3315
  x2 := 0.5887
  y2 := 0.3811
  relStarsClientPoint(id, x1, y1,0,1)
  relStarsClientPoint(id, x2, y2,0,1)

  If ( GetPixelCount(x1, y1, x2, y2, 0xffffff) > 10 )
  {
    street := "turn"
    return street
  }
  x1 := 0.3373
  y1 := 0.3315
  x2 := 0.3867
  y2 := 0.3811
  relStarsClientPoint(id, x1, y1,0,1)
  relStarsClientPoint(id, x2, y2,0,1)

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

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
}

WinGetTitle(win) {
WinGetTitle, title, ahk_id%win%
return title
}

FoldStars(id)
{
  PostClickStars(0.59,0.9241,id)
 ; Sleep, 20
 ; PostStarsClickpot(416,478,id)
}
CallStars(id)
{
  PostClickStars(0.7462,0.9241,id)
}
RaiseStars(id)
{
  PostClickStars(0.8860,0.9241,id)
}
Fold2anyStars(id)
{
  PostClickStars(0.0158,0.6467,id)
}


fold:
If ActOnActiveTable
WinGet, Id, ID, A
else
MousegetPos,,,ID
wingetclass,class,ahk_id%id%
if class=PokerStarsTableFrameClass
{
 if suspendforchat
 {
 ; If ActOnActiveTable
  if IsMouseInChat(id)
  {
   ControlGetFocus, ctrl, ahk_id%id%
   ControlSend,%ctrl% , %fold%, ahk_id%id%
  }
  else
  FoldStars(id)
 }
 else
 FoldStars(id)
}
else
{
ControlGetFocus,ctrl,ahk_id%id%
ControlSend,%ctrl%,%fold%,ahk_id%id%
}
return



call:
If ActOnActiveTable
WinGet, Id, ID, A
else
MousegetPos,,,ID
wingetclass,class,ahk_id%id%
if class=PokerStarsTableFrameClass
{
 if suspendforchat
 {
 ; If ActOnActiveTable
  if IsMouseInChat(id)
  {
   ControlGetFocus, ctrl, ahk_id%id%
   ControlSend,%ctrl% , %call%, ahk_id%id%
  }
  else
  callStars(id)
 }
 else
 callStars(id)
}
else
{
ControlGetFocus,ctrl,ahk_id%id%
ControlSend,%ctrl%,%call%,ahk_id%id%
}
return

raise:
If ActOnActiveTable
WinGet, Id, ID, A
else
MousegetPos,,,ID
wingetclass,class,ahk_id%id%
if class=PokerStarsTableFrameClass
{
 if suspendforchat
 {
 ; If ActOnActiveTable
  if IsMouseInChat(id)
  {
   ControlGetFocus, ctrl, ahk_id%id%
   ControlSend,%ctrl% , %raise%, ahk_id%id%
  }
  else
  raiseStars(id)
 }
 else
 raiseStars(id)
}
else
{
ControlGetFocus,ctrl,ahk_id%id%
ControlSend,%ctrl%,%raise%,ahk_id%id%
}
return

fold2any:
If ActOnActiveTable
WinGet, Id, ID, A
else
MousegetPos,,,ID
wingetclass,class,ahk_id%id%
if class=PokerStarsTableFrameClass
{
 if suspendforchat
 {
 ; If ActOnActiveTable
  if IsMouseInChat(id)
  {
   ControlGetFocus, ctrl, ahk_id%id%
   ControlSend,%ctrl% , %fold2any%, ahk_id%id%
  }
  else
  fold2anyStars(id)
 }
 else
 fold2anyStars(id)
}
else
{
ControlGetFocus,ctrl,ahk_id%id%
ControlSend,%ctrl%,%fold2any%,ahk_id%id%
}
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
raisestars(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
raisestars(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
raisestars(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, StarsTables, ahk_class PokerStarsTableFrameClass ,,, PokerStars Lobby
if autopot
{
isbetboxnew()
}
return
;-----------------------------------------------------------------------------------------------------
BuildGui:
Gui, color, white
;Gui, font, cOlive
Gui, add, tab, h450 w270, General|Time|Annoyances|Table moving|BetPot|Table hotkeys|Global hotkeys
Gui, Tab, General
Gui, Add, Radio, x26 y50 w180 h20 Checked%ClassicTheme% vClassicTheme, Classic Theme
Gui, Add, Radio, x26 y70 w180 h20 Checked%HyperSimpleTheme% vHyperSimpleTheme, HyperSimple Theme
Gui, Add, Radio, x26 y90 w180 h20 Checked%BlackTheme% vBlackTheme, Black Theme
Gui, Add, Radio, x26 y110 w180 h20 Checked%SlickTheme% vSlickTheme, Slick Theme
Gui, add, text, y145 x25, Highlight table
Gui, add, Checkbox, y145 x100 Checked%Highlight% VHighlight
Gui, Add, Radio, x126 y140 w120 h15 Checked%highlightactive% vhighlightactive, Active
Gui, Add, Radio, x126 y155 w120 h15 Checked%highlighthero% vhighlighthero, With action on hero
Gui, add, text, y185 x25, Move mouse to action buttons
Gui, add, Checkbox, y185 x220 Checked%MoveMouse% VMoveMouse
Gui, add, text, y205 x65, Move mouse from nonstars app
Gui, add, Checkbox, y205 x220 Checked%stealfocus% Vstealfocus
Gui, add, text, y235 x25, Suspend hotkey for chat/notes area
Gui, add, Checkbox, y235 x220 Checked%suspendforchat% Vsuspendforchat
Gui, Add, Radio, x26 y280 w220 h15 Checked%ActOnActiveTable% vActOnActiveTable, Send actions to active table
Gui, Add, Radio, x26 y295 w220 h15 Checked%sendundermouse% vsendundermouse, Send actions to table under mouse
Gui, add, text, y315 x25, Activate table under mouse
Gui, add, Checkbox, y315 x220 Checked%activatetableundermouse% Vactivatetableundermouse
Gui, Add, Text, x25 y350 ,Attempts to read Pot amount from screen
Gui, Add, Edit, x230 y347 w25 h20 vattempts, %attempts%

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

Gui, Tab, Global hotkeys

Gui, Add, Text, x25 y105 ,Find table needing action
Gui, Add, Edit, x220 y102 w50 h20 vfindtabletoact, %findtabletoact%
Gui, Add, Text, x25 y125 ,Activate next table
Gui, Add, Edit, x220 y122 w50 h20 vActivateBottomWindow, %ActivateBottomWindow%
Gui, Add, Text, x25 y155 ,Close all tables with hero not in a hand
Gui, Add, Edit, x220 y152 w50 h20 vCloseAllWithNoAction, %CloseAllWithNoAction%
Gui, Add, Text, x25 y55 ,Suspend all hotkeys
Gui, Add, Edit, x220 y52 w50 h20 vsuspend, %suspend%
Gui, Add, Text, x25 y75 ,Pause/unpause
Gui, Add, Edit, x220 y72 w50 h20 vTogglePause, %TogglePause%
Gui, Add, Text, x25 y185 ,Cashier
Gui, Add, Edit, x220 y182 w50 h20 vCashier, %Cashier%
Gui, Add, Text, x25 y225 ,Custom layout 1
Gui, Add, Edit, x220 y222 w50 h20 vlayout1, %layout1%
Gui, Add, Text, x25 y245 ,Custom layout 2
Gui, Add, Edit, x220 y242 w50 h20 vlayout2, %layout2%
Gui, Add, Text, x25 y265 ,Custom layout 3
Gui, Add, Edit, x220 y262 w50 h20 vlayout3, %layout3%


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

Gui, Tab, Table moving
Gui, add, text, y55 x25, Move new table
Gui, add, Checkbox, y55 x120 Checked%move% Vmove
Gui, add, text, y75 x35, to position
Gui, Add, Text, x25 y95 w120 h20 , x
Gui, Add, Edit, x50 y95 w50 h20 vxpos, %xpos%
Gui, Add, Text, x25 y115 ,y
Gui, Add, Edit, x50 y115 w50 h20 vypos, %ypos%
Gui, add, Checkbox, y145 x180 Checked%automoveback% Vautomoveback
Gui, add, text, y145 x25,Move table back automatically
Gui, Add, Text, x25 y165 ,Move table back manually
Gui, Add, Edit, x180 y162 w50 h20 vmovebackByKey, %movebackByKey%

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

Gui, Tab, Annoyances

Gui, add, Checkbox, y55 x190 Checked%Autopost% VAutopost
Gui, add, text, y55 x25,Auto post blinds
Gui, add, Checkbox, y75 x190 Checked%Waitbb% VWaitbb
Gui, add, text, y75 x25,Uncheck wait for big blind
Gui, add, Checkbox, y100 x190 Checked%CheckWhenFree% VCheckWhenFree
Gui, add, text, y100 x25,Never fold for free
Gui, add, Checkbox, y120 x250 Checked%closeOKwindow% VcloseOKwindow
Gui, add, text, y120 x25,Close PokerStars windows with just OK button
Gui, add, Checkbox, y160 x90 Checked%Buyin% VBuyin
Gui, add, text, y160 x25,Auto Buy-in
Gui, Add, Radio, x120 y150 w100 h20 Checked%max% vmax, Maximum
Gui, Add, Radio, x120 y170 w120 h20 Checked%remembered% vremembered, Remembered/default
Gui, Add, Radio, x120 y190 w20 h20 Checked%xbb% vxbb
Gui, Add, Edit, x140 y190 w30 h20 vbbmultiplier, %bbmultiplier%
Gui, Add, Text, x170 y193,BB
Gui, add, Checkbox, y220 x190 Checked%TakeSeat% VTakeSeat
Gui, add, text, y220 x25,Auto Take Seat (from waiting list)
Gui, add, Checkbox, y240 x190 Checked%AutoReservedSeat% VAutoReservedSeat
Gui, add, text, y240 x55,Auto take reserved seat
Gui, add, Checkbox, y265 x190 Checked%autoTakeSeat% VautoTakeSeat
Gui, add, text, y265 x25,Auto Seat on new table
Gui, add, Checkbox, y290 x190 Checked%leavetable% Vleavetable
Gui, add, text, y290 x25,Auto leaving table confirmation


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

Gui, Tab, Time

Gui, add, Checkbox, y50 x180 Checked%ClickImBack% VClickImBack
Gui, add, text, y50 x25,Click Im Back automatically
Gui, Add, Text, x25 y70 ,Toggle Click Im Back
Gui, Add, Edit, x180 y67 w50 h20 vToggleImBack, %ToggleImBack%
Gui, add, Checkbox, y110 x180 Checked%Timebank% VTimebank
Gui, add, text, y110 x25,Click Timebank automatically
Gui, Add, Text, x25 y150 ,Sitout on all tables
Gui, Add, Edit, x180 y147 w50 h20 vSitOutNextAll, %SitOutNextAll%
Gui, Add, Text, x25 y175 ,Remove sitout on all tables
Gui, Add, Edit, x180 y172 w50 h20 vRemoveSitout, %RemoveSitout%

Gui, Add, Text, x25 y220 ,Join waiting list on all tables
Gui, Add, Edit, x180 y217 w50 h20 vjoinwaitlist, %joinwaitlist%
Gui, Add, Text, x25 y245 ,Unjoin waiting list on all tables
Gui, Add, Edit, x180 y242 w50 h20 vunjoinwaitlist, %unjoinwaitlist%

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, %ddlist%
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, %ddlist%
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, %ddlist%
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, %ddlist%
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 w50 h15 Checked%bb1% vbb1,bb
Gui, Add, Radio, x125 y295 w50 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 w50 h15 Checked%bb2% vbb2,bb
Gui, Add, Radio, x125 y325 w50 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 w50 h15 Checked%bb3% vbb3,bb
Gui, Add, Radio, x125 y355 w50 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 w50 h15 Checked%bb4% vbb4,bb
Gui, Add, Radio, x125 y385 w50 h15 Checked%sb4% vsb4,sb
Gui, Add, Edit, x190 y372 w80 h20 valt4, %alt4%

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

Gui, Add, Button, x75 y420 w55 h20 gSave,Submit
Gui, Add, Button, x135 y420 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

gosub,getini
Gui, show, w286, %thisahk%
Return
;-----------------------------------------------------------------------------------------------------
GetIni:
IfNotExist, %thisahk%.ini
gosub, CreateIni
IniRead, ClassicTheme,%thisahk%.ini, Options, ClassicTheme,0
IniRead, HyperSimpleTheme,%thisahk%.ini, Options, HyperSimpleTheme,0
IniRead, SlickTheme,%thisahk%.ini, Options, SlickTheme,0
IniRead, BlackTheme,%thisahk%.ini, Options, BlackTheme,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, suspendforchat, %thisahk%.ini, Settings, suspendforchat, 0
IniRead, ActOnActiveTable, %thisahk%.ini, Options, ActOnActiveTable, 0
IniRead, sendundermouse, %thisahk%.ini, Options, sendundermouse, 0
IniRead, attempts, %thisahk%.ini, Variables, attempts, 0
IniRead, activatetableundermouse, %thisahk%.ini, Settings, activatetableundermouse, 0
IniRead, ActivateBottomWindow, %thisahk%.ini, Hotkeys, ActivateBottomWindow,%A_Space%
if ActivateBottomWindow
Hotkey, %ActivateBottomWindow%,ActivateBottomWindow
IniRead, findtabletoact, %thisahk%.ini, Hotkeys, findtabletoact,%A_Space%
if findtabletoact
Hotkey, %findtabletoact%,findtabletoact
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, CloseAllWithNoAction, %thisahk%.ini, Hotkeys, CloseAllWithNoAction,%A_Space%
if CloseAllWithNoAction
Hotkey, %CloseAllWithNoAction%,CloseAllWithNoAction
IniRead, Cashier, %thisahk%.ini, Hotkeys, Cashier,%A_Space%
if Cashier
Hotkey, %Cashier%,Cashier
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, ClickImBack, %thisahk%.ini, Settings, ClickImBack, 0
IniRead, Toggleimback, %thisahk%.ini, Hotkeys, Toggleimback,%A_Space%
IniRead, TakeSeat, %thisahk%.ini, Settings, TakeSeat, 0
IniRead, autoTakeSeat, %thisahk%.ini, Settings, autoTakeSeat, 0
IniRead, AutoReservedSeat, %thisahk%.ini, Settings, AutoReservedSeat, 0
IniRead, Timebank, %thisahk%.ini, Settings, Timebank, 0
IniRead, Autopost, %thisahk%.ini, Settings, Autopost, 0 
IniRead, Waitbb, %thisahk%.ini, Settings, Waitbb, 0
IniRead, CheckWhenFree, %thisahk%.ini, Settings, CheckWhenFree, 0
IniRead, checkbb, %thisahk%.ini, Settings, checkbb, 0
IniRead, uncheckbb, %thisahk%.ini, Settings, uncheckbb, 0
IniRead, closeOKwindow, %thisahk%.ini, Settings, closeOKwindow, 0
IniRead, Buyin, %thisahk%.ini, Settings, Buyin, 0
IniRead, max, %thisahk%.ini, Settings, max, 0
IniRead, remembered, %thisahk%.ini, Settings, remembered, 0
IniRead, xbb, %thisahk%.ini, Settings, xbb, 0
IniRead, bbmultiplier, %thisahk%.ini, Variables, bbmultiplier,0
IniRead, SitOutNextAll, %thisahk%.ini, Hotkeys, SitOutNextAll,%A_Space%
IniRead, RemoveSitout, %thisahk%.ini, Hotkeys, RemoveSitout,%A_Space%
IniRead, joinwaitlist, %thisahk%.ini, Hotkeys, joinwaitlist,%A_Space%
IniRead, unjoinwaitlist, %thisahk%.ini, Hotkeys, unjoinwaitlist,%A_Space%

if SitOutNextAll
Hotkey, %SitOutNextAll%,SitOutNextAll
if RemoveSitout
Hotkey, %RemoveSitout%,RemoveSitout
if joinwaitlist
Hotkey, %joinwaitlist%,joinwaitlist
if Unjoinwaitlist
Hotkey, %Unjoinwaitlist%,Unjoinwaitlist
If Toggleimback
{
HotKey, IfWinActive
Hotkey, %Toggleimback%, Toggleimback
}
IniRead, leavetable, %thisahk%.ini, Settings, leavetable,0
IniRead, move, %thisahk%.ini, Settings, move, 0
IniRead, automoveback, %thisahk%.ini, Settings, automoveback, 0
IniRead, movebackByKey, %thisahk%.ini, Hotkeys, movebackByKey,%A_Space%
IniRead, ypos, %thisahk%.ini, Variables, ypos,0
IniRead, xpos, %thisahk%.ini, Variables, xpos,0
if MoveBackByKey
Hotkey, %MoveBackByKey%,MoveBackByKey

IniRead, OpenDef, %thisahk%.ini, BetPotSettings, OpenDef
StringReplace, ddlist, ddlist, %OpenDef%, %OpenDef%|
GuiControl, , OpenDef, |%ddlist%
StringReplace, ddlist, ddlist, %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, ddlist, ddlist, %Open1%, %Open1%|
GuiControl, , Open1, |%ddlist%
StringReplace, ddlist, ddlist, %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 PokerStarsTableFrameClass
Hotkey, %pot1%,pot1
}
IniRead, Open2, %thisahk%.ini, BetPotSettings, Open2
StringReplace, ddlist, ddlist, %Open2%, %Open2%|
GuiControl, , Open2, |%ddlist%
StringReplace, ddlist, ddlist, %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 PokerStarsTableFrameClass
Hotkey, %pot2%,pot2
}
IniRead, Open3, %thisahk%.ini, BetPotSettings, Open3
StringReplace, ddlist, ddlist, %Open3%, %Open3%|
GuiControl, , Open3, |%ddlist%
StringReplace, ddlist, ddlist, %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 PokerStarsTableFrameClass
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 PokerStarsTableFrameClass
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 PokerStarsTableFrameClass
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 PokerStarsTableFrameClass
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 PokerStarsTableFrameClass
Hotkey, %alt4%,alt4
}

IniRead, autopot, %thisahk%.ini, BetPotSettings, autopot, 0
IniRead, autobet, %thisahk%.ini, BetPotSettings, autobet, 0

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 PokerStarsTableFrameClass
HotKey, IfWinActive
Hotkey, %fold%,fold
}
if call
{
;HotKey, IfWinActive, ahk_class PokerStarsTableFrameClass
HotKey, IfWinActive
Hotkey, %call%,call
}
if raise
{
;HotKey, IfWinActive, ahk_class PokerStarsTableFrameClass
HotKey, IfWinActive
Hotkey, %raise%,raise
}
if fold2any
{
;HotKey, IfWinActive, ahk_class PokerStarsTableFrameClass
HotKey, IfWinActive
Hotkey, %fold2any%,fold2any
}
Return
;-----------------------------------------------------------------------------------------------------
MakeIni:
If ClassicTheme
IniWrite, %ClassicTheme%, %thisahk%.ini, Options, ClassicTheme
If HyperSimpleTheme
IniWrite, %HyperSimpleTheme%, %thisahk%.ini, Options, HyperSimpleTheme
If SlickTheme
IniWrite, %SlickTheme%, %thisahk%.ini, Options, SlickTheme 
If BlackTheme
IniWrite, %BlackTheme%, %thisahk%.ini, Options, BlackTheme
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, %suspendforchat%, %thisahk%.ini, Settings, suspendforchat
if ActOnActiveTable
IniWrite, %ActOnActiveTable%, %thisahk%.ini, Options, ActOnActiveTable
if sendundermouse
IniWrite, %sendundermouse%, %thisahk%.ini, Options, sendundermouse
IniWrite, %activatetableundermouse%, %thisahk%.ini, Settings, activatetableundermouse
IniWrite, %attempts%, %thisahk%.ini, Variables, attempts
if ActivateBottomWindow
IniWrite, %ActivateBottomWindow%, %thisahk%.ini, Hotkeys, ActivateBottomWindow
if findtabletoact
IniWrite, %findtabletoact%, %thisahk%.ini, Hotkeys, findtabletoact
if suspend
IniWrite, %suspend%, %thisahk%.ini, Hotkeys, suspend
if TogglePause
IniWrite, %TogglePause%, %thisahk%.ini, Hotkeys, TogglePause
if CloseAllWithNoAction
IniWrite, %CloseAllWithNoAction%, %thisahk%.ini, Hotkeys, CloseAllWithNoAction
if Cashier
IniWrite, %Cashier%, %thisahk%.ini, Hotkeys, Cashier
if layout1
IniWrite, %layout1%, %thisahk%.ini, Hotkeys, layout1
if layout2
IniWrite, %layout2%, %thisahk%.ini, Hotkeys, layout2
if layout3
IniWrite, %layout3%, %thisahk%.ini, Hotkeys, layout3
IniWrite, %ClickImBack%, %thisahk%.ini, Settings, ClickImBack
IniWrite, %TakeSeat%, %thisahk%.ini, Settings, TakeSeat
IniWrite, %autoTakeSeat%, %thisahk%.ini, Settings, autoTakeSeat
IniWrite, %AutoReservedSeat%, %thisahk%.ini, Settings, AutoReservedSeat
IniWrite, %Timebank%, %thisahk%.ini, Settings, Timebank
IniWrite, %Autopost%, %thisahk%.ini, Settings, Autopost
IniWrite, %Waitbb%, %thisahk%.ini, Settings, Waitbb
IniWrite, %closeOKwindow%, %thisahk%.ini, Settings, closeOKwindow
IniWrite, %CheckWhenFree%, %thisahk%.ini, Settings, CheckWhenFree
IniWrite, %Buyin%, %thisahk%.ini, Settings, Buyin
if max
IniWrite, %max%, %thisahk%.ini, Settings, max
if remembered
IniWrite, %remembered%, %thisahk%.ini, Settings, remembered
if xbb
IniWrite, %xbb%, %thisahk%.ini, Settings, xbb
IniWrite, %bbmultiplier%, %thisahk%.ini, Variables, bbmultiplier
if SitOutNextAll
IniWrite, %SitOutNextAll%, %thisahk%.ini, Hotkeys, SitOutNextAll
if RemoveSitout
IniWrite, %RemoveSitout%, %thisahk%.ini, Hotkeys, RemoveSitout
if joinwaitlist
IniWrite, %joinwaitlist%, %thisahk%.ini, Hotkeys, joinwaitlist
if Unjoinwaitlist
IniWrite, %unjoinwaitlist%, %thisahk%.ini, Hotkeys, unjoinwaitlist
if Toggleimback
IniWrite, %Toggleimback%, %thisahk%.ini, Hotkeys, Toggleimback 
IniWrite, %leavetable%, %thisahk%.ini, Settings, leavetable
IniWrite, %move%, %thisahk%.ini, Settings, move
IniWrite, %automoveback%, %thisahk%.ini, Settings, automoveback
if moveback
IniWrite, %moveback%, %thisahk%.ini, Hotkeys, moveback
if MoveBackByKey
IniWrite, %MoveBackByKey%, %thisahk%.ini, Hotkeys, MoveBackByKey
IniWrite, %ypos%, %thisahk%.ini, Variables, ypos
IniWrite, %xpos%, %thisahk%.ini, Variables, xpos

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

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
Return
;-----------------------------------------------------------------------------------------------------
CreateIni:
HyperSimpleTheme:=1
ClassicTheme:=0
SlickTheme:=0
BlackTheme:=0
Highlight:=0
highlightactive:=1
highlighthero:=0
MoveMouse:=0
stealfocus:=1
ActOnActiveTable:=1
sendundermouse:=0
activatetableundermouse:=0
attempts:=1
suspendforchat:=0
TakeSeat:=0
autoTakeSeat:=0
AutoReservedSeat:=0
Timebank:=0
Autopost:=0
Waitbb:=0
closeOKwindow:=1
CheckWhenFree:=1
Buyin:=0
remembered:=1
bbmultiplier:=50
ClickImBack:=0
leavetable:=0
move:=0
automoveback:=0
xpos:=100
ypos:=100
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
bb2:=1
sb3:=1
sb4:=1
alt1=wheelup
alt2=wheeldown
alt3=^wheelup
alt4=^wheeldown
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
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
return
;-----------------------------------------------------------------------------------------------------
Edit:
edit
return
;-----------------------------------------------------------------------------------------------------
donation:
WinMenuSelectItem, PokerStars Lobby,, Requests, Transfer Funds...
WinWait, Transfer Funds ahk_class #32770, , 10
WinGet, tf, id
ControlFocus, Edit2, ahk_id%tf%
ControlSetText, Edit2, Max1mums
ControlFocus, Edit1, ahk_id%tf%
Sleep, -1
ControlSetText, Edit1,
GuiControl, Disable, Donate
return
;-----------------------------------------------------------------------------------------------------
exitSub:
;FileDelete, %thisahk%.ini
;gosub, makeini
exitApp
return
;-----------------------------------------------------------------------------------------------------
StarsPics (needed for BetPot function only) can be found here: http://depositfiles.com/en/files/cgcmiearw
Don't forget to choose correct table theme on General tab.
Max1mums is offline   Reply With Quote
Old 01-10-2010, 05:06 PM   #125
Max1mums
old hand
 
Join Date: Aug 2009
Location: From Russia with code
Posts: 1,672
Re: StarsCash - free script for PokerStars containing all functions cash player may need.

Vista/Windows 7 users, don't forget to run script as admin (installing autohotkey program as admin is easiest), have in mind that turning aero theme off may fasten things up greatly!
Max1mums is offline   Reply With Quote

Reply
      

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Forum Jump


All times are GMT -4. The time now is 08:58 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright 2008-2017, Two Plus Two Interactive
 
 
Poker Players - Streaming Live Online