Open Side Menu Go to the Top
Register
StarsAssistant mod with dual monitor slider like MTH StarsAssistant mod with dual monitor slider like MTH

05-05-2008 , 04:35 AM
basically if you want to have all your tables on one monitor, and then the table that needs action will slide over to your other monitor, and then once you act it will go back. so you can have a bunch of tiny tables on secondary monitor, then the table that needs action goes to your primary monitor and maximizes itself, then once you act it goes back to it's place on secondary monitor in it's orignal tiny size.

only thing hardcoded is that primary monitor must be the one with (0,0) coordinates in upper left hand corner. if you need to change change this:

RestoreID := id ;brad
x :=0 ;brad
y :=0 ;brad
DetectHiddenWindows, on ; brad

also all my changes are on lines with " ;brad" , excpet for a couple makegui function calls where i passed an extra slider variable.

also on an unrelated note, i had thought that the "detect all-in/fixed limit" thingee checkbox didn't work, but it does work for me, it's just that you can't have the "activate urgent table" checkbox checked or it will screw up for some reason. Also i tested my "Slider" checkbox with the "acrtivate urgent table " checkbox unchecked, so keep it unchecked i guess is my point.

Code:
----------------------------------------------------------------
; #### StarsAssistant ####

; AHK version: 1.0.46.05
; date: January 05,2008
  version := "0.88"
; author: Chris228 @ 2p2 forums
; thx to _dave_, JBOPoker, Roland, JukofYork & pusteblume

; based on

; #### StarsUrgentTable ####

; AHK version: 1.0.46.03
; date: May 24,2007
; version: 0.75a
; author: _dave_ @ 2p2 forums
; revised by: JBOPoker @ earthlink.net
; thx to Roland & JukofYork for some of the functions


;=====================================================================
;=================== Settings ========================================
;=====================================================================

; Hotkeys see below

; Border of the "Highlighter"
border_colour := "ffff00"
border_size := 8
trans := 255

; Timings for the "Time Bank Clicker" [fast/turbo 8/17; normal 20/35; both 8/35] (10/13 old settings)
timebank_min := 10
timebank_max := 13

; Beep on urgent table
beep := 0

; Position of the mouse in perc of the table window
x_mouse := 0.50
y_mouse := 0.75

; Don't edit below unless you know what you do (except Hotkeys)

; Gui Settings
settings() {
  global
  ini:="StarsAssistant.ini"
  iniRead, AutoOn, %ini%, Prefs, AutoOn, 1
  iniRead, Slider, %ini%, Prefs, Slider, 1 ;brad
  iniRead, Highlight, %ini%, Prefs, Highlight, 1
  iniRead, MoveMouse, %ini%, Prefs, MoveMouse, 1
  iniRead, TimeBankClicker, %ini%, Prefs, TimeBankClicker, 1
  iniRead, AlternateDetection, %ini%, Prefs, AlternateDetection, 0
  iniRead, ActivateUrgent, %ini%, Prefs, ActivateUrgent, 0
  iniRead, KillPopups, %ini%, Prefs, KillPopups, 0
  iniRead, SafeReg, %ini%, Prefs, SafeReg, 1
  iniRead, AutoTakeSeat, %ini%, Prefs, AutoTakeSeat, 0
}

; Intervalls for sub execution
RefreshQueue_timer := 333
RefreshLobby_timer := 1000
PopUpWatcher_timer := 200
TableColor_timer := 500

;=====================================================================
;=================== Autoexec ========================================
;=====================================================================

#NoEnv
#SingleInstance, Force
#Include %a_scriptDir%
SendMode Input

SetTitleMatchMode, 2

SetWorkingDir %a_scriptDir%
OnExit exitSub

settings()
TrayMenu()
BuildGui()

Suspend, On

SysGet, border, 32
SysGet, caption, 4

if ( AutoOn = 1 ) {
  Gosub, ButtonOn
}

return


;=====================================================================
;=================== Hotkeys =========================================
;=====================================================================

^a::
  ToggleCheckbox("MoveMouse")
return

^w::
  ToggleCheckbox("AlternateDetection")
return

^s::
  MaxMinLobby(LobbyID)
return

^d::
  MinMaxStarsAssistant()
return

^z::
  RegSNG(LobbyID)
  OpenJoinUnJoinTable(LobbyID)
return

^e::
  CloseTournamentLobby(LobbyID, LobbyPID)
return

MButton::
  RegSNG(LobbyID)
  OpenJoinUnJoinTable(LobbyID)
return

;=====================================================================
;=================== Gui =============================================
;=====================================================================

trayMenu() {
  global
  Menu, Tray, Standard
  Menu, Tray, Add, &Show, Show
  Menu, Tray, default, &Show
  Menu, Tray, Add
  Menu, Tray, Add, &About, About
  Menu, Tray, Add, &Help, Help
  Menu, Tray, Add
  Menu, Tray, Add, E&xit, Exit
  Menu, Tray, Tip, StarsAssistant v%version%
}

buildGui() {
  global
  Gui 1:Default
  Gui, +toolwindow +AlwaysOnTop
  Gui, Margin, 5, 5
  Gui, Font,, Verdena
  Gui, Add, Button, vOn section w56 h20 center, &On
  Gui, Add, Button, vOff disabled w56 h20 ys xs+56 center, &Off
  Gui, Add, Checkbox, checked%AutoOn% vAutoOn gSubmit xs+2, &Auto on
  Gui, Add, Text, section x7 0x1000 w110 h2
  Gui, Add, Checkbox, checked%Slider% vSlider gSubmit xs, &Slider ;brad
  Gui, Add, Checkbox, checked%Highlight% vHighlight gSubmit xs, &Highlight table
  Gui, Add, Checkbox, checked%MoveMouse% vMoveMouse gSubmit xs, &Move mouse
  Gui, Add, Checkbox, checked%TimeBankClicker% vTimeBankClicker gSubmit xs, &Click time bank
  Gui, Add, Checkbox, checked%AlternateDetection% vAlternateDetection gSubmit xs, &Detect All-in/Fixed l.
  Gui, Add, Checkbox, checked%ActivateUrgent% vActivateUrgent gSubmit xs, &Activate urgent table
  Gui, Add, Checkbox, checked%KillPopups% vKillPopups gSubmit xs, &Kill popups
  Gui, Add, Checkbox, checked%SafeReg% vSafeReg gSubmit xs, &Safe SNG regist.
  Gui, Add, Checkbox, checked%AutoTakeSeat% vAutoTakeSeat gSubmit xs, &Auto take seat  
  IniRead, x, % ini, Gui, x, center
  IniRead, y, % ini, Gui, y, center
  Gui, Show, x%x% y%y% w124, StarsAssistant
}

Show:
  Gui, 1:Show
return

About:
  Msgbox,, StarsAssistant, StarsAssistant v%version% `nAuthor: Chris228 @ 2+2 formus`nE-Mail: chris228@gmx.de`nSee file for further credits`n`nIf you like my program I would be happy about a donation.`nMy screenname on PokerStars is 'mr.cray'.`nThank you!
return

Help:
  Run % web() "http://overcards.com/wiki/moin.cgi/StarsAssistant"
return

web() { ; by Titan, modified by Roland
  regRead, p, HKCR, HTTP\shell\open\command
  return SubStr(p, 1, InStr(p, ".exe")+4)
}

Exit:
exitApp

GuiClose:
  Gui 1:Cancel 
return

Submit:
  Gui, 1:Submit, NoHide
return

exitSub:
  Gui 1:Default
  Gui, Submit
  Gui +lastfound
  WinGetPos, x, y
  IniWrite, % x, % ini, Gui, x
  IniWrite, % y, % ini, Gui, y
  IniWrite, % AutoOn, % ini, Prefs, AutoOn
  IniWrite, % Slider, % ini, Prefs, Slider ;brad
  IniWrite, % Highlight, % ini, Prefs, Highlight
  IniWrite, % MoveMouse, % ini, Prefs, MoveMouse
  IniWrite, % TimeBankClicker, % ini, Prefs, TimeBankClicker
  IniWrite, % AlternateDetection, % ini, Prefs, AlternateDetection
  IniWrite, % ActivateUrgent, % ini, Prefs, ActivateUrgent
  IniWrite, % KillPopups, % ini, Prefs, KillPopups
  IniWrite, % SafeReg, % ini, Prefs, SafeReg
  IniWrite, % AutoTakeSeat, % ini, Prefs, AutoTakeSeat  
exitApp

MinMaxStarsAssistant() {
  WinGetActiveTitle, title
  If ( title = "StarsAssistant" )
    Gui 1:Cancel 
  else
    Gui, 1:Show
}

ToggleCheckbox(box) {
  Gui 1:Default
  GuiControlGet, state, , %box%
  if ( state = 1 )
    GuiControl, , %box%, 0
  if ( state = 0 )
    GuiControl, , %box%, 1
  Gui, 1:Submit, NoHide
}

;=====================================================================
;=================== Buttons =========================================
;=====================================================================

ButtonOn:
  tablecolor:= ""
  last_table_id := ""
  tablequeue := ""
  most_urgent_table := ""
  GoSub, RefreshLobby
  GoSub, TableColor
  SetTimer, RefreshQueue, %RefreshQueue_timer%
  SetTimer, PopUpWatcher, %PopUpWatcher_timer%
  SetTimer, RefreshLobby, %RefreshLobby_timer%
  Suspend, Off
  GuiControl, 1:Disable, On
  GuiControl, 1:Enable, Off
return
  
ButtonOff:
  SetTimer, RefreshQueue, Off
  SetTimer, PopUpWatcher, Off
  SetTimer, RefreshLobby, Off
  SetTimer, TableColor, Off
  Gui, 2: Cancel
  Gui, 3: Cancel
  Gui, 4: Cancel
  Gui, 5: Cancel
  tablecolor:=""
  Suspend, On
  GuiControl, 1:Disable, Off
  GuiControl, 1:Enable, On
return


;=====================================================================
;=================== Urgent Table Functions ==========================
;=====================================================================

RefreshQueue:
  ids := TableIDListStars(LobbyPID)
  Loop, Parse, tablequeue, `,
  {
    StringTrimLeft, this_id, A_LoopField, InStr(A_LoopField, "_")
    if (!InStr(ids, this_id))
    {
      StringReplace, tablequeue, tablequeue, %A_LoopField%, , All
    }
  }
  Loop, Parse, ids, `,
  {
    ControlGet, v, Visible, , PokerStarsSliderEditorClass1, ahk_id%A_LoopField%
    if ( v = 1 )
    {  
      if (!InStr(tablequeue, A_LoopField))
      {
        DllCall("QueryPerformanceCounter", "Int64 *", CurrentQPC)
        tablequeue := tablequeue . "," . CurrentQPC . "-" . A_TickCount . "_" . A_LoopField
      }
    }
    else
    {
      if ( AlternateDetection = 1 ) {
        color:=TableColor(A_LoopField)
        if ( color != tablecolor && tablecolor != "" ) {
          if (!InStr(tablequeue, A_LoopField))
          {
            DllCall("QueryPerformanceCounter", "Int64 *", CurrentQPC)
            tablequeue := tablequeue . "," . CurrentQPC . "-" . A_TickCount . "_" . A_LoopField
          }
        }
        else {        
          if (InStr(tablequeue, A_LoopField))
          {
            StringReplace, tablequeue, tablequeue, %A_LoopField%, , All
          }
        } 
      } 
      else {
        if (InStr(tablequeue, A_LoopField))
        {
          StringReplace, tablequeue, tablequeue, %A_LoopField%, , All
        }
      }
    }
  }
  tmp := ""
  Loop, Parse, tablequeue, `,
  {
    if (InStr(A_LoopField, "0x"))
    {
      tmp := tmp . "," . A_LoopField 
    }
  }
  Sort, tmp, N D`,
  tablequeue := CleanList(tmp)
  most_urgent_table := ""
  Loop, Parse, tablequeue, `,
  {
    StringTrimLeft, most_urgent_table, A_LoopField, InStr(A_LoopField, "_")
    break
  }
  if ( TimeBankClicker = 1 ) {
    tc := A_TickCount
    Loop, Parse, tablequeue, `,
    {
      StringTrimLeft, waiting_time, A_LoopField, InStr(A_LoopField, "-")
      StringTrimRight, waiting_time, waiting_time, ( StrLen(waiting_time) - (InStr(waiting_time, "_")-1) )
      waiting_time := (tc - waiting_time) / 1000
      if (waiting_time > timebank_min && waiting_time < timebank_max)
      {
        StringTrimLeft, waiting_table, A_LoopField, InStr(A_LoopField, "_")
        timebank_x := 560  ; lastmax 565
        timebank_y := 430  ; lastmax 430 +/-10 too much
        relStarsClientPoint(waiting_table, timebank_x, timebank_y)
        PostLeftClick(timebank_x, timebank_y, waiting_table, 0)
      }  

if (waiting_time > timebank_max+5) ;18)
    {

      SoundPlay, timebankclick.wav ;brad
    }
    
    }
  }
  if ( ActivateUrgent = 1 ) {
    WinActivate, ahk_id%most_urgent_table%
    if ( AlternateDetection = 1 ) {
      color:=TableColor(most_urgent_table)
      if ( color != tablecolor ) {
        if ( Slider = 1 || Highlight = 1 || MoveMouse = 1)
        makegui(most_urgent_table, Slider, Highlight, MoveMouse, beep, x_mouse, y_mouse)
      }
    }
    else {
      if ( Slider = 1 || Highlight = 1 || MoveMouse = 1)
      makegui(most_urgent_table, Slider, Highlight, MoveMouse, beep, x_mouse, y_mouse)
    }
  }
  else {
    if ( Slider = 1 || Highlight = 1 || MoveMouse = 1)
    makegui(most_urgent_table,Slider,  Highlight, MoveMouse, beep, x_mouse, y_mouse)
  }
return



;makegui(id="", Highlight=1, MoveMouse=1, beep=0, x_mouse=0.75, y_mouse=0.75 ) {
makegui(id="", Slider =1, Highlight=1, MoveMouse=1, beep=0, x_mouse=0.75, y_mouse=0.75 ) {   ;brad
  global last_table_id
  global border_colour
  global border_size
  global trans
  global Xcoord ;brad
  global Ycoord ;brad
  global RestoreID ; brad
  global ActiveWindow ;brad
  if (id != last_table_id)
  {
       if (!RestoreID)   	;brad
           { 			;brad
               goto UGLY 	;brad
           }			;brad
DetectHiddenWindows, on ;brad
      WinHide, ahk_id %RestoreID% ;brad
      ;WinRestore , ahk_id %RestoreID% ;brad
      ;PostMessage, 0x112, 0xF120,,, ahk_id %RestoreID%, ;brad
      ;WinMaximize , ahk_id %RestoreID% ;brad
      PostMessage, 0x112, 0xF030,,, ahk_id %RestoreID%, ;brad
      Sleep, 0 ; brad
      WinMove, ahk_id %RestoreID%,, Xcoord, Ycoord,  ; brad
      WinShow, ahk_id %RestoreID% ;brad
      WinActivate, ahk_id %ActiveWindow% ;brad
      RestoreID :=0
DetectHiddenWindows, off ;brad
UGLY:
    last_table_id := id
    
    if(!id) ; if (id=0 or id="") 
    {
      Gui, 2: Cancel
      Gui, 3: Cancel
      Gui, 4: Cancel
      Gui, 5: Cancel
      return
    }
  
    WinGetPos, x, y, w, h, ahk_id%id%
    if (Slider = 1)	;brad
      {			;brad
    	Xcoord :=x ;brad
    	Ycoord :=y ;brad
    	RestoreID := id ;brad  
    	x :=0 ;brad	
    	y :=0 ;brad	
	DetectHiddenWindows, on ; brad
    	WinHide, ahk_id %id% ;brad
    	WinMove,ahk_id %id%,, x, y ;brad	
    	;WinMaximize , ahk_id %id% ;brad
    	PostMessage, 0x112, 0xF030,,, ahk_id %id%, ;brad
    	Sleep, 0 ; brad
    	;WinShow, ahk_id %id% ;brad
	WinGet, ActiveWindow, ID, A ;brad
    	WinActivate, ahk_id %id% ;brad
	DetectHiddenWindows, off ; brad
      }	;brad

    WinGetPos, x, y, w, h, ahk_id%id% 	
    global border
    global caption
    x := x + border
    y := y + border + caption
    w := w - (2*border)
    h := h - (2*border) - caption
    

    ;Makes Border around urgent table
    if ( Highlight = 1 ) {
    ;if ( Highlight = 999 ) { ; brad
      ;top
      guinum := 2
      Gui, %guinum%: +Alwaysontop +Lastfound +Owner
      Gui, %guinum%: Color, %border_colour%
      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_colour%
      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_colour%
      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_colour%
      WinSet, Transparent, %trans%
      Gui, %guinum%: -Caption
      x2 := x + w - border_size
      Gui, %guinum%: Show, w%border_size% h%h% x%x2% y%y% NoActivate
    
    }
        
    ;Puts mouse pointer nearer the bet buttons
    if ( MoveMouse = 1) {
      x3 := x + (w * x_mouse)
      y3 := y + (h * y_mouse)
      Coordmode, Mouse, Screen
      MouseMove, x3, y3, 0
    }
    
    ;Beeps on urgent table
    if ( beep = 1 )
      SoundBeep, 750, 100
      ;SoundPlay, timebankclick.wav ;brad
  }
}

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


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%
PostMessage, 0x201, 0x0001, ((y<<16)^x), %control_class%, ahk_id%table_id%
PostMessage, 0x202 , 0, ((y<<16)^x), %control_class%, ahk_id%table_id%
}

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

TableColor(id) {
  CoordMode, Pixel, Screen
  WinGetPos, x, y, w, h, ahk_id%id%
  rw := 800
  rh := 578
  x := x+475
  y := y+555
  x := Floor( (x / rw ) * w )
  y := Floor( (y / rh) * h  )
  PixelGetColor, color, %x%, %y%, RGB
  return color
}

TableColor:
  tableids := TableIDListStars(LobbyPID)
  Loop, Parse, tableids, `,
  {
    ControlGet, v, Visible, , PokerStarsSliderEditorClass1, ahk_id%A_LoopField%
    if ( v != 1 ) {
      WinActivate, ahk_id%a_loopfield%
      sleep, 500
      tablecolor:=TableColor(a_loopfield)
      break
    }      
  }
  if ( tablecolor != "" )
    SetTimer, TableColor, Off
  else
    SetTimer, TableColor, %TableColor_timer%
return


;=====================================================================
;=================== SNG Registration Functions ======================
;=====================================================================

RegSNG(id) {
  if ( SafeReg = 1 ) {
    IfWinActive, ahk_id%id%
      RegSNGexec(id)
  }
  else {
    RegSNGexec(id)
  }
}

RegSNGexec(id) {
  ControlGet, v, Visible, , PokerStarsButtonClass6, ahk_id%id%
  if ( v = 1 ) {
    ControlClick, PokerStarsButtonClass6, ahk_id%id%
    WinWait, Tournament Registration ahk_class #32770, , 10
    {
      WinGet, regid, id
      ControlFocus, Button1, ahk_id%regid%
      Sleep, -1
      ControlSend, Button1, {SPACE}, ahk_id%regid%
      sleep, 10
      ControlFocus, Button2, ahk_id%regid%
      Sleep, -1
      ControlSend, Button2, {SPACE}, ahk_id%regid%  
    }
    WinWait, Tournament Registration ahk_class #32770, , 10
    {
      WinGet, regid, id           
      ControlGetText, ctext, Button1, ahk_id%regid%
      if ( cText = "OK" ) {
        ControlFocus, Button1, ahk_id%regid%
        Sleep, -1
        ControlSend, Button1, {SPACE}, ahk_id%regid%
      }        
    }
  }
}


CloseTournamentLobby(id, pid) {
  Loop {
    IfWinExist, Lobby ahk_pid%pid%,, PokerStars Lobby
      WinClose
    else
      break
  }
  Sleep, 100
  WinGet, state, MinMax, ahk_id%id%
  if ( state = 1 || state = 0 )
    WinMinimize, ahk_id%id%
}


;=====================================================================
;=================== Join Cashgame Functions =========================
;=====================================================================


OpenJoinUnJoinTable(id) {
  ControlGet, v, Visible, , PokerStarsButtonClass3, ahk_id%id%
  if ( v = 1 ) {
    ControlClick, PokerStarsButtonClass3, ahk_id%id%
    WinWait, Waiting List ahk_class #32770, , 10
    {
      WinGet, joinid, id
      ControlFocus, Button1, ahk_id%joinid%
      Sleep, -1
      ControlSend, Button1, {SPACE}, ahk_id%joinid%
    }
  }
  else {
    ControlGet, v, Visible, , PokerStarsButtonClass2, ahk_id%id%
    if ( v = 1 ) {
      ControlClick, PokerStarsButtonClass2, ahk_id%id%
    }
    else {
      ControlGet, v, Visible, , PokerStarsButtonClass8, ahk_id%id%
      if ( v = 1 ) {
        ControlClick, PokerStarsButtonClass8, ahk_id%id%
      } 
    }
  }
}


;=====================================================================
;=================== Popup Functions =================================
;=====================================================================

PopUpWatcher:
  If ( KillPopups = 1 )
    KillPopUps(LobbyPID)
  if ( AutoTakeSeat = 1 )
    TakeSeat(LobbyPID)
return

KillPopUps(pid) {
  IfWinExist, PokerStars ahk_class #32770 ahk_pid%pid%
  {
    WinGet, list1, list, PokerStars ahk_class #32770 ahk_pid%pid%, , Lobby
    Loop, %list1%
    {
      This_id := list1%A_Index%
      WinGet, list2, ControlList, ahk_id%this_id%
      if (InStr(list2, "Button2"))  {
        continue
      }
      else {
        Loop, 20
        {
          ControlFocus, Button1, ahk_id%this_id%
          Sleep, -1
          ControlSend, Button1, {SPACE}, ahk_id%this_id%
          Sleep, 100
          IfWinNotExist, ahk_id%this_id%
          {
            break
          }
        }
      }
    }
  }
}

TakeSeat(pid) {
  IfWinExist, PokerStars ahk_class #32770 ahk_pid%pid%
  {
    WinGet, list, list, Seat Available ahk_class #32770 ahk_pid%pid%
    Loop, %list%
    {
      This_id := list%A_Index%
      ControlFocus, Button1, ahk_id%this_id%
       Sleep, -1
      ControlSend, Button1, {SPACE}, ahk_id%this_id%
    }
  }
}


;=====================================================================
;=================== Lobby & Tables Functions ========================
;=====================================================================

RefreshLobby:
  WinGet, LobbyID, id, PokerStars Lobby
  WinGet, LobbyPID, PID, ahk_id%LobbyID%
return

MaxMinLobby(id) {
  WinGetActiveTitle, title
  IfInString, title, PokerStars Lobby
  {
    WinMinimize,ahk_id%id%
  }
  else {
    WinActivate, ahk_id%id%
  }
} 

TableIDListStars(pid)
{
  WinGet, list, list, / ahk_pid%pid%, , Lobby
  Loop %list%
  {
    this_id := list%a_index%
    If (this_id != id)
    {
      ids = %ids%,%this_id%
    }
  }
  StringTrimLeft, ids, ids, 1
  return ids
}

Last edited by _dave_; 05-05-2008 at 10:36 PM. Reason: added code tags
StarsAssistant mod with dual monitor slider like MTH Quote
05-05-2008 , 08:32 AM
played some sngs with it and the detectallin worked with 4 tables but with 9 tables (small tables) it kept messing up. any fixes?

also it's kinda jury rigged so like if you don't want the slider table to be maximized then be sure to uncomment the Winshow line , and also you may want to comment out the ActiveTable stuff, that might mess it up a bit. the active table couple lines was just so if you are writing on firefox or whatever the slider window when it goes back will return focus to firefox, cause it grabs focus so it pops up. obviously when i was working on it I was working on someting else at the same time, but I think it may be FPS.

Last edited by PLOlover; 05-05-2008 at 08:35 AM. Reason: active table explanation
StarsAssistant mod with dual monitor slider like MTH Quote
05-05-2008 , 07:00 PM
ok I think i have "fixed" the detect all in thingee.

in the tablecolor() function,here is the algorithm to find theh x coordinate. rw is standard window width (800) and w is actual window width (if resized).

x := x+475
x := Floor( (x / rw ) * w )

now take a double window (I don't think ps let's you actually double but just for ease of work) that is 1600 wide. let's say you're using a 204b or whatever and it is on the left and the window is all the way left and up. so we're looking at x coord of -1600.

plugins
x is -1600 +475 = -1125
x is equal to drop remainder of -1125/800 *1600 = -2250.

so it gives a bad value as farthest left x is -1600.

function should be changed to
-------------------------------------------------
TableColor(id) {
CoordMode, Pixel, Screen
WinGetPos, x, y, w, h, ahk_id%id%
rw := 800
rh := 578
x := Floor( x + ( (475* w) / rw ) ) ;brad
y := Floor( y + ( (555* h) / rh ) ) ;brad

PixelGetColor, color, %x%, %y%, RGB
;tooltip %x% %y% %color%
return color
}
--------------------------------------
plugins for x using news
x := Floor( -1600 + ( (475* 1600) / 800 ) )
drop remainder(-1600 +950)= -650
quick commonsense check tells us that -650 is about 2/3rds of the way over on the screen which is about right.

I'm gonna play some sng sets later so I will post complete ahk modded script later.
StarsAssistant mod with dual monitor slider like MTH Quote
05-05-2008 , 07:11 PM
You should really use the code tags,

Code:
Like this!!!!

so its easier for people to copy/paste. Perhaps if you pm _dave_ he can put your OP into code tags. It also makes the thread much easier to navigate, instead of having all that code posted at length.
StarsAssistant mod with dual monitor slider like MTH Quote
05-05-2008 , 09:53 PM
k i played a set of sngs and everything worked aok. no problems whatsoever. detect allin worked and everythingee.

------------------------

Code:
; #### StarsAssistant ####

; AHK version: 1.0.46.05
; date: January 05,2008
  version := "0.88"
; author: Chris228 @ 2p2 forums
; thx to _dave_, JBOPoker, Roland, JukofYork & pusteblume

; based on

; #### StarsUrgentTable ####

; AHK version: 1.0.46.03
; date: May 24,2007
; version: 0.75a
; author: _dave_ @ 2p2 forums
; revised by: JBOPoker @ earthlink.net
; thx to Roland & JukofYork for some of the functions


;=====================================================================
;=================== Settings ========================================
;=====================================================================

; Hotkeys see below

; Border of the "Highlighter"
border_colour := "ffff00"
border_size := 8
trans := 255

; Timings for the "Time Bank Clicker" [fast/turbo 8/17; normal 20/35; both 8/35] (10/13 old settings)
timebank_min := 10
timebank_max := 13

; Beep on urgent table
beep := 0

; Position of the mouse in perc of the table window
x_mouse := 0.50
y_mouse := 0.75

; Don't edit below unless you know what you do (except Hotkeys)

; Gui Settings
settings() {
  global
  ini:="StarsAssistant.ini"
  iniRead, AutoOn, %ini%, Prefs, AutoOn, 1
  iniRead, Slider, %ini%, Prefs, Slider, 1 ;brad
  iniRead, Highlight, %ini%, Prefs, Highlight, 1
  iniRead, MoveMouse, %ini%, Prefs, MoveMouse, 1
  iniRead, TimeBankClicker, %ini%, Prefs, TimeBankClicker, 1
  iniRead, AlternateDetection, %ini%, Prefs, AlternateDetection, 0
  iniRead, ActivateUrgent, %ini%, Prefs, ActivateUrgent, 0
  iniRead, KillPopups, %ini%, Prefs, KillPopups, 0
  iniRead, SafeReg, %ini%, Prefs, SafeReg, 1
  iniRead, AutoTakeSeat, %ini%, Prefs, AutoTakeSeat, 0
}

; Intervalls for sub execution
RefreshQueue_timer := 333
RefreshLobby_timer := 1000
PopUpWatcher_timer := 200
TableColor_timer := 500

;=====================================================================
;=================== Autoexec ========================================
;=====================================================================

#NoEnv
#SingleInstance, Force
#Include %a_scriptDir%
SendMode Input

SetTitleMatchMode, 2

SetWorkingDir %a_scriptDir%
OnExit exitSub

settings()
TrayMenu()
BuildGui()

Suspend, On

SysGet, border, 32
SysGet, caption, 4

if ( AutoOn = 1 ) {
  Gosub, ButtonOn
}

return


;=====================================================================
;=================== Hotkeys =========================================
;=====================================================================

^a::
  ToggleCheckbox("MoveMouse")
return

^w::
  ToggleCheckbox("AlternateDetection")
return

^s::
  MaxMinLobby(LobbyID)
return

^d::
  MinMaxStarsAssistant()
return

^z::
  RegSNG(LobbyID)
  OpenJoinUnJoinTable(LobbyID)
return

^e::
  CloseTournamentLobby(LobbyID, LobbyPID)
return

MButton::
  RegSNG(LobbyID)
  OpenJoinUnJoinTable(LobbyID)
return

;=====================================================================
;=================== Gui =============================================
;=====================================================================

trayMenu() {
  global
  Menu, Tray, Standard
  Menu, Tray, Add, &Show, Show
  Menu, Tray, default, &Show
  Menu, Tray, Add
  Menu, Tray, Add, &About, About
  Menu, Tray, Add, &Help, Help
  Menu, Tray, Add
  Menu, Tray, Add, E&xit, Exit
  Menu, Tray, Tip, StarsAssistant v%version%
}

buildGui() {
  global
  Gui 1:Default
  Gui, +toolwindow +AlwaysOnTop
  Gui, Margin, 5, 5
  Gui, Font,, Verdena
  Gui, Add, Button, vOn section w56 h20 center, &On
  Gui, Add, Button, vOff disabled w56 h20 ys xs+56 center, &Off
  Gui, Add, Checkbox, checked%AutoOn% vAutoOn gSubmit xs+2, &Auto on
  Gui, Add, Text, section x7 0x1000 w110 h2
  Gui, Add, Checkbox, checked%Slider% vSlider gSubmit xs, &Slider ;brad
  Gui, Add, Checkbox, checked%Highlight% vHighlight gSubmit xs, &Highlight table
  Gui, Add, Checkbox, checked%MoveMouse% vMoveMouse gSubmit xs, &Move mouse
  Gui, Add, Checkbox, checked%TimeBankClicker% vTimeBankClicker gSubmit xs, &Click time bank
  Gui, Add, Checkbox, checked%AlternateDetection% vAlternateDetection gSubmit xs, &Detect All-in/Fixed l.
  Gui, Add, Checkbox, checked%ActivateUrgent% vActivateUrgent gSubmit xs, &Activate urgent table
  Gui, Add, Checkbox, checked%KillPopups% vKillPopups gSubmit xs, &Kill popups
  Gui, Add, Checkbox, checked%SafeReg% vSafeReg gSubmit xs, &Safe SNG regist.
  Gui, Add, Checkbox, checked%AutoTakeSeat% vAutoTakeSeat gSubmit xs, &Auto take seat  
  IniRead, x, % ini, Gui, x, center
  IniRead, y, % ini, Gui, y, center
  Gui, Show, x%x% y%y% w124, StarsAssistant
}

Show:
  Gui, 1:Show
return

About:
  Msgbox,, StarsAssistant, StarsAssistant v%version% `nAuthor: Chris228 @ 2+2 formus`nE-Mail: chris228@gmx.de`nSee file for further credits`n`nIf you like my program I would be happy about a donation.`nMy screenname on PokerStars is 'mr.cray'.`nThank you!
return

Help:
  Run % web() "http://overcards.com/wiki/moin.cgi/StarsAssistant"
return

web() { ; by Titan, modified by Roland
  regRead, p, HKCR, HTTP\shell\open\command
  return SubStr(p, 1, InStr(p, ".exe")+4)
}

Exit:
exitApp

GuiClose:
  Gui 1:Cancel 
return

Submit:
  Gui, 1:Submit, NoHide
return

exitSub:
  Gui 1:Default
  Gui, Submit
  Gui +lastfound
  WinGetPos, x, y
  IniWrite, % x, % ini, Gui, x
  IniWrite, % y, % ini, Gui, y
  IniWrite, % AutoOn, % ini, Prefs, AutoOn
  IniWrite, % Slider, % ini, Prefs, Slider ;brad
  IniWrite, % Highlight, % ini, Prefs, Highlight
  IniWrite, % MoveMouse, % ini, Prefs, MoveMouse
  IniWrite, % TimeBankClicker, % ini, Prefs, TimeBankClicker
  IniWrite, % AlternateDetection, % ini, Prefs, AlternateDetection
  IniWrite, % ActivateUrgent, % ini, Prefs, ActivateUrgent
  IniWrite, % KillPopups, % ini, Prefs, KillPopups
  IniWrite, % SafeReg, % ini, Prefs, SafeReg
  IniWrite, % AutoTakeSeat, % ini, Prefs, AutoTakeSeat  
exitApp

MinMaxStarsAssistant() {
  WinGetActiveTitle, title
  If ( title = "StarsAssistant" )
    Gui 1:Cancel 
  else
    Gui, 1:Show
}

ToggleCheckbox(box) {
  Gui 1:Default
  GuiControlGet, state, , %box%
  if ( state = 1 )
    GuiControl, , %box%, 0
  if ( state = 0 )
    GuiControl, , %box%, 1
  Gui, 1:Submit, NoHide
}

;=====================================================================
;=================== Buttons =========================================
;=====================================================================

ButtonOn:
  tablecolor:= ""
  last_table_id := ""
  tablequeue := ""
  most_urgent_table := ""
  GoSub, RefreshLobby
  GoSub, TableColor
  SetTimer, RefreshQueue, %RefreshQueue_timer%
  SetTimer, PopUpWatcher, %PopUpWatcher_timer%
  SetTimer, RefreshLobby, %RefreshLobby_timer%
  Suspend, Off
  GuiControl, 1:Disable, On
  GuiControl, 1:Enable, Off
return
  
ButtonOff:
  SetTimer, RefreshQueue, Off
  SetTimer, PopUpWatcher, Off
  SetTimer, RefreshLobby, Off
  SetTimer, TableColor, Off
  Gui, 2: Cancel
  Gui, 3: Cancel
  Gui, 4: Cancel
  Gui, 5: Cancel
  tablecolor:=""
  Suspend, On
  GuiControl, 1:Disable, Off
  GuiControl, 1:Enable, On
return


;=====================================================================
;=================== Urgent Table Functions ==========================
;=====================================================================

RefreshQueue:
  ids := TableIDListStars(LobbyPID)
  Loop, Parse, tablequeue, `,
  {
    StringTrimLeft, this_id, A_LoopField, InStr(A_LoopField, "_")
    if (!InStr(ids, this_id))
    {
      StringReplace, tablequeue, tablequeue, %A_LoopField%, , All
    }
  }
  Loop, Parse, ids, `,
  {
    ControlGet, v, Visible, , PokerStarsSliderEditorClass1, ahk_id%A_LoopField%
    if ( v = 1 )
    {  
      if (!InStr(tablequeue, A_LoopField))
      {
        DllCall("QueryPerformanceCounter", "Int64 *", CurrentQPC)
        tablequeue := tablequeue . "," . CurrentQPC . "-" . A_TickCount . "_" . A_LoopField
      }
    }
    else
    {
      if ( AlternateDetection = 1 ) {
        color:=TableColor(A_LoopField)
        if ( color != tablecolor && tablecolor != "" ) {
          if (!InStr(tablequeue, A_LoopField))
          {
            DllCall("QueryPerformanceCounter", "Int64 *", CurrentQPC)
            tablequeue := tablequeue . "," . CurrentQPC . "-" . A_TickCount . "_" . A_LoopField
          }
        }
        else {        
          if (InStr(tablequeue, A_LoopField))
          {
            StringReplace, tablequeue, tablequeue, %A_LoopField%, , All
          }
        } 
      } 
      else {
        if (InStr(tablequeue, A_LoopField))
        {
          StringReplace, tablequeue, tablequeue, %A_LoopField%, , All
        }
      }
    }
  }
  tmp := ""
  Loop, Parse, tablequeue, `,
  {
    if (InStr(A_LoopField, "0x"))
    {
      tmp := tmp . "," . A_LoopField 
    }
  }
  Sort, tmp, N D`,
  tablequeue := CleanList(tmp)
  most_urgent_table := ""
  Loop, Parse, tablequeue, `,
  {
    StringTrimLeft, most_urgent_table, A_LoopField, InStr(A_LoopField, "_")
    break
  }
  if ( TimeBankClicker = 1 ) {
    tc := A_TickCount
    Loop, Parse, tablequeue, `,
    {
      StringTrimLeft, waiting_time, A_LoopField, InStr(A_LoopField, "-")
      StringTrimRight, waiting_time, waiting_time, ( StrLen(waiting_time) - (InStr(waiting_time, "_")-1) )
      waiting_time := (tc - waiting_time) / 1000
      if (waiting_time > timebank_min && waiting_time < timebank_max)
      {
        StringTrimLeft, waiting_table, A_LoopField, InStr(A_LoopField, "_")
        timebank_x := 560  ; lastmax 565
        timebank_y := 430  ; lastmax 430 +/-10 too much
        relStarsClientPoint(waiting_table, timebank_x, timebank_y)
        PostLeftClick(timebank_x, timebank_y, waiting_table, 0)
      }  

if (waiting_time > timebank_max+5) ;18)
    {

      SoundPlay, timebankclick.wav ;brad
    }
    
    }
  }
  if ( ActivateUrgent = 1 ) {
    WinActivate, ahk_id%most_urgent_table%
    if ( AlternateDetection = 1 ) {
      color:=TableColor(most_urgent_table)
      if ( color != tablecolor ) {
        if ( Slider = 1 || Highlight = 1 || MoveMouse = 1)
        makegui(most_urgent_table, Slider, Highlight, MoveMouse, beep, x_mouse, y_mouse)
      }
    }
    else {
      if ( Slider = 1 || Highlight = 1 || MoveMouse = 1)
      makegui(most_urgent_table, Slider, Highlight, MoveMouse, beep, x_mouse, y_mouse)
    }
  }
  else {
    if ( Slider = 1 || Highlight = 1 || MoveMouse = 1)
    makegui(most_urgent_table,Slider,  Highlight, MoveMouse, beep, x_mouse, y_mouse)
  }
return



;makegui(id="", Highlight=1, MoveMouse=1, beep=0, x_mouse=0.75, y_mouse=0.75 ) {
makegui(id="", Slider =1, Highlight=1, MoveMouse=1, beep=0, x_mouse=0.75, y_mouse=0.75 ) {   ;brad
  global last_table_id
  global border_colour
  global border_size
  global trans
  global Xcoord ;brad
  global Ycoord ;brad
  global RestoreID ; brad
  global ActiveWindow ;brad
  if (id != last_table_id)
  {
       if (!RestoreID)   	;brad
           { 			;brad
               goto UGLY 	;brad
           }			;brad
DetectHiddenWindows, on ;brad
      WinHide, ahk_id %RestoreID% ;brad
      ;WinRestore , ahk_id %RestoreID% ;brad
      ;PostMessage, 0x112, 0xF120,,, ahk_id %RestoreID%, ;brad
      ;WinMaximize , ahk_id %RestoreID% ;brad
      ;;PostMessage, 0x112, 0xF030,,, ahk_id %RestoreID%, ;brad
      Sleep, 0 ; brad
      WinMove, ahk_id %RestoreID%,, Xcoord, Ycoord,  ; brad
      WinShow, ahk_id %RestoreID% ;brad
      ;;WinActivate, ahk_id %ActiveWindow% ;brad
      RestoreID :=0
DetectHiddenWindows, off ;brad
UGLY:
    last_table_id := id
    
    if(!id) ; if (id=0 or id="") 
    {
      Gui, 2: Cancel
      Gui, 3: Cancel
      Gui, 4: Cancel
      Gui, 5: Cancel
      return
    }
  
    WinGetPos, x, y, w, h, ahk_id%id%
    if (Slider = 1)	;brad
      {			;brad
    	Xcoord :=x ;brad
    	Ycoord :=y ;brad
    	RestoreID := id ;brad  
    	x :=0 ;brad	
    	y :=0 ;brad	
	DetectHiddenWindows, on ; brad
    	WinHide, ahk_id %id% ;brad
    	WinMove,ahk_id %id%,, x, y ;brad	
    	;WinMaximize , ahk_id %id% ;brad
    	;;PostMessage, 0x112, 0xF030,,, ahk_id %id%, ;brad
    	Sleep, 0 ; brad
    	;
WinShow, ahk_id %id% ;brad
	;;WinGet, ActiveWindow, ID, A ;brad
    	WinActivate, ahk_id %id% ;brad
	DetectHiddenWindows, off ; brad
      }	;brad

    WinGetPos, x, y, w, h, ahk_id%id% 	
    global border
    global caption
    x := x + border
    y := y + border + caption
    w := w - (2*border)
    h := h - (2*border) - caption
    

    ;Makes Border around urgent table
    if ( Highlight = 1 ) {
    ;if ( Highlight = 999 ) { ; brad
      ;top
      guinum := 2
      Gui, %guinum%: +Alwaysontop +Lastfound +Owner
      Gui, %guinum%: Color, %border_colour%
      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_colour%
      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_colour%
      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_colour%
      WinSet, Transparent, %trans%
      Gui, %guinum%: -Caption
      x2 := x + w - border_size
      Gui, %guinum%: Show, w%border_size% h%h% x%x2% y%y% NoActivate
    
    }
        
    ;Puts mouse pointer nearer the bet buttons
    if ( MoveMouse = 1) {
      x3 := x + (w * x_mouse)
      y3 := y + (h * y_mouse)
      Coordmode, Mouse, Screen
      MouseMove, x3, y3, 0
    }
    
    ;Beeps on urgent table
    if ( beep = 1 )
      SoundBeep, 750, 100
      ;SoundPlay, timebankclick.wav ;brad
  }
}

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


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%
PostMessage, 0x201, 0x0001, ((y<<16)^x), %control_class%, ahk_id%table_id%
PostMessage, 0x202 , 0, ((y<<16)^x), %control_class%, ahk_id%table_id%
}

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

TableColor(id) {
  CoordMode, Pixel, Screen
  WinGetPos, x, y, w, h, ahk_id%id%
  rw := 800
;rh := 578
;
rh := 573 ; brad
  ;x := x+475
  ;y := y+555
  ;x := Floor( (x / rw ) * w )
  ;y := Floor( (y / rh) * h  )

x := Floor( x + ( (475* w) / rw )   ) ;brad
y := Floor( y + ( (555* h) / rh )   ) ;brad

  PixelGetColor, color, %x%, %y%, RGB
  ;tooltip %x% %y% %color%
  return color
}

TableColor:
  tableids := TableIDListStars(LobbyPID)
  Loop, Parse, tableids, `,
  {
    ControlGet, v, Visible, , PokerStarsSliderEditorClass1, ahk_id%A_LoopField%
    if ( v != 1 ) {
      WinActivate, ahk_id%a_loopfield%
      sleep, 500
      tablecolor:=TableColor(a_loopfield)
      break
    }      
  }
;Msgbox, %tablecolor%
  if ( tablecolor != "" )
    SetTimer, TableColor, Off
  else
    SetTimer, TableColor, %TableColor_timer%
return


;=====================================================================
;=================== SNG Registration Functions ======================
;=====================================================================

RegSNG(id) {
  if ( SafeReg = 1 ) {
    IfWinActive, ahk_id%id%
      RegSNGexec(id)
  }
  else {
    RegSNGexec(id)
  }
}

RegSNGexec(id) {
  ControlGet, v, Visible, , PokerStarsButtonClass6, ahk_id%id%
  if ( v = 1 ) {
    ControlClick, PokerStarsButtonClass6, ahk_id%id%
    WinWait, Tournament Registration ahk_class #32770, , 10
    {
      WinGet, regid, id
      ControlFocus, Button1, ahk_id%regid%
      Sleep, -1
      ControlSend, Button1, {SPACE}, ahk_id%regid%
      sleep, 10
      ControlFocus, Button2, ahk_id%regid%
      Sleep, -1
      ControlSend, Button2, {SPACE}, ahk_id%regid%  
    }
    WinWait, Tournament Registration ahk_class #32770, , 10
    {
      WinGet, regid, id           
      ControlGetText, ctext, Button1, ahk_id%regid%
      if ( cText = "OK" ) {
        ControlFocus, Button1, ahk_id%regid%
        Sleep, -1
        ControlSend, Button1, {SPACE}, ahk_id%regid%
      }        
    }
  }
}


CloseTournamentLobby(id, pid) {
  Loop {
    IfWinExist, Lobby ahk_pid%pid%,, PokerStars Lobby
      WinClose
    else
      break
  }
  Sleep, 100
  WinGet, state, MinMax, ahk_id%id%
  if ( state = 1 || state = 0 )
    WinMinimize, ahk_id%id%
}


;=====================================================================
;=================== Join Cashgame Functions =========================
;=====================================================================


OpenJoinUnJoinTable(id) {
  ControlGet, v, Visible, , PokerStarsButtonClass3, ahk_id%id%
  if ( v = 1 ) {
    ControlClick, PokerStarsButtonClass3, ahk_id%id%
    WinWait, Waiting List ahk_class #32770, , 10
    {
      WinGet, joinid, id
      ControlFocus, Button1, ahk_id%joinid%
      Sleep, -1
      ControlSend, Button1, {SPACE}, ahk_id%joinid%
    }
  }
  else {
    ControlGet, v, Visible, , PokerStarsButtonClass2, ahk_id%id%
    if ( v = 1 ) {
      ControlClick, PokerStarsButtonClass2, ahk_id%id%
    }
    else {
      ControlGet, v, Visible, , PokerStarsButtonClass8, ahk_id%id%
      if ( v = 1 ) {
        ControlClick, PokerStarsButtonClass8, ahk_id%id%
      } 
    }
  }
}


;=====================================================================
;=================== Popup Functions =================================
;=====================================================================

PopUpWatcher:
  If ( KillPopups = 1 )
    KillPopUps(LobbyPID)
  if ( AutoTakeSeat = 1 )
    TakeSeat(LobbyPID)
return

KillPopUps(pid) {
  IfWinExist, PokerStars ahk_class #32770 ahk_pid%pid%
  {
    WinGet, list1, list, PokerStars ahk_class #32770 ahk_pid%pid%, , Lobby
    Loop, %list1%
    {
      This_id := list1%A_Index%
      WinGet, list2, ControlList, ahk_id%this_id%
      if (InStr(list2, "Button2"))  {
        continue
      }
      else {
        Loop, 20
        {
          ControlFocus, Button1, ahk_id%this_id%
          Sleep, -1
          ControlSend, Button1, {SPACE}, ahk_id%this_id%
          Sleep, 100
          IfWinNotExist, ahk_id%this_id%
          {
            break
          }
        }
      }
    }
  }
}

TakeSeat(pid) {
  IfWinExist, PokerStars ahk_class #32770 ahk_pid%pid%
  {
    WinGet, list, list, Seat Available ahk_class #32770 ahk_pid%pid%
    Loop, %list%
    {
      This_id := list%A_Index%
      ControlFocus, Button1, ahk_id%this_id%
       Sleep, -1
      ControlSend, Button1, {SPACE}, ahk_id%this_id%
    }
  }
}


;=====================================================================
;=================== Lobby & Tables Functions ========================
;=====================================================================

RefreshLobby:
  WinGet, LobbyID, id, PokerStars Lobby
  WinGet, LobbyPID, PID, ahk_id%LobbyID%
return

MaxMinLobby(id) {
  WinGetActiveTitle, title
  IfInString, title, PokerStars Lobby
  {
    WinMinimize,ahk_id%id%
  }
  else {
    WinActivate, ahk_id%id%
  }
} 

TableIDListStars(pid)
{
  WinGet, list, list, / ahk_pid%pid%, , Lobby
  Loop %list%
  {
    this_id := list%a_index%
    If (this_id != id)
    {
      ids = %ids%,%this_id%
    }
  }
  StringTrimLeft, ids, ids, 1
  return ids
}
StarsAssistant mod with dual monitor slider like MTH Quote
05-05-2008 , 10:06 PM
oh one last thing right now if you got slider and highlighter on, it moves your table to primary monitor and then draws highlight box around it.

I'm gonna switch it so it highlights the table then moves it to primary monitor, so you can see the empty area thats highlighted so you know for sure where the table came from. so i'll make that one last tweak and then post final slider mod.
StarsAssistant mod with dual monitor slider like MTH Quote
05-05-2008 , 10:34 PM
This looks sweet. Bring on the 24 tables!!!

I have been meaning to get around to making this myself this for a *very* long time... and now PLOlover has done it

FWIW, there is a decent set of functions in StarsPlanner / BetPot / AHK-HUD and maybe others of mys scripts too for getting accurate pixel coordinates for any resized table, of course feel free to use those. RelStarsClientPoint(is, x, y), RelStarsScreenPoint and so on.

Are you just using Maximize and Restore (via postmessages) to size the windows?
StarsAssistant mod with dual monitor slider like MTH Quote
05-05-2008 , 11:49 PM
this is ****in awesome...thx
StarsAssistant mod with dual monitor slider like MTH Quote
05-06-2008 , 12:47 AM
whos gonna mod that to party? =D
StarsAssistant mod with dual monitor slider like MTH Quote
05-06-2008 , 04:53 AM
well here's my final and tested version that i used and like. it's sort of a work in progress (the active table is not maximized after sliding, it was too kludgy for me), but I'm pretty much done posting stuff on it i think.

Code:
; #### StarsAssistant ####

; AHK version: 1.0.46.05
; date: January 05,2008
  version := "0.88"
; author: Chris228 @ 2p2 forums
; thx to _dave_, JBOPoker, Roland, JukofYork & pusteblume

; based on

; #### StarsUrgentTable ####

; AHK version: 1.0.46.03
; date: May 24,2007
; version: 0.75a
; author: _dave_ @ 2p2 forums
; revised by: JBOPoker @ earthlink.net
; thx to Roland & JukofYork for some of the functions


;=====================================================================
;=================== Settings ========================================
;=====================================================================

; Hotkeys see below

; Border of the "Highlighter"
border_colour := "ffff00"
border_size := 8
trans := 255

; Timings for the "Time Bank Clicker" [fast/turbo 8/17; normal 20/35; both 8/35] (10/13 old settings)
timebank_min := 10
timebank_max := 13

; Beep on urgent table
beep := 0

; Position of the mouse in perc of the table window
x_mouse := 0.50
y_mouse := 0.75

; Don't edit below unless you know what you do (except Hotkeys)

; Gui Settings
settings() {
  global
  ini:="StarsAssistant.ini"
  iniRead, AutoOn, %ini%, Prefs, AutoOn, 1
  iniRead, Slider, %ini%, Prefs, Slider, 1 ;brad
  iniRead, Highlight, %ini%, Prefs, Highlight, 1
  iniRead, MoveMouse, %ini%, Prefs, MoveMouse, 1
  iniRead, TimeBankClicker, %ini%, Prefs, TimeBankClicker, 1
  iniRead, AlternateDetection, %ini%, Prefs, AlternateDetection, 0
  iniRead, ActivateUrgent, %ini%, Prefs, ActivateUrgent, 0
  iniRead, KillPopups, %ini%, Prefs, KillPopups, 0
  iniRead, SafeReg, %ini%, Prefs, SafeReg, 1
  iniRead, AutoTakeSeat, %ini%, Prefs, AutoTakeSeat, 0
}

; Intervalls for sub execution
RefreshQueue_timer := 333
RefreshLobby_timer := 1000
PopUpWatcher_timer := 200
TableColor_timer := 500

;=====================================================================
;=================== Autoexec ========================================
;=====================================================================

#NoEnv
#SingleInstance, Force
#Include %a_scriptDir%
SendMode Input

SetTitleMatchMode, 2

SetWorkingDir %a_scriptDir%
OnExit exitSub

settings()
TrayMenu()
BuildGui()

Suspend, On

SysGet, border, 32
SysGet, caption, 4

if ( AutoOn = 1 ) {
  Gosub, ButtonOn
}

return


;=====================================================================
;=================== Hotkeys =========================================
;=====================================================================

^a::
  ToggleCheckbox("MoveMouse")
return

^w::
  ToggleCheckbox("AlternateDetection")
return

^s::
  MaxMinLobby(LobbyID)
return

^d::
  MinMaxStarsAssistant()
return

^z::
  RegSNG(LobbyID)
  OpenJoinUnJoinTable(LobbyID)
return

^e::
  CloseTournamentLobby(LobbyID, LobbyPID)
return

MButton::
  RegSNG(LobbyID)
  OpenJoinUnJoinTable(LobbyID)
return

;=====================================================================
;=================== Gui =============================================
;=====================================================================

trayMenu() {
  global
  Menu, Tray, Standard
  Menu, Tray, Add, &Show, Show
  Menu, Tray, default, &Show
  Menu, Tray, Add
  Menu, Tray, Add, &About, About
  Menu, Tray, Add, &Help, Help
  Menu, Tray, Add
  Menu, Tray, Add, E&xit, Exit
  Menu, Tray, Tip, StarsAssistant v%version%
}

buildGui() {
  global
  Gui 1:Default
  Gui, +toolwindow +AlwaysOnTop
  Gui, Margin, 5, 5
  Gui, Font,, Verdena
  Gui, Add, Button, vOn section w56 h20 center, &On
  Gui, Add, Button, vOff disabled w56 h20 ys xs+56 center, &Off
  Gui, Add, Checkbox, checked%AutoOn% vAutoOn gSubmit xs+2, &Auto on
  Gui, Add, Text, section x7 0x1000 w110 h2
  Gui, Add, Checkbox, checked%Slider% vSlider gSubmit xs, &Slider ;brad
  Gui, Add, Checkbox, checked%Highlight% vHighlight gSubmit xs, &Highlight table
  Gui, Add, Checkbox, checked%MoveMouse% vMoveMouse gSubmit xs, &Move mouse
  Gui, Add, Checkbox, checked%TimeBankClicker% vTimeBankClicker gSubmit xs, &Click time bank
  Gui, Add, Checkbox, checked%AlternateDetection% vAlternateDetection gSubmit xs, &Detect All-in/Fixed l.
  Gui, Add, Checkbox, checked%ActivateUrgent% vActivateUrgent gSubmit xs, &Activate urgent table
  Gui, Add, Checkbox, checked%KillPopups% vKillPopups gSubmit xs, &Kill popups
  Gui, Add, Checkbox, checked%SafeReg% vSafeReg gSubmit xs, &Safe SNG regist.
  Gui, Add, Checkbox, checked%AutoTakeSeat% vAutoTakeSeat gSubmit xs, &Auto take seat  
  IniRead, x, % ini, Gui, x, center
  IniRead, y, % ini, Gui, y, center
  Gui, Show, x%x% y%y% w124, StarsAssistant
}

Show:
  Gui, 1:Show
return

About:
  Msgbox,, StarsAssistant, StarsAssistant v%version% `nAuthor: Chris228 @ 2+2 formus`nE-Mail: chris228@gmx.de`nSee file for further credits`n`nIf you like my program I would be happy about a donation.`nMy screenname on PokerStars is 'mr.cray'.`nThank you!
return

Help:
  Run % web() "http://overcards.com/wiki/moin.cgi/StarsAssistant"
return

web() { ; by Titan, modified by Roland
  regRead, p, HKCR, HTTP\shell\open\command
  return SubStr(p, 1, InStr(p, ".exe")+4)
}

Exit:
exitApp

GuiClose:
  Gui 1:Cancel 
return

Submit:
  Gui, 1:Submit, NoHide
return

exitSub:
  Gui 1:Default
  Gui, Submit
  Gui +lastfound
  WinGetPos, x, y
  IniWrite, % x, % ini, Gui, x
  IniWrite, % y, % ini, Gui, y
  IniWrite, % AutoOn, % ini, Prefs, AutoOn
  IniWrite, % Slider, % ini, Prefs, Slider ;brad
  IniWrite, % Highlight, % ini, Prefs, Highlight
  IniWrite, % MoveMouse, % ini, Prefs, MoveMouse
  IniWrite, % TimeBankClicker, % ini, Prefs, TimeBankClicker
  IniWrite, % AlternateDetection, % ini, Prefs, AlternateDetection
  IniWrite, % ActivateUrgent, % ini, Prefs, ActivateUrgent
  IniWrite, % KillPopups, % ini, Prefs, KillPopups
  IniWrite, % SafeReg, % ini, Prefs, SafeReg
  IniWrite, % AutoTakeSeat, % ini, Prefs, AutoTakeSeat  
exitApp

MinMaxStarsAssistant() {
  WinGetActiveTitle, title
  If ( title = "StarsAssistant" )
    Gui 1:Cancel 
  else
    Gui, 1:Show
}

ToggleCheckbox(box) {
  Gui 1:Default
  GuiControlGet, state, , %box%
  if ( state = 1 )
    GuiControl, , %box%, 0
  if ( state = 0 )
    GuiControl, , %box%, 1
  Gui, 1:Submit, NoHide
}

;=====================================================================
;=================== Buttons =========================================
;=====================================================================

ButtonOn:
  tablecolor:= ""
  last_table_id := ""
  tablequeue := ""
  most_urgent_table := ""
  GoSub, RefreshLobby
  GoSub, TableColor
  SetTimer, RefreshQueue, %RefreshQueue_timer%
  SetTimer, PopUpWatcher, %PopUpWatcher_timer%
  SetTimer, RefreshLobby, %RefreshLobby_timer%
  Suspend, Off
  GuiControl, 1:Disable, On
  GuiControl, 1:Enable, Off
return
  
ButtonOff:
  SetTimer, RefreshQueue, Off
  SetTimer, PopUpWatcher, Off
  SetTimer, RefreshLobby, Off
  SetTimer, TableColor, Off
  Gui, 2: Cancel
  Gui, 3: Cancel
  Gui, 4: Cancel
  Gui, 5: Cancel
  tablecolor:=""
  Suspend, On
  GuiControl, 1:Disable, Off
  GuiControl, 1:Enable, On
return


;=====================================================================
;=================== Urgent Table Functions ==========================
;=====================================================================

RefreshQueue:
  ids := TableIDListStars(LobbyPID)
  Loop, Parse, tablequeue, `,
  {
    StringTrimLeft, this_id, A_LoopField, InStr(A_LoopField, "_")
    if (!InStr(ids, this_id))
    {
      StringReplace, tablequeue, tablequeue, %A_LoopField%, , All
    }
  }
  Loop, Parse, ids, `,
  {
    ControlGet, v, Visible, , PokerStarsSliderEditorClass1, ahk_id%A_LoopField%
    if ( v = 1 )
    {  
      if (!InStr(tablequeue, A_LoopField))
      {
        DllCall("QueryPerformanceCounter", "Int64 *", CurrentQPC)
        tablequeue := tablequeue . "," . CurrentQPC . "-" . A_TickCount . "_" . A_LoopField
      }
    }
    else
    {
      if ( AlternateDetection = 1 ) {
        color:=TableColor(A_LoopField)
        if ( color != tablecolor && tablecolor != "" ) {
          if (!InStr(tablequeue, A_LoopField))
          {
            DllCall("QueryPerformanceCounter", "Int64 *", CurrentQPC)
            tablequeue := tablequeue . "," . CurrentQPC . "-" . A_TickCount . "_" . A_LoopField
          }
        }
        else {        
          if (InStr(tablequeue, A_LoopField))
          {
            StringReplace, tablequeue, tablequeue, %A_LoopField%, , All
          }
        } 
      } 
      else {
        if (InStr(tablequeue, A_LoopField))
        {
          StringReplace, tablequeue, tablequeue, %A_LoopField%, , All
        }
      }
    }
  }
  tmp := ""
  Loop, Parse, tablequeue, `,
  {
    if (InStr(A_LoopField, "0x"))
    {
      tmp := tmp . "," . A_LoopField 
    }
  }
  Sort, tmp, N D`,
  tablequeue := CleanList(tmp)
  most_urgent_table := ""
  Loop, Parse, tablequeue, `,
  {
    StringTrimLeft, most_urgent_table, A_LoopField, InStr(A_LoopField, "_")
    break
  }
  if ( TimeBankClicker = 1 ) {
    tc := A_TickCount
    Loop, Parse, tablequeue, `,
    {
      StringTrimLeft, waiting_time, A_LoopField, InStr(A_LoopField, "-")
      StringTrimRight, waiting_time, waiting_time, ( StrLen(waiting_time) - (InStr(waiting_time, "_")-1) )
      waiting_time := (tc - waiting_time) / 1000
      if (waiting_time > timebank_min && waiting_time < timebank_max)
      {
        StringTrimLeft, waiting_table, A_LoopField, InStr(A_LoopField, "_")
        timebank_x := 560  ; lastmax 565
        timebank_y := 430  ; lastmax 430 +/-10 too much
        relStarsClientPoint(waiting_table, timebank_x, timebank_y)
        PostLeftClick(timebank_x, timebank_y, waiting_table, 0)
      }  

if (waiting_time > timebank_max+5) ;18)
    {

      SoundPlay, timebankclick.wav ;brad
    }
    
    }
  }
  if ( ActivateUrgent = 1 ) {
    WinActivate, ahk_id%most_urgent_table%
    if ( AlternateDetection = 1 ) {
      color:=TableColor(most_urgent_table)
      if ( color != tablecolor ) {
        if ( Slider = 1 || Highlight = 1 || MoveMouse = 1)
        makegui(most_urgent_table, Slider, Highlight, MoveMouse, beep, x_mouse, y_mouse)
      }
    }
    else {
      if ( Slider = 1 || Highlight = 1 || MoveMouse = 1)
      makegui(most_urgent_table, Slider, Highlight, MoveMouse, beep, x_mouse, y_mouse)
    }
  }
  else {
    if ( Slider = 1 || Highlight = 1 || MoveMouse = 1)
    makegui(most_urgent_table,Slider,  Highlight, MoveMouse, beep, x_mouse, y_mouse)
  }
return



;makegui(id="", Highlight=1, MoveMouse=1, beep=0, x_mouse=0.75, y_mouse=0.75 ) {
makegui(id="", Slider =1, Highlight=1, MoveMouse=1, beep=0, x_mouse=0.75, y_mouse=0.75 ) {   ;brad
  global last_table_id
  global border_colour
  global border_size
  global trans
  global Xcoord ;brad
  global Ycoord ;brad
  global RestoreID ; brad
  global ActiveWindow ;brad
  if (id != last_table_id)
  {
       if (!RestoreID)   	;brad
           { 			;brad
               goto UGLY 	;brad
           }			;brad
DetectHiddenWindows, on ;brad
      WinHide, ahk_id %RestoreID% ;brad
      ;WinRestore , ahk_id %RestoreID% ;brad
      ;PostMessage, 0x112, 0xF120,,, ahk_id %RestoreID%, ;brad
      ;WinMaximize , ahk_id %RestoreID% ;brad
      ;;PostMessage, 0x112, 0xF030,,, ahk_id %RestoreID%, ;brad
      Sleep, 0 ; brad
      WinMove, ahk_id %RestoreID%,, Xcoord, Ycoord,  ; brad
      WinShow, ahk_id %RestoreID% ;brad
      ;;WinActivate, ahk_id %ActiveWindow% ;brad
      RestoreID :=0
DetectHiddenWindows, off ;brad
UGLY:
    last_table_id := id
    
    if(!id) ; if (id=0 or id="") 
    {
      Gui, 2: Cancel
      Gui, 3: Cancel
      Gui, 4: Cancel
      Gui, 5: Cancel
      return
    }
  
    

    WinGetPos, x, y, w, h, ahk_id%id% 	
    global border
    global caption
    x := x + border
    y := y + border + caption
    w := w - (2*border)
    h := h - (2*border) - caption
    

    ;Makes Border around urgent table
    if ( Highlight = 1 ) {
    ;if ( Highlight = 999 ) { ; brad
      ;top
      guinum := 2
      Gui, %guinum%: +Alwaysontop +Lastfound +Owner
      Gui, %guinum%: Color, %border_colour%
      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_colour%
      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_colour%
      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_colour%
      WinSet, Transparent, %trans%
      Gui, %guinum%: -Caption
      x2 := x + w - border_size
      Gui, %guinum%: Show, w%border_size% h%h% x%x2% y%y% NoActivate
    
    }

WinGetPos, x, y, w, h, ahk_id%id%
    if (Slider = 1)	;brad
      {			;brad
    	Xcoord :=x ;brad
    	Ycoord :=y ;brad
    	RestoreID := id ;brad  
    	x :=0 ;brad	
    	y :=0 ;brad	
	DetectHiddenWindows, on ; brad
    	WinHide, ahk_id %id% ;brad
    	WinMove,ahk_id %id%,, x, y ;brad	
    	;WinMaximize , ahk_id %id% ;brad
    	;;PostMessage, 0x112, 0xF030,,, ahk_id %id%, ;brad
    	Sleep, 0 ; brad
    	;
WinShow, ahk_id %id% ;brad
	;;WinGet, ActiveWindow, ID, A ;brad
    	WinActivate, ahk_id %id% ;brad
	DetectHiddenWindows, off ; brad
      }	;brad
        
    ;Puts mouse pointer nearer the bet buttons
    if ( MoveMouse = 1) {
      x3 := x + (w * x_mouse)
      y3 := y + (h * y_mouse)
      Coordmode, Mouse, Screen
      MouseMove, x3, y3, 0
    }
    
    ;Beeps on urgent table
    if ( beep = 1 )
      SoundBeep, 750, 100
      ;SoundPlay, timebankclick.wav ;brad
  }
}

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


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%
PostMessage, 0x201, 0x0001, ((y<<16)^x), %control_class%, ahk_id%table_id%
PostMessage, 0x202 , 0, ((y<<16)^x), %control_class%, ahk_id%table_id%
}

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

TableColor(id) {
  CoordMode, Pixel, Screen
  WinGetPos, x, y, w, h, ahk_id%id%
  rw := 800
;rh := 578
;
rh := 573 ; brad
  ;x := x+475
  ;y := y+555
  ;x := Floor( (x / rw ) * w )
  ;y := Floor( (y / rh) * h  )

x := Floor( x + ( (475* w) / rw )   ) ;brad
y := Floor( y + ( (555* h) / rh )   ) ;brad

  PixelGetColor, color, %x%, %y%, RGB
  ;tooltip %x% %y% %color%
  return color
}

TableColor:
  tableids := TableIDListStars(LobbyPID)
  Loop, Parse, tableids, `,
  {
    ControlGet, v, Visible, , PokerStarsSliderEditorClass1, ahk_id%A_LoopField%
    if ( v != 1 ) {
      WinActivate, ahk_id%a_loopfield%
      sleep, 500
      tablecolor:=TableColor(a_loopfield)
      break
    }      
  }
;Msgbox, %tablecolor%
  if ( tablecolor != "" )
    SetTimer, TableColor, Off
  else
    SetTimer, TableColor, %TableColor_timer%
return


;=====================================================================
;=================== SNG Registration Functions ======================
;=====================================================================

RegSNG(id) {
  if ( SafeReg = 1 ) {
    IfWinActive, ahk_id%id%
      RegSNGexec(id)
  }
  else {
    RegSNGexec(id)
  }
}

RegSNGexec(id) {
  ControlGet, v, Visible, , PokerStarsButtonClass6, ahk_id%id%
  if ( v = 1 ) {
    ControlClick, PokerStarsButtonClass6, ahk_id%id%
    WinWait, Tournament Registration ahk_class #32770, , 10
    {
      WinGet, regid, id
      ControlFocus, Button1, ahk_id%regid%
      Sleep, -1
      ControlSend, Button1, {SPACE}, ahk_id%regid%
      sleep, 10
      ControlFocus, Button2, ahk_id%regid%
      Sleep, -1
      ControlSend, Button2, {SPACE}, ahk_id%regid%  
    }
    WinWait, Tournament Registration ahk_class #32770, , 10
    {
      WinGet, regid, id           
      ControlGetText, ctext, Button1, ahk_id%regid%
      if ( cText = "OK" ) {
        ControlFocus, Button1, ahk_id%regid%
        Sleep, -1
        ControlSend, Button1, {SPACE}, ahk_id%regid%
      }        
    }
  }
}


CloseTournamentLobby(id, pid) {
  Loop {
    IfWinExist, Lobby ahk_pid%pid%,, PokerStars Lobby
      WinClose
    else
      break
  }
  Sleep, 100
  WinGet, state, MinMax, ahk_id%id%
  if ( state = 1 || state = 0 )
    WinMinimize, ahk_id%id%
}


;=====================================================================
;=================== Join Cashgame Functions =========================
;=====================================================================


OpenJoinUnJoinTable(id) {
  ControlGet, v, Visible, , PokerStarsButtonClass3, ahk_id%id%
  if ( v = 1 ) {
    ControlClick, PokerStarsButtonClass3, ahk_id%id%
    WinWait, Waiting List ahk_class #32770, , 10
    {
      WinGet, joinid, id
      ControlFocus, Button1, ahk_id%joinid%
      Sleep, -1
      ControlSend, Button1, {SPACE}, ahk_id%joinid%
    }
  }
  else {
    ControlGet, v, Visible, , PokerStarsButtonClass2, ahk_id%id%
    if ( v = 1 ) {
      ControlClick, PokerStarsButtonClass2, ahk_id%id%
    }
    else {
      ControlGet, v, Visible, , PokerStarsButtonClass8, ahk_id%id%
      if ( v = 1 ) {
        ControlClick, PokerStarsButtonClass8, ahk_id%id%
      } 
    }
  }
}


;=====================================================================
;=================== Popup Functions =================================
;=====================================================================

PopUpWatcher:
  If ( KillPopups = 1 )
    KillPopUps(LobbyPID)
  if ( AutoTakeSeat = 1 )
    TakeSeat(LobbyPID)
return

KillPopUps(pid) {
  IfWinExist, PokerStars ahk_class #32770 ahk_pid%pid%
  {
    WinGet, list1, list, PokerStars ahk_class #32770 ahk_pid%pid%, , Lobby
    Loop, %list1%
    {
      This_id := list1%A_Index%
      WinGet, list2, ControlList, ahk_id%this_id%
      if (InStr(list2, "Button2"))  {
        continue
      }
      else {
        Loop, 20
        {
          ControlFocus, Button1, ahk_id%this_id%
          Sleep, -1
          ControlSend, Button1, {SPACE}, ahk_id%this_id%
          Sleep, 100
          IfWinNotExist, ahk_id%this_id%
          {
            break
          }
        }
      }
    }
  }
}

TakeSeat(pid) {
  IfWinExist, PokerStars ahk_class #32770 ahk_pid%pid%
  {
    WinGet, list, list, Seat Available ahk_class #32770 ahk_pid%pid%
    Loop, %list%
    {
      This_id := list%A_Index%
      ControlFocus, Button1, ahk_id%this_id%
       Sleep, -1
      ControlSend, Button1, {SPACE}, ahk_id%this_id%
    }
  }
}


;=====================================================================
;=================== Lobby & Tables Functions ========================
;=====================================================================

RefreshLobby:
  WinGet, LobbyID, id, PokerStars Lobby
  WinGet, LobbyPID, PID, ahk_id%LobbyID%
return

MaxMinLobby(id) {
  WinGetActiveTitle, title
  IfInString, title, PokerStars Lobby
  {
    WinMinimize,ahk_id%id%
  }
  else {
    WinActivate, ahk_id%id%
  }
} 

TableIDListStars(pid)
{
  WinGet, list, list, / ahk_pid%pid%, , Lobby
  Loop %list%
  {
    this_id := list%a_index%
    If (this_id != id)
    {
      ids = %ids%,%this_id%
    }
  }
  StringTrimLeft, ids, ids, 1
  return ids
}
StarsAssistant mod with dual monitor slider like MTH Quote
05-06-2008 , 04:53 AM
Quote:
Originally Posted by _dave_

Are you just using Maximize and Restore (via postmessages) to size the windows?
well thanks i did my best i left the code uncleaned up so people could maybe follow along if they wanted to.

yes, origianlly I transferred the highlighted table to 0,0 and then maximized via postmessage, but I commented that out I like it better if it isn't maximized. pretty sure you can just uncomment out that line and you will get it maximized. the original version had it maximized, the one i posted first.
then did a restore to put it back in normal size before moving it back.

also just saved the coordinates so i could just ship the window back to where it came from.


here's the restore section. note that pokerstars is weird, you maximize to maximize, and you also maximize to restore.
just uncomment out only this line
;;PostMessage, 0x112, 0xF030,,, ahk_id RestoreID%, ;brad

Code:
if (!RestoreID)   	;brad
           { 			;brad
               goto UGLY 	;brad
           }			;brad
DetectHiddenWindows, on ;brad
      WinHide, ahk_id %RestoreID% ;brad
      ;WinRestore , ahk_id %RestoreID% ;brad
      ;PostMessage, 0x112, 0xF120,,, ahk_id %RestoreID%, ;brad
      ;WinMaximize , ahk_id %RestoreID% ;brad
      ;;PostMessage, 0x112, 0xF030,,, ahk_id %RestoreID%, ;brad
then uncomment out this line only to maximize
;;PostMessage, 0x112, 0xF030,,, ahk_id %id%, ;brad
Code:
    	RestoreID := id ;brad  
    	x :=0 ;brad	
    	y :=0 ;brad	
	DetectHiddenWindows, on ; brad
    	WinHide, ahk_id %id% ;brad
    	WinMove,ahk_id %id%,, x, y ;brad	
    	;WinMaximize , ahk_id %id% ;brad
    	;;PostMessage, 0x112, 0xF030,,, ahk_id %id%, ;brad
StarsAssistant mod with dual monitor slider like MTH Quote
05-06-2008 , 03:53 PM
Does this work with one monitor?
StarsAssistant mod with dual monitor slider like MTH Quote
05-08-2008 , 06:56 AM
Quote:
Originally Posted by Sorrybadbeat
Does this work with one monitor?
yeah it would work but i guess you need the maximize stuff uncommented otherwise the table would just go to upper left hand corner and stay the same size.
StarsAssistant mod with dual monitor slider like MTH Quote
05-08-2008 , 07:01 AM
added so that every time a window is highlighted the info tab and refresh tab are hit so you know where you are. pokerstars only obviously. next time i play I'll put in a variable for maximize so you can maximize or not without changing code.

here's the new code for hitting info/refresh.

Code:
global border
        global caption
	xi := 222                           ;click  info for tourneys
	yi := 440
	xi := xi  -( border/2 )                         
	yi := yi -( border+caption )
        relStarsClientPoint(id, xi, yi)
        PostLeftClick(xi, yi, id, 0)

        ;global border
        ;global caption
	xi := 222                           ;click  refresh for tourneys
	yi := 465
	xi := xi  -( border/2 )                         
	yi := yi -( border+caption )
        relStarsClientPoint(id, xi, yi)
        PostLeftClick(xi, yi, id, 0)
here's the whole thing.

Code:
; #### StarsAssistant ####

; AHK version: 1.0.46.05
; date: January 05,2008
  version := "0.88"
; author: Chris228 @ 2p2 forums
; thx to _dave_, JBOPoker, Roland, JukofYork & pusteblume

; based on

; #### StarsUrgentTable ####

; AHK version: 1.0.46.03
; date: May 24,2007
; version: 0.75a
; author: _dave_ @ 2p2 forums
; revised by: JBOPoker @ earthlink.net
; thx to Roland & JukofYork for some of the functions


;=====================================================================
;=================== Settings ========================================
;=====================================================================

; Hotkeys see below

; Border of the "Highlighter"
border_colour := "ffff00"
border_size := 8
trans := 255

; Timings for the "Time Bank Clicker" [fast/turbo 8/17; normal 20/35; both 8/35] (10/13 old settings)
timebank_min := 10
timebank_max := 13

; Beep on urgent table
beep := 0

; Position of the mouse in perc of the table window
x_mouse := 0.50
y_mouse := 0.75

; Don't edit below unless you know what you do (except Hotkeys)

; Gui Settings
settings() {
  global
  ini:="StarsAssistant.ini"
  iniRead, AutoOn, %ini%, Prefs, AutoOn, 1
  iniRead, Slider, %ini%, Prefs, Slider, 1 ;brad
  iniRead, Highlight, %ini%, Prefs, Highlight, 1
  iniRead, MoveMouse, %ini%, Prefs, MoveMouse, 1
  iniRead, TimeBankClicker, %ini%, Prefs, TimeBankClicker, 1
  iniRead, AlternateDetection, %ini%, Prefs, AlternateDetection, 0
  iniRead, ActivateUrgent, %ini%, Prefs, ActivateUrgent, 0
  iniRead, KillPopups, %ini%, Prefs, KillPopups, 0
  iniRead, SafeReg, %ini%, Prefs, SafeReg, 1
  iniRead, AutoTakeSeat, %ini%, Prefs, AutoTakeSeat, 0
}

; Intervalls for sub execution
RefreshQueue_timer := 333
RefreshLobby_timer := 1000
PopUpWatcher_timer := 200
TableColor_timer := 500

;=====================================================================
;=================== Autoexec ========================================
;=====================================================================

#NoEnv
#SingleInstance, Force
#Include %a_scriptDir%
SendMode Input

SetTitleMatchMode, 2

SetWorkingDir %a_scriptDir%
OnExit exitSub

settings()
TrayMenu()
BuildGui()

Suspend, On

SysGet, border, 32
SysGet, caption, 4

if ( AutoOn = 1 ) {
  Gosub, ButtonOn
}

return


;=====================================================================
;=================== Hotkeys =========================================
;=====================================================================

^a::
  ToggleCheckbox("MoveMouse")
return

^w::
  ToggleCheckbox("AlternateDetection")
return

^s::
  MaxMinLobby(LobbyID)
return

^d::
  MinMaxStarsAssistant()
return

^z::
  RegSNG(LobbyID)
  OpenJoinUnJoinTable(LobbyID)
return

^e::
  CloseTournamentLobby(LobbyID, LobbyPID)
return

MButton::
  RegSNG(LobbyID)
  OpenJoinUnJoinTable(LobbyID)
return

;=====================================================================
;=================== Gui =============================================
;=====================================================================

trayMenu() {
  global
  Menu, Tray, Standard
  Menu, Tray, Add, &Show, Show
  Menu, Tray, default, &Show
  Menu, Tray, Add
  Menu, Tray, Add, &About, About
  Menu, Tray, Add, &Help, Help
  Menu, Tray, Add
  Menu, Tray, Add, E&xit, Exit
  Menu, Tray, Tip, StarsAssistant v%version%
}

buildGui() {
  global
  Gui 1:Default
  Gui, +toolwindow +AlwaysOnTop
  Gui, Margin, 5, 5
  Gui, Font,, Verdena
  Gui, Add, Button, vOn section w56 h20 center, &On
  Gui, Add, Button, vOff disabled w56 h20 ys xs+56 center, &Off
  Gui, Add, Checkbox, checked%AutoOn% vAutoOn gSubmit xs+2, &Auto on
  Gui, Add, Text, section x7 0x1000 w110 h2
  Gui, Add, Checkbox, checked%Slider% vSlider gSubmit xs, &Slider ;brad
  Gui, Add, Checkbox, checked%Highlight% vHighlight gSubmit xs, &Highlight table
  Gui, Add, Checkbox, checked%MoveMouse% vMoveMouse gSubmit xs, &Move mouse
  Gui, Add, Checkbox, checked%TimeBankClicker% vTimeBankClicker gSubmit xs, &Click time bank
  Gui, Add, Checkbox, checked%AlternateDetection% vAlternateDetection gSubmit xs, &Detect All-in/Fixed l.
  Gui, Add, Checkbox, checked%ActivateUrgent% vActivateUrgent gSubmit xs, &Activate urgent table
  Gui, Add, Checkbox, checked%KillPopups% vKillPopups gSubmit xs, &Kill popups
  Gui, Add, Checkbox, checked%SafeReg% vSafeReg gSubmit xs, &Safe SNG regist.
  Gui, Add, Checkbox, checked%AutoTakeSeat% vAutoTakeSeat gSubmit xs, &Auto take seat  
  IniRead, x, % ini, Gui, x, center
  IniRead, y, % ini, Gui, y, center
  Gui, Show, x%x% y%y% w124, StarsAssistant
}

Show:
  Gui, 1:Show
return

About:
  Msgbox,, StarsAssistant, StarsAssistant v%version% `nAuthor: Chris228 @ 2+2 formus`nE-Mail: chris228@gmx.de`nSee file for further credits`n`nIf you like my program I would be happy about a donation.`nMy screenname on PokerStars is 'mr.cray'.`nThank you!
return

Help:
  Run % web() "http://overcards.com/wiki/moin.cgi/StarsAssistant"
return

web() { ; by Titan, modified by Roland
  regRead, p, HKCR, HTTP\shell\open\command
  return SubStr(p, 1, InStr(p, ".exe")+4)
}

Exit:
exitApp

GuiClose:
  Gui 1:Cancel 
return

Submit:
  Gui, 1:Submit, NoHide
return

exitSub:
  Gui 1:Default
  Gui, Submit
  Gui +lastfound
  WinGetPos, x, y
  IniWrite, % x, % ini, Gui, x
  IniWrite, % y, % ini, Gui, y
  IniWrite, % AutoOn, % ini, Prefs, AutoOn
  IniWrite, % Slider, % ini, Prefs, Slider ;brad
  IniWrite, % Highlight, % ini, Prefs, Highlight
  IniWrite, % MoveMouse, % ini, Prefs, MoveMouse
  IniWrite, % TimeBankClicker, % ini, Prefs, TimeBankClicker
  IniWrite, % AlternateDetection, % ini, Prefs, AlternateDetection
  IniWrite, % ActivateUrgent, % ini, Prefs, ActivateUrgent
  IniWrite, % KillPopups, % ini, Prefs, KillPopups
  IniWrite, % SafeReg, % ini, Prefs, SafeReg
  IniWrite, % AutoTakeSeat, % ini, Prefs, AutoTakeSeat  
exitApp

MinMaxStarsAssistant() {
  WinGetActiveTitle, title
  If ( title = "StarsAssistant" )
    Gui 1:Cancel 
  else
    Gui, 1:Show
}

ToggleCheckbox(box) {
  Gui 1:Default
  GuiControlGet, state, , %box%
  if ( state = 1 )
    GuiControl, , %box%, 0
  if ( state = 0 )
    GuiControl, , %box%, 1
  Gui, 1:Submit, NoHide
}

;=====================================================================
;=================== Buttons =========================================
;=====================================================================

ButtonOn:
  tablecolor:= ""
  last_table_id := ""
  tablequeue := ""
  most_urgent_table := ""
  GoSub, RefreshLobby
  GoSub, TableColor
  SetTimer, RefreshQueue, %RefreshQueue_timer%
  SetTimer, PopUpWatcher, %PopUpWatcher_timer%
  SetTimer, RefreshLobby, %RefreshLobby_timer%
  Suspend, Off
  GuiControl, 1:Disable, On
  GuiControl, 1:Enable, Off
return
  
ButtonOff:
  SetTimer, RefreshQueue, Off
  SetTimer, PopUpWatcher, Off
  SetTimer, RefreshLobby, Off
  SetTimer, TableColor, Off
  Gui, 2: Cancel
  Gui, 3: Cancel
  Gui, 4: Cancel
  Gui, 5: Cancel
  tablecolor:=""
  Suspend, On
  GuiControl, 1:Disable, Off
  GuiControl, 1:Enable, On
return


;=====================================================================
;=================== Urgent Table Functions ==========================
;=====================================================================

RefreshQueue:
  ids := TableIDListStars(LobbyPID)
  Loop, Parse, tablequeue, `,
  {
    StringTrimLeft, this_id, A_LoopField, InStr(A_LoopField, "_")
    if (!InStr(ids, this_id))
    {
      StringReplace, tablequeue, tablequeue, %A_LoopField%, , All
    }
  }
  Loop, Parse, ids, `,
  {
    ControlGet, v, Visible, , PokerStarsSliderEditorClass1, ahk_id%A_LoopField%
    if ( v = 1 )
    {  
      if (!InStr(tablequeue, A_LoopField))
      {
        DllCall("QueryPerformanceCounter", "Int64 *", CurrentQPC)
        tablequeue := tablequeue . "," . CurrentQPC . "-" . A_TickCount . "_" . A_LoopField
      }
    }
    else
    {
      if ( AlternateDetection = 1 ) {
        color:=TableColor(A_LoopField)
        if ( color != tablecolor && tablecolor != "" ) {
          if (!InStr(tablequeue, A_LoopField))
          {
            DllCall("QueryPerformanceCounter", "Int64 *", CurrentQPC)
            tablequeue := tablequeue . "," . CurrentQPC . "-" . A_TickCount . "_" . A_LoopField
          }
        }
        else {        
          if (InStr(tablequeue, A_LoopField))
          {
            StringReplace, tablequeue, tablequeue, %A_LoopField%, , All
          }
        } 
      } 
      else {
        if (InStr(tablequeue, A_LoopField))
        {
          StringReplace, tablequeue, tablequeue, %A_LoopField%, , All
        }
      }
    }
  }
  tmp := ""
  Loop, Parse, tablequeue, `,
  {
    if (InStr(A_LoopField, "0x"))
    {
      tmp := tmp . "," . A_LoopField 
    }
  }
  Sort, tmp, N D`,
  tablequeue := CleanList(tmp)
  most_urgent_table := ""
  Loop, Parse, tablequeue, `,
  {
    StringTrimLeft, most_urgent_table, A_LoopField, InStr(A_LoopField, "_")
    break
  }
  if ( TimeBankClicker = 1 ) {
    tc := A_TickCount
    Loop, Parse, tablequeue, `,
    {
      StringTrimLeft, waiting_time, A_LoopField, InStr(A_LoopField, "-")
      StringTrimRight, waiting_time, waiting_time, ( StrLen(waiting_time) - (InStr(waiting_time, "_")-1) )
      waiting_time := (tc - waiting_time) / 1000
      if (waiting_time > timebank_min && waiting_time < timebank_max)
      {
        StringTrimLeft, waiting_table, A_LoopField, InStr(A_LoopField, "_")
        timebank_x := 560  ; lastmax 565
        timebank_y := 430  ; lastmax 430 +/-10 too much
        relStarsClientPoint(waiting_table, timebank_x, timebank_y)
        PostLeftClick(timebank_x, timebank_y, waiting_table, 0)
      }  

if (waiting_time > timebank_max+5) ;18)
    {

      SoundPlay, timebankclick.wav ;brad
    }
    
    }
  }
  if ( ActivateUrgent = 1 ) {
    WinActivate, ahk_id%most_urgent_table%
    if ( AlternateDetection = 1 ) {
      color:=TableColor(most_urgent_table)
      if ( color != tablecolor ) {
        if ( Slider = 1 || Highlight = 1 || MoveMouse = 1)
        makegui(most_urgent_table, Slider, Highlight, MoveMouse, beep, x_mouse, y_mouse)
      }
    }
    else {
      if ( Slider = 1 || Highlight = 1 || MoveMouse = 1)
      makegui(most_urgent_table, Slider, Highlight, MoveMouse, beep, x_mouse, y_mouse)
    }
  }
  else {
    if ( Slider = 1 || Highlight = 1 || MoveMouse = 1)
    makegui(most_urgent_table,Slider,  Highlight, MoveMouse, beep, x_mouse, y_mouse)
  }
return



;makegui(id="", Highlight=1, MoveMouse=1, beep=0, x_mouse=0.75, y_mouse=0.75 ) {
makegui(id="", Slider =1, Highlight=1, MoveMouse=1, beep=0, x_mouse=0.75, y_mouse=0.75 ) {   ;brad
  global last_table_id
  global border_colour
  global border_size
  global trans
  global Xcoord ;brad
  global Ycoord ;brad
  global RestoreID ; brad
  global ActiveWindow ;brad
  global xi
  global yi
  
  if (id != last_table_id)
  {
       if (!RestoreID)   	;brad
           { 			;brad
               goto UGLY 	;brad
           }			;brad
DetectHiddenWindows, on ;brad
      WinHide, ahk_id %RestoreID% ;brad
      ;WinRestore , ahk_id %RestoreID% ;brad
      ;PostMessage, 0x112, 0xF120,,, ahk_id %RestoreID%, ;brad
      ;WinMaximize , ahk_id %RestoreID% ;brad
      ;;PostMessage, 0x112, 0xF030,,, ahk_id %RestoreID%, ;brad
      Sleep, 0 ; brad
      WinMove, ahk_id %RestoreID%,, Xcoord, Ycoord,  ; brad
      WinShow, ahk_id %RestoreID% ;brad
      ;;WinActivate, ahk_id %ActiveWindow% ;brad
      RestoreID :=0
DetectHiddenWindows, off ;brad
UGLY:
    last_table_id := id
    
    if(!id) ; if (id=0 or id="") 
    {
      Gui, 2: Cancel
      Gui, 3: Cancel
      Gui, 4: Cancel
      Gui, 5: Cancel
      return
    }
    
        global border
        global caption
	xi := 222                           ;click  info for tourneys
	yi := 440
	xi := xi  -( border/2 )                         
	yi := yi -( border+caption )
        relStarsClientPoint(id, xi, yi)
        PostLeftClick(xi, yi, id, 0)

        ;global border
        ;global caption
	xi := 222                           ;click  refresh for tourneys
	yi := 465
	xi := xi  -( border/2 )                         
	yi := yi -( border+caption )
        relStarsClientPoint(id, xi, yi)
        PostLeftClick(xi, yi, id, 0)

    WinGetPos, x, y, w, h, ahk_id%id% 	
    ;global border
    ;global caption
    x := x + border
    y := y + border + caption
    w := w - (2*border)
    h := h - (2*border) - caption
    

    ;Makes Border around urgent table
    if ( Highlight = 1 ) {
    ;if ( Highlight = 999 ) { ; brad
      ;top
      guinum := 2
      Gui, %guinum%: +Alwaysontop +Lastfound +Owner
      Gui, %guinum%: Color, %border_colour%
      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_colour%
      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_colour%
      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_colour%
      WinSet, Transparent, %trans%
      Gui, %guinum%: -Caption
      x2 := x + w - border_size
      Gui, %guinum%: Show, w%border_size% h%h% x%x2% y%y% NoActivate
    
    }

WinGetPos, x, y, w, h, ahk_id%id%
    if (Slider = 1)	;brad
      {			;brad
    	Xcoord :=x ;brad
    	Ycoord :=y ;brad
    	RestoreID := id ;brad  
    	x :=0 ;brad	
    	y :=0 ;brad	
	DetectHiddenWindows, on ; brad
    	WinHide, ahk_id %id% ;brad
    	WinMove,ahk_id %id%,, x, y ;brad	
    	;WinMaximize , ahk_id %id% ;brad
    	;;PostMessage, 0x112, 0xF030,,, ahk_id %id%, ;brad
    	Sleep, 0 ; brad
    	;
WinShow, ahk_id %id% ;brad
	;;WinGet, ActiveWindow, ID, A ;brad
    	WinActivate, ahk_id %id% ;brad
	DetectHiddenWindows, off ; brad
      }	;brad
        
    ;Puts mouse pointer nearer the bet buttons
    if ( MoveMouse = 1) {
      x3 := x + (w * x_mouse)
      y3 := y + (h * y_mouse)
      Coordmode, Mouse, Screen
      MouseMove, x3, y3, 0
    }
    
    ;Beeps on urgent table
    if ( beep = 1 )
      SoundBeep, 750, 100
      ;SoundPlay, timebankclick.wav ;brad
  }
}

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


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%
PostMessage, 0x201, 0x0001, ((y<<16)^x), %control_class%, ahk_id%table_id%
PostMessage, 0x202 , 0, ((y<<16)^x), %control_class%, ahk_id%table_id%
}

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

TableColor(id) {
  CoordMode, Pixel, Screen
  WinGetPos, x, y, w, h, ahk_id%id%
  rw := 800
;rh := 578
;
rh := 573 ; brad
  ;x := x+475
  ;y := y+555
  ;x := Floor( (x / rw ) * w )
  ;y := Floor( (y / rh) * h  )

x := Floor( x + ( (475* w) / rw )   ) ;brad
y := Floor( y + ( (555* h) / rh )   ) ;brad

  PixelGetColor, color, %x%, %y%, RGB
  ;tooltip %x% %y% %color%
  return color
}

TableColor:
  tableids := TableIDListStars(LobbyPID)
  Loop, Parse, tableids, `,
  {
    ControlGet, v, Visible, , PokerStarsSliderEditorClass1, ahk_id%A_LoopField%
    if ( v != 1 ) {
      WinActivate, ahk_id%a_loopfield%
      sleep, 500
      tablecolor:=TableColor(a_loopfield)
      break
    }      
  }
;Msgbox, %tablecolor%
  if ( tablecolor != "" )
    SetTimer, TableColor, Off
  else
    SetTimer, TableColor, %TableColor_timer%
return


;=====================================================================
;=================== SNG Registration Functions ======================
;=====================================================================

RegSNG(id) {
  if ( SafeReg = 1 ) {
    IfWinActive, ahk_id%id%
      RegSNGexec(id)
  }
  else {
    RegSNGexec(id)
  }
}

RegSNGexec(id) {
  ControlGet, v, Visible, , PokerStarsButtonClass6, ahk_id%id%
  if ( v = 1 ) {
    ControlClick, PokerStarsButtonClass6, ahk_id%id%
    WinWait, Tournament Registration ahk_class #32770, , 10
    {
      WinGet, regid, id
      ControlFocus, Button1, ahk_id%regid%
      Sleep, -1
      ControlSend, Button1, {SPACE}, ahk_id%regid%
      sleep, 10
      ControlFocus, Button2, ahk_id%regid%
      Sleep, -1
      ControlSend, Button2, {SPACE}, ahk_id%regid%  
    }
    WinWait, Tournament Registration ahk_class #32770, , 10
    {
      WinGet, regid, id           
      ControlGetText, ctext, Button1, ahk_id%regid%
      if ( cText = "OK" ) {
        ControlFocus, Button1, ahk_id%regid%
        Sleep, -1
        ControlSend, Button1, {SPACE}, ahk_id%regid%
      }        
    }
  }
}


CloseTournamentLobby(id, pid) {
  Loop {
    IfWinExist, Lobby ahk_pid%pid%,, PokerStars Lobby
      WinClose
    else
      break
  }
  Sleep, 100
  WinGet, state, MinMax, ahk_id%id%
  if ( state = 1 || state = 0 )
    WinMinimize, ahk_id%id%
}


;=====================================================================
;=================== Join Cashgame Functions =========================
;=====================================================================


OpenJoinUnJoinTable(id) {
  ControlGet, v, Visible, , PokerStarsButtonClass3, ahk_id%id%
  if ( v = 1 ) {
    ControlClick, PokerStarsButtonClass3, ahk_id%id%
    WinWait, Waiting List ahk_class #32770, , 10
    {
      WinGet, joinid, id
      ControlFocus, Button1, ahk_id%joinid%
      Sleep, -1
      ControlSend, Button1, {SPACE}, ahk_id%joinid%
    }
  }
  else {
    ControlGet, v, Visible, , PokerStarsButtonClass2, ahk_id%id%
    if ( v = 1 ) {
      ControlClick, PokerStarsButtonClass2, ahk_id%id%
    }
    else {
      ControlGet, v, Visible, , PokerStarsButtonClass8, ahk_id%id%
      if ( v = 1 ) {
        ControlClick, PokerStarsButtonClass8, ahk_id%id%
      } 
    }
  }
}


;=====================================================================
;=================== Popup Functions =================================
;=====================================================================

PopUpWatcher:
  If ( KillPopups = 1 )
    KillPopUps(LobbyPID)
  if ( AutoTakeSeat = 1 )
    TakeSeat(LobbyPID)
return

KillPopUps(pid) {
  IfWinExist, PokerStars ahk_class #32770 ahk_pid%pid%
  {
    WinGet, list1, list, PokerStars ahk_class #32770 ahk_pid%pid%, , Lobby
    Loop, %list1%
    {
      This_id := list1%A_Index%
      WinGet, list2, ControlList, ahk_id%this_id%
      if (InStr(list2, "Button2"))  {
        continue
      }
      else {
        Loop, 20
        {
          ControlFocus, Button1, ahk_id%this_id%
          Sleep, -1
          ControlSend, Button1, {SPACE}, ahk_id%this_id%
          Sleep, 100
          IfWinNotExist, ahk_id%this_id%
          {
            break
          }
        }
      }
    }
  }
}

TakeSeat(pid) {
  IfWinExist, PokerStars ahk_class #32770 ahk_pid%pid%
  {
    WinGet, list, list, Seat Available ahk_class #32770 ahk_pid%pid%
    Loop, %list%
    {
      This_id := list%A_Index%
      ControlFocus, Button1, ahk_id%this_id%
       Sleep, -1
      ControlSend, Button1, {SPACE}, ahk_id%this_id%
    }
  }
}


;=====================================================================
;=================== Lobby & Tables Functions ========================
;=====================================================================

RefreshLobby:
  WinGet, LobbyID, id, PokerStars Lobby
  WinGet, LobbyPID, PID, ahk_id%LobbyID%
return

MaxMinLobby(id) {
  WinGetActiveTitle, title
  IfInString, title, PokerStars Lobby
  {
    WinMinimize,ahk_id%id%
  }
  else {
    WinActivate, ahk_id%id%
  }
} 

TableIDListStars(pid)
{
  WinGet, list, list, / ahk_pid%pid%, , Lobby
  Loop %list%
  {
    this_id := list%a_index%
    If (this_id != id)
    {
      ids = %ids%,%this_id%
    }
  }
  StringTrimLeft, ids, ids, 1
  return ids
}
StarsAssistant mod with dual monitor slider like MTH Quote
05-08-2008 , 07:05 AM
here's a generic that will work for any site, highly commented. you gotta change the user variables a little way down for other than pokerstars. it depends only on active window so make sure your windows get activated, some setting in pokerstars, and get your layout set and then start the program otherwise when you drag a window it will activate it and then program will kick in.



Code:
;get active window
;restore size then return old active window if necessary
;if same active window return (it's already been slid)
;if active window maximized return
;if title doesn't make it poker window then return 
;save coords and ID of new active window
;move active window to wherever
;maximize
;return

#Persistent
#SingleInstance Ignore
#NoEnv

interval := 333         ; period between refreshes
SetTitleMatchMode 2 ; can be substring
DetectHiddenWindows, on

Loop 
{
  Check()
  Sleep %interval%  
}

Check()
{
;;;;;;;;;; USER VARIABLES ;;;;;;;;;;;;;;;;;;;;;;
  substring = - Logged In as 				; needed text in title for in title
  substring2 = Lobby 					; excluded text in title
  xt := 0						; where to move
  yt := 0						; where to move
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  static ID_old := 0  					; window that lost focus that needs to go back 
  static xo := 0      					; return x coords
  static yo := 0      					; return y coords

  WinGet, active_id, ID, A  				; get active window
  if (active_id = ID_old)   				; if active window is same active window as last time then return
    {
      return
    }
    
  if (ID_old != 0) 					; if we have a window we need to move back
  {
    WinHide, ahk_id %ID_old% 				; so you don't have to watch window restore
    PostMessage, 0x112, 0xF030,,, ahk_id %ID_old%,    	; winmaximize which restores for pokerstars
    ;PostMessage, 0x112, 0xF120,,, ahk_id %ID_old%,   	; normal winrestore for others
    Sleep, 0  						; gets the postmessage processed
    WinMove, ahk_id%ID_old%,, xo , yo , 		; send window back to normal
    WinShow, ahk_id %ID_old%
    ID_old := 0  
  }

  WinGet, mm, MinMax, ahk_id %active_id% 		; 1 means maximized, if active window is max then ignore
  if ( mm = 1 ) 
    {
      return
    }

  WinGetTitle, title, ahk_id %active_id% 		; get our active windows title

  IfNotInString, title, %substring% 			; needs substring in there else ignore(make sure poker table)
   {	
     return
   }
  IfInString, title, %substring2%   			; if substring2 in there then ignore (ignore lobby)
   {
     return
   }

  WinGetPos, x, y,w,h, ahk_id%active_id% 		; get coords of our active window
  xo := x
  yo := y               				; save these to send it back once it is no longer active
  ID_old := active_id
  
  WinHide, ahk_id %active_id% 				; so you don't have to watch window maximize 
  WinMove, ahk_id%active_id%,, xt ,yt  ,  		; move active window where you want it
  PostMessage, 0x112, 0xF030,,, ahk_id %active_id%, 	; maximize
  Sleep, 0 						; gets the postmessage processed
  WinShow, ahk_id %active_id%
  WinActivate, ahk_id %active_id%  			; keep it active otherwise it will auto move back
}
StarsAssistant mod with dual monitor slider like MTH Quote
05-09-2008 , 02:03 AM
ok latest probably final version here.

to recap:
slider, with option to max or not
fixed detect allin/fixed limit
auto stars info refresh

Code:
; #### StarsAssistant ####

; AHK version: 1.0.46.05
; date: January 05,2008
  version := "0.88"
; author: Chris228 @ 2p2 forums
; thx to _dave_, JBOPoker, Roland, JukofYork & pusteblume

; based on

; #### StarsUrgentTable ####

; AHK version: 1.0.46.03
; date: May 24,2007
; version: 0.75a
; author: _dave_ @ 2p2 forums
; revised by: JBOPoker @ earthlink.net
; thx to Roland & JukofYork for some of the functions


;=====================================================================
;=================== Settings ========================================
;=====================================================================

; Hotkeys see below

; Border of the "Highlighter"
border_colour := "ffff00"
border_size := 8
trans := 255

; Timings for the "Time Bank Clicker" [fast/turbo 8/17; normal 20/35; both 8/35] (10/13 old settings)
timebank_min := 10
timebank_max := 13

; Beep on urgent table
beep := 0

; Position of the mouse in perc of the table window
x_mouse := 0.50
y_mouse := 0.75

; Don't edit below unless you know what you do (except Hotkeys)

; Gui Settings
settings() {
  global
  ini:="StarsAssistant.ini"
  iniRead, AutoOn, %ini%, Prefs, AutoOn, 1
  iniRead, Slider, %ini%, Prefs, Slider, 0 ;brad
  iniRead, SliderMax, %ini%, Prefs, SliderMax, 0 ;brad
  iniRead, InfoRefresh, %ini%, Prefs, InfoRefresh, 0 ;brad
  iniRead, Highlight, %ini%, Prefs, Highlight, 1
  iniRead, MoveMouse, %ini%, Prefs, MoveMouse, 0
  iniRead, TimeBankClicker, %ini%, Prefs, TimeBankClicker, 0
  iniRead, AlternateDetection, %ini%, Prefs, AlternateDetection, 1
  iniRead, ActivateUrgent, %ini%, Prefs, ActivateUrgent, 0
  iniRead, KillPopups, %ini%, Prefs, KillPopups, 1
  iniRead, SafeReg, %ini%, Prefs, SafeReg, 1
  iniRead, AutoTakeSeat, %ini%, Prefs, AutoTakeSeat, 0
}

; Intervalls for sub execution
RefreshQueue_timer := 333
RefreshLobby_timer := 1000
PopUpWatcher_timer := 200
TableColor_timer := 500

;=====================================================================
;=================== Autoexec ========================================
;=====================================================================

#NoEnv
#SingleInstance, Force
#Include %a_scriptDir%
SendMode Input

SetTitleMatchMode, 2

SetWorkingDir %a_scriptDir%
OnExit exitSub

settings()
TrayMenu()
BuildGui()

Suspend, On

SysGet, border, 32
SysGet, caption, 4

if ( AutoOn = 1 ) {
  Gosub, ButtonOn
}

return


;=====================================================================
;=================== Hotkeys =========================================
;=====================================================================

^a::
  ToggleCheckbox("MoveMouse")
return

^w::
  ToggleCheckbox("AlternateDetection")
return

^s::
  MaxMinLobby(LobbyID)
return

^d::
  MinMaxStarsAssistant()
return

^z::
  RegSNG(LobbyID)
  OpenJoinUnJoinTable(LobbyID)
return

^e::
  CloseTournamentLobby(LobbyID, LobbyPID)
return

MButton::
  RegSNG(LobbyID)
  OpenJoinUnJoinTable(LobbyID)
return

;=====================================================================
;=================== Gui =============================================
;=====================================================================

trayMenu() {
  global
  Menu, Tray, Standard
  Menu, Tray, Add, &Show, Show
  Menu, Tray, default, &Show
  Menu, Tray, Add
  Menu, Tray, Add, &About, About
  Menu, Tray, Add, &Help, Help
  Menu, Tray, Add
  Menu, Tray, Add, E&xit, Exit
  Menu, Tray, Tip, StarsAssistant v%version%
}

buildGui() {
  global
  Gui 1:Default
  Gui, +toolwindow +AlwaysOnTop
  Gui, Margin, 5, 5
  Gui, Font,, Verdena
  Gui, Add, Button, vOn section w56 h20 center, &On
  Gui, Add, Button, vOff disabled w56 h20 ys xs+56 center, &Off
  Gui, Add, Checkbox, checked%AutoOn% vAutoOn gSubmit xs+2, &Auto on
  Gui, Add, Text, section x7 0x1000 w110 h2
  Gui, Add, Checkbox, checked%Slider% vSlider gSubmit xs, &Slider ;brad
  Gui, Add, Checkbox, checked%SliderMax% vSliderMax gSubmit xs, &SliderMax ;brad
  Gui, Add, Checkbox, checked%InfoRefresh% vInfoRefresh gSubmit xs, &InfoRefresh ;brad
  Gui, Add, Checkbox, checked%Highlight% vHighlight gSubmit xs, &Highlight table
  Gui, Add, Checkbox, checked%MoveMouse% vMoveMouse gSubmit xs, &Move mouse
  Gui, Add, Checkbox, checked%TimeBankClicker% vTimeBankClicker gSubmit xs, &Click time bank
  Gui, Add, Checkbox, checked%AlternateDetection% vAlternateDetection gSubmit xs, &Detect All-in/Fixed l.
  Gui, Add, Checkbox, checked%ActivateUrgent% vActivateUrgent gSubmit xs, &Activate urgent table
  Gui, Add, Checkbox, checked%KillPopups% vKillPopups gSubmit xs, &Kill popups
  Gui, Add, Checkbox, checked%SafeReg% vSafeReg gSubmit xs, &Safe SNG regist.
  Gui, Add, Checkbox, checked%AutoTakeSeat% vAutoTakeSeat gSubmit xs, &Auto take seat  
  IniRead, x, % ini, Gui, x, center
  IniRead, y, % ini, Gui, y, center
  Gui, Show, x%x% y%y% w124, StarsAssistant
}

Show:
  Gui, 1:Show
return

About:
  Msgbox,, StarsAssistant, StarsAssistant v%version% `nAuthor: Chris228 @ 2+2 formus`nE-Mail: chris228@gmx.de`nSee file for further credits`n`nIf you like my program I would be happy about a donation.`nMy screenname on PokerStars is 'mr.cray'.`nThank you!
return

Help:
  Run % web() "http://overcards.com/wiki/moin.cgi/StarsAssistant"
return

web() { ; by Titan, modified by Roland
  regRead, p, HKCR, HTTP\shell\open\command
  return SubStr(p, 1, InStr(p, ".exe")+4)
}

Exit:
exitApp

GuiClose:
  Gui 1:Cancel 
return

Submit:
  Gui, 1:Submit, NoHide
return

exitSub:
  Gui 1:Default
  Gui, Submit
  Gui +lastfound
  WinGetPos, x, y
  IniWrite, % x, % ini, Gui, x
  IniWrite, % y, % ini, Gui, y
  IniWrite, % AutoOn, % ini, Prefs, AutoOn
  IniWrite, % Slider, % ini, Prefs, Slider ;brad
  IniWrite, % SliderMax, % ini, Prefs, SliderMax ;brad
  IniWrite, % InfoRefresh, % ini, Prefs, InfoRefresh ;brad
  IniWrite, % Highlight, % ini, Prefs, Highlight
  IniWrite, % MoveMouse, % ini, Prefs, MoveMouse
  IniWrite, % TimeBankClicker, % ini, Prefs, TimeBankClicker
  IniWrite, % AlternateDetection, % ini, Prefs, AlternateDetection
  IniWrite, % ActivateUrgent, % ini, Prefs, ActivateUrgent
  IniWrite, % KillPopups, % ini, Prefs, KillPopups
  IniWrite, % SafeReg, % ini, Prefs, SafeReg
  IniWrite, % AutoTakeSeat, % ini, Prefs, AutoTakeSeat  
exitApp

MinMaxStarsAssistant() {
  WinGetActiveTitle, title
  If ( title = "StarsAssistant" )
    Gui 1:Cancel 
  else
    Gui, 1:Show
}

ToggleCheckbox(box) {
  Gui 1:Default
  GuiControlGet, state, , %box%
  if ( state = 1 )
    GuiControl, , %box%, 0
  if ( state = 0 )
    GuiControl, , %box%, 1
  Gui, 1:Submit, NoHide
}

;=====================================================================
;=================== Buttons =========================================
;=====================================================================

ButtonOn:
  tablecolor:= ""
  last_table_id := ""
  tablequeue := ""
  most_urgent_table := ""
  GoSub, RefreshLobby
  GoSub, TableColor
  SetTimer, RefreshQueue, %RefreshQueue_timer%
  SetTimer, PopUpWatcher, %PopUpWatcher_timer%
  SetTimer, RefreshLobby, %RefreshLobby_timer%
  Suspend, Off
  GuiControl, 1:Disable, On
  GuiControl, 1:Enable, Off
return
  
ButtonOff:
  SetTimer, RefreshQueue, Off
  SetTimer, PopUpWatcher, Off
  SetTimer, RefreshLobby, Off
  SetTimer, TableColor, Off
  Gui, 2: Cancel
  Gui, 3: Cancel
  Gui, 4: Cancel
  Gui, 5: Cancel
  tablecolor:=""
  Suspend, On
  GuiControl, 1:Disable, Off
  GuiControl, 1:Enable, On
return


;=====================================================================
;=================== Urgent Table Functions ==========================
;=====================================================================

RefreshQueue:
  ids := TableIDListStars(LobbyPID)
  Loop, Parse, tablequeue, `,
  {
    StringTrimLeft, this_id, A_LoopField, InStr(A_LoopField, "_")
    if (!InStr(ids, this_id))
    {
      StringReplace, tablequeue, tablequeue, %A_LoopField%, , All
    }
  }
  Loop, Parse, ids, `,
  {
    ControlGet, v, Visible, , PokerStarsSliderEditorClass1, ahk_id%A_LoopField%
    if ( v = 1 )
    {  
      if (!InStr(tablequeue, A_LoopField))
      {
        DllCall("QueryPerformanceCounter", "Int64 *", CurrentQPC)
        tablequeue := tablequeue . "," . CurrentQPC . "-" . A_TickCount . "_" . A_LoopField
      }
    }
    else
    {
      if ( AlternateDetection = 1 ) {
        color:=TableColor(A_LoopField)
        if ( color != tablecolor && tablecolor != "" ) {
          if (!InStr(tablequeue, A_LoopField))
          {
            DllCall("QueryPerformanceCounter", "Int64 *", CurrentQPC)
            tablequeue := tablequeue . "," . CurrentQPC . "-" . A_TickCount . "_" . A_LoopField
          }
        }
        else {        
          if (InStr(tablequeue, A_LoopField))
          {
            StringReplace, tablequeue, tablequeue, %A_LoopField%, , All
          }
        } 
      } 
      else {
        if (InStr(tablequeue, A_LoopField))
        {
          StringReplace, tablequeue, tablequeue, %A_LoopField%, , All
        }
      }
    }
  }
  tmp := ""
  Loop, Parse, tablequeue, `,
  {
    if (InStr(A_LoopField, "0x"))
    {
      tmp := tmp . "," . A_LoopField 
    }
  }
  Sort, tmp, N D`,
  tablequeue := CleanList(tmp)
  most_urgent_table := ""
  Loop, Parse, tablequeue, `,
  {
    StringTrimLeft, most_urgent_table, A_LoopField, InStr(A_LoopField, "_")
    break
  }
  if ( TimeBankClicker = 1 ) {
    tc := A_TickCount
    Loop, Parse, tablequeue, `,
    {
      StringTrimLeft, waiting_time, A_LoopField, InStr(A_LoopField, "-")
      StringTrimRight, waiting_time, waiting_time, ( StrLen(waiting_time) - (InStr(waiting_time, "_")-1) )
      waiting_time := (tc - waiting_time) / 1000
      if (waiting_time > timebank_min && waiting_time < timebank_max)
      {
        StringTrimLeft, waiting_table, A_LoopField, InStr(A_LoopField, "_")
        timebank_x := 560  ; lastmax 565
        timebank_y := 430  ; lastmax 430 +/-10 too much
        relStarsClientPoint(waiting_table, timebank_x, timebank_y)
        PostLeftClick(timebank_x, timebank_y, waiting_table, 0)
      }  

if (waiting_time > timebank_max+5) ;18)
    {

      SoundPlay, timebankclick.wav ;brad
    }
    
    }
  }
  if ( ActivateUrgent = 1 ) {
    WinActivate, ahk_id%most_urgent_table%
    if ( AlternateDetection = 1 ) {
      color:=TableColor(most_urgent_table)
      if ( color != tablecolor ) {
        if ( Slider = 1 || Highlight = 1 || MoveMouse = 1)
        makegui(most_urgent_table, Slider,SliderMax,InfoRefresh, Highlight, MoveMouse, beep, x_mouse, y_mouse)
      }
    }
    else {
      if ( Slider = 1 || Highlight = 1 || MoveMouse = 1)
      makegui(most_urgent_table, Slider,SliderMax,InfoRefresh, Highlight, MoveMouse, beep, x_mouse, y_mouse)
    }
  }
  else {
    if ( Slider = 1 || Highlight = 1 || MoveMouse = 1)
    makegui(most_urgent_table,Slider,SliderMax,InfoRefresh,  Highlight, MoveMouse, beep, x_mouse, y_mouse)
  }
return



;makegui(id="", Highlight=1, MoveMouse=1, beep=0, x_mouse=0.75, y_mouse=0.75 ) {
makegui(id="", Slider =1, SliderMax =1,InfoRefresh=1, Highlight=1, MoveMouse=1, beep=0, x_mouse=0.75, y_mouse=0.75 ) {   ;brad
  global last_table_id
  global border_colour
  global border_size
  global trans
  global Xcoord ;brad
  global Ycoord ;brad
  global Mcoord ;brad
  global RestoreID ; brad
  global ActiveWindow ;brad
  global xi
  global yi

  if (id != last_table_id)
  {
       if (!RestoreID)   	;brad
           { 			;brad
               goto UGLY 	;brad
           }			;brad
DetectHiddenWindows, on ;brad
      WinHide, ahk_id %RestoreID% ;brad
      if ( Mcoord = 1 ) 
        {
          ;WinRestore , ahk_id %RestoreID% ;brad
          ;PostMessage, 0x112, 0xF120,,, ahk_id %RestoreID%, ;brad
          ;WinMaximize , ahk_id %RestoreID% ;brad
          PostMessage, 0x112, 0xF030,,, ahk_id %RestoreID%, ;brad
         }
      Sleep, 0 ; brad
      WinMove, ahk_id %RestoreID%,, Xcoord, Ycoord,  ; brad
      WinShow, ahk_id %RestoreID% ;brad
      ;;WinActivate, ahk_id %ActiveWindow% ;brad
      RestoreID :=0
      Mcoord := 0
DetectHiddenWindows, off ;brad
UGLY:
    last_table_id := id
    
    if(!id) ; if (id=0 or id="") 
    {
      Gui, 2: Cancel
      Gui, 3: Cancel
      Gui, 4: Cancel
      Gui, 5: Cancel
      return
    }
    
    global border
    global caption
    if (InfoRefresh = 1)
      {
	xi := 222                           ;click  info for tourneys
	yi := 440
	xi := xi  -( border/2 )                         
	yi := yi -( border+caption )
        relStarsClientPoint(id, xi, yi)
        PostLeftClick(xi, yi, id, 0)

        ;global border
        ;global caption
	xi := 222                           ;click  refresh for tourneys
	yi := 465
	xi := xi  -( border/2 )                         
	yi := yi -( border+caption )
        relStarsClientPoint(id, xi, yi)
        PostLeftClick(xi, yi, id, 0)
      }

    WinGetPos, x, y, w, h, ahk_id%id% 	
    ;global border
    ;global caption
    x := x + border
    y := y + border + caption
    w := w - (2*border)
    h := h - (2*border) - caption
    

    ;Makes Border around urgent table
    if ( Highlight = 1 ) {
    ;if ( Highlight = 999 ) { ; brad
      ;top
      guinum := 2
      Gui, %guinum%: +Alwaysontop +Lastfound +Owner
      Gui, %guinum%: Color, %border_colour%
      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_colour%
      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_colour%
      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_colour%
      WinSet, Transparent, %trans%
      Gui, %guinum%: -Caption
      x2 := x + w - border_size
      Gui, %guinum%: Show, w%border_size% h%h% x%x2% y%y% NoActivate
    
    }

WinGetPos, x, y, w, h, ahk_id%id%
    if (Slider = 1)	;brad
      {			;brad
    	Xcoord :=x ;brad
    	Ycoord :=y ;brad
    	RestoreID := id ;brad  
    	x :=0 ;brad	
    	y :=0 ;brad	
	DetectHiddenWindows, on ; brad
    	WinHide, ahk_id %id% ;brad
    	WinMove,ahk_id %id%,, x, y ;brad
        if(SliderMax = 1)	
    	  {
            ;WinMaximize , ahk_id %id% ;brad
    	    PostMessage, 0x112, 0xF030,,, ahk_id %id%, ;brad
            Mcoord := 1
          }
    	Sleep, 0 ; brad
    	WinShow, ahk_id %id% ;brad
	;;WinGet, ActiveWindow, ID, A ;brad
    	WinActivate, ahk_id %id% ;brad
	DetectHiddenWindows, off ; brad
      }	;brad
        
    ;Puts mouse pointer nearer the bet buttons
    if ( MoveMouse = 1) {
      x3 := x + (w * x_mouse)
      y3 := y + (h * y_mouse)
      Coordmode, Mouse, Screen
      MouseMove, x3, y3, 0
    }
    
    ;Beeps on urgent table
    if ( beep = 1 )
      SoundBeep, 750, 100
      ;SoundPlay, timebankclick.wav ;brad
  }
}

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


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%
PostMessage, 0x201, 0x0001, ((y<<16)^x), %control_class%, ahk_id%table_id%
PostMessage, 0x202 , 0, ((y<<16)^x), %control_class%, ahk_id%table_id%
}

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

TableColor(id) {
  CoordMode, Pixel, Screen
  WinGetPos, x, y, w, h, ahk_id%id%
  rw := 800
;rh := 578
;
rh := 573 ; brad
  ;x := x+475
  ;y := y+555
  ;x := Floor( (x / rw ) * w )
  ;y := Floor( (y / rh) * h  )

x := Floor( x + ( (475* w) / rw )   ) ;brad
y := Floor( y + ( (555* h) / rh )   ) ;brad

  PixelGetColor, color, %x%, %y%, RGB
  ;tooltip %x% %y% %color%
  return color
}

TableColor:
  tableids := TableIDListStars(LobbyPID)
  Loop, Parse, tableids, `,
  {
    ControlGet, v, Visible, , PokerStarsSliderEditorClass1, ahk_id%A_LoopField%
    if ( v != 1 ) {
      WinActivate, ahk_id%a_loopfield%
      sleep, 500
      tablecolor:=TableColor(a_loopfield)
      break
    }      
  }
;Msgbox, %tablecolor%
  if ( tablecolor != "" )
    SetTimer, TableColor, Off
  else
    SetTimer, TableColor, %TableColor_timer%
return


;=====================================================================
;=================== SNG Registration Functions ======================
;=====================================================================

RegSNG(id) {
  if ( SafeReg = 1 ) {
    IfWinActive, ahk_id%id%
      RegSNGexec(id)
  }
  else {
    RegSNGexec(id)
  }
}

RegSNGexec(id) {
  ControlGet, v, Visible, , PokerStarsButtonClass6, ahk_id%id%
  if ( v = 1 ) {
    ControlClick, PokerStarsButtonClass6, ahk_id%id%
    WinWait, Tournament Registration ahk_class #32770, , 10
    {
      WinGet, regid, id
      ControlFocus, Button1, ahk_id%regid%
      Sleep, -1
      ControlSend, Button1, {SPACE}, ahk_id%regid%
      sleep, 10
      ControlFocus, Button2, ahk_id%regid%
      Sleep, -1
      ControlSend, Button2, {SPACE}, ahk_id%regid%  
    }
    WinWait, Tournament Registration ahk_class #32770, , 10
    {
      WinGet, regid, id           
      ControlGetText, ctext, Button1, ahk_id%regid%
      if ( cText = "OK" ) {
        ControlFocus, Button1, ahk_id%regid%
        Sleep, -1
        ControlSend, Button1, {SPACE}, ahk_id%regid%
      }        
    }
  }
}


CloseTournamentLobby(id, pid) {
  Loop {
    IfWinExist, Lobby ahk_pid%pid%,, PokerStars Lobby
      WinClose
    else
      break
  }
  Sleep, 100
  WinGet, state, MinMax, ahk_id%id%
  if ( state = 1 || state = 0 )
    WinMinimize, ahk_id%id%
}


;=====================================================================
;=================== Join Cashgame Functions =========================
;=====================================================================


OpenJoinUnJoinTable(id) {
  ControlGet, v, Visible, , PokerStarsButtonClass3, ahk_id%id%
  if ( v = 1 ) {
    ControlClick, PokerStarsButtonClass3, ahk_id%id%
    WinWait, Waiting List ahk_class #32770, , 10
    {
      WinGet, joinid, id
      ControlFocus, Button1, ahk_id%joinid%
      Sleep, -1
      ControlSend, Button1, {SPACE}, ahk_id%joinid%
    }
  }
  else {
    ControlGet, v, Visible, , PokerStarsButtonClass2, ahk_id%id%
    if ( v = 1 ) {
      ControlClick, PokerStarsButtonClass2, ahk_id%id%
    }
    else {
      ControlGet, v, Visible, , PokerStarsButtonClass8, ahk_id%id%
      if ( v = 1 ) {
        ControlClick, PokerStarsButtonClass8, ahk_id%id%
      } 
    }
  }
}


;=====================================================================
;=================== Popup Functions =================================
;=====================================================================

PopUpWatcher:
  If ( KillPopups = 1 )
    KillPopUps(LobbyPID)
  if ( AutoTakeSeat = 1 )
    TakeSeat(LobbyPID)
return

KillPopUps(pid) {
  IfWinExist, PokerStars ahk_class #32770 ahk_pid%pid%
  {
    WinGet, list1, list, PokerStars ahk_class #32770 ahk_pid%pid%, , Lobby
    Loop, %list1%
    {
      This_id := list1%A_Index%
      WinGet, list2, ControlList, ahk_id%this_id%
      if (InStr(list2, "Button2"))  {
        continue
      }
      else {
        Loop, 20
        {
          ControlFocus, Button1, ahk_id%this_id%
          Sleep, -1
          ControlSend, Button1, {SPACE}, ahk_id%this_id%
          Sleep, 100
          IfWinNotExist, ahk_id%this_id%
          {
            break
          }
        }
      }
    }
  }
}

TakeSeat(pid) {
  IfWinExist, PokerStars ahk_class #32770 ahk_pid%pid%
  {
    WinGet, list, list, Seat Available ahk_class #32770 ahk_pid%pid%
    Loop, %list%
    {
      This_id := list%A_Index%
      ControlFocus, Button1, ahk_id%this_id%
       Sleep, -1
      ControlSend, Button1, {SPACE}, ahk_id%this_id%
    }
  }
}


;=====================================================================
;=================== Lobby & Tables Functions ========================
;=====================================================================

RefreshLobby:
  WinGet, LobbyID, id, PokerStars Lobby
  WinGet, LobbyPID, PID, ahk_id%LobbyID%
return

MaxMinLobby(id) {
  WinGetActiveTitle, title
  IfInString, title, PokerStars Lobby
  {
    WinMinimize,ahk_id%id%
  }
  else {
    WinActivate, ahk_id%id%
  }
} 

TableIDListStars(pid)
{
  WinGet, list, list, / ahk_pid%pid%, , Lobby
  Loop %list%
  {
    this_id := list%a_index%
    If (this_id != id)
    {
      ids = %ids%,%this_id%
    }
  }
  StringTrimLeft, ids, ids, 1
  return ids
}
StarsAssistant mod with dual monitor slider like MTH Quote
05-09-2008 , 11:11 AM
nice job man!!
StarsAssistant mod with dual monitor slider like MTH Quote
06-03-2008 , 04:10 AM
shweeet!
StarsAssistant mod with dual monitor slider like MTH Quote
06-06-2008 , 04:18 PM
Sorry, I'm all thumbs with AHK.

Does the last script work with FullTilt? I did see, nor do I think I could manipulate script to work. What tweaks do I need to make?

I made StarsAsst.ahk and can start the program. I clicked Auto on and slider.

Started StarsAsst.ahk
Started FTP
Opened up six tables an spread them out across my four monitors, leaving upper left (0,0?) open.

When all six tables were going, none of the tables moved. When I had overlap tables, the active table would come to the front.

Anyway, can you spell out the tweaks for FTP or am I doing something wrong?
StarsAssistant mod with dual monitor slider like MTH Quote
06-07-2008 , 12:50 AM
Quote:
Originally Posted by King Spew
Sorry, I'm all thumbs with AHK.

Does the last script work with FullTilt? I did see, nor do I think I could manipulate script to work. What tweaks do I need to make?

I made StarsAsst.ahk and can start the program. I clicked Auto on and slider.

Started StarsAsst.ahk
Started FTP
Opened up six tables an spread them out across my four monitors, leaving upper left (0,0?) open.

When all six tables were going, none of the tables moved. When I had overlap tables, the active table would come to the front.

Anyway, can you spell out the tweaks for FTP or am I doing something wrong?
use the generic script i posted on 05-08-2008, 07:05 AM

change substring and substring2 so the script can tell what is fulltilt lobby and what is fulltilt table. just look at the title of the window.

Quote:
;;;;;;;;;; USER VARIABLES ;;;;;;;;;;;;;;;;;;;;;;
substring = - Logged In as ; needed text in title for in title
substring2 = Lobby ; excluded text in title
xt := 0 ; where to move
yt := 0 ; where to move
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
StarsAssistant mod with dual monitor slider like MTH Quote
06-07-2008 , 04:12 AM
I would fire up FT real quick and try it but I don't have any money on there so I don't wanna give a bad solution like if I did play money and real money was different.
StarsAssistant mod with dual monitor slider like MTH Quote
06-07-2008 , 05:52 AM
PM me your FTP details and I'll ship you a buck or two
StarsAssistant mod with dual monitor slider like MTH Quote
07-23-2008 , 07:20 PM
k, im using the 5-08 script, and im looking to customize where the active table goes. idealy i wud like all my tables on one monitor, and to have the active table on my other monitor (at a bigger size, both monitor and table)...just not sure how to fully go about this...thnx!

(also, plz PM ur FTP details as well so i can donate sumtin for this awesome program)

*SS*
StarsAssistant mod with dual monitor slider like MTH Quote
07-23-2008 , 08:10 PM
I've been meaning to write something like this, but with tables requiring postflop action staying on one screen. Anyone wanna try it? It would require retrieving pixel colors where the flop/turn/rivers are (a la BetPot) and skipping the Restore part until the hand is over.
StarsAssistant mod with dual monitor slider like MTH Quote
07-23-2008 , 09:48 PM
Quote:
Originally Posted by Paul B.
I've been meaning to write something like this, but with tables requiring postflop action staying on one screen. Anyone wanna try it?
I will have a go I think I made what I thought would be a sweet mod of this that hid tables entirely and just swapped the most urgent one into sight, was able to 20-table 6max on it easily (massive tables, easy to read) but forgetting past action hurt a lot and lead to very nitty robot play, so did not use it for long. With all postflop tables still showing, it could be awesome - much less "whack-a-mole", but still plenty more screen space, possibly.

Quote:
It would require retrieving pixel colors where the flop/turn/rivers are (a la BetPot) and skipping the Restore part until the hand is over.
i'm thinking it would require pixel-spotting of your own cards - do not care about flop/turn/river if we've folded, no? or could you explain further what you mean, I can't imagine much would happen detecting board cards since there is nearly always something going on...
StarsAssistant mod with dual monitor slider like MTH Quote

      
m