Open Side Menu Go to the Top
Register
TableNavigator TableNavigator

02-09-2006 , 02:15 PM
Okay, I decided to check out this mousless poker thing the other day because my mouse seemed kinda slow and it was pissing me off. Apparently I’m too stupid to play in the activated table only though - lots of misclicks - so I needed something to navigate from table to table.
I found a script that does exactly that - MrMoos - but figured using the standard table size would be problematic with resizing tables and all; besides, I find the idea of having the cursor jumping around all the time when playing “mousless” kinda unappealing (I’m a perfectionist ). Lastly, I wanted some kind of visible cue as to what table I was actually playing in, because I’m really slow. So I wrote this script.

It places a colored bar on the title bar of a table (similar to what MTH does) which you can move from table to table using the up-down-left-right keys. The variable “def_t” (for default_table) in the script always contains the unique ID of the table under the bar; it should be easy to modify existing clicking scripts to use the ahk_id instead of the window title (ControlClick, <SomeControl>, ahk_id%def_t%).

The script assumes that the tables are all roughly the same size (like when you use the “tile”-button on the Beta), that you’re playing without overlap and that you’re setup looks something like this:

T - T - T
T - T - T
T - T - T

i.e. that there are no more that three tables in one row or column. It also assumes that you are playing no more that 9 tables (because that’s the number you can have without overlap on a 1600x1200 screen; I only have one screen, so if you want to use this on a multi-screen setup or for more that 9 tables you’ll have to modify the script).
That said, it’s pretty flexible so just play around with it a bit and see what it will do.

Okay, that’s about it. Keep in mind that I haven’t tested this extensively or anything so it’s far from bug free. Any ideas for improvement welcome.
I didn’t post it as code because that loses the linefeeds for some reason (when you c&p).
I hope somebody likes it:

;__________________________Table Navigator_____________________

; AutoHotkey Version: 1.0.41.02
; Platform: WinXP
; Author: Roland

SysGet, size_caption, 4
SysGet, size_boarder, 32
size_titlebar := size_caption + size_boarder ;I wanted the GUI to be the same height as the titlebar and this seems to do the trick

Gui, +alwaysontop +Lastfound +Owner
Gui, Color, 00008B ;a dark blue I quite like. Change it to whatever you want
WinSet, Transparent, 200 ;make the GUI slightly transparent - looks better that way
Gui, -Caption

Gosub, get_table_list ;get the table list without waiting for the timer. That way we can...
def_t = %table_1% ;... make table_1 the default table to have a starting point
SetTimer, get_table_list, 1000 ;update table_list every second
WinGetPos, x, y, , , ahk_id%def_t%
Gui, Show, w800 h%size_titlebar% x%x% y%y% NoActivate, table_navigator ;show the GUI on table_1
SetTimer, show_hide, 200
return

;_________end of auto-execute section___________

;_________subroutines:

get_table_list:
table_list := Update_tables() ; the function returns a comma seperated list of unique window IDs
Loop, Parse, table_list, `, ;assign these IDs to the variables "table_1", "table_2" etc.
{
table_%A_Index% = %A_LoopField%
}
return

show_hide: ;hide the GUI if a) def_t doesn't exist, b) def_t is minimized or c) the active window is maximized
IfWinExist, ahk_id%def_t%
{
WinGet, is_maximised_active, MinMax, A
WinGet, is_minimized_def_t, MinMax, ahk_id%def_t%
If (is_maximised_active = 1 or is_minimized_def_t = -1)
Gui, Hide
else
Gui, Show, NoActivate
}
else
Gui, Hide
return

;_________hotkeys:

down::
key = down
def_t := GetTarget(key) ;pass "key" to the GetTarget function which returns the new def_t
WinGetPos, px, py, , , ahk_id%def_t% ;move the GUI to the new de_t
Gui, Show, w%w% x%px% y%py% NoActivate
return

up::
key = up
def_t := GetTarget(key)
WinGetPos, px, py, , , ahk_id%def_t%
Gui, Show, w%w% x%px% y%py% NoActivate
return

right::
key = right
def_t := GetTarget(key)
WinGetPos, px, py, , , ahk_id%def_t%
Gui, Show, w%w% x%px% y%py% NoActivate
return

left::
key = left
def_t := GetTarget(key)
WinGetPos, px, py, , , ahk_id%def_t%
Gui, Show, w%w% x%px% y%py% NoActivate
return

;_________functions:

Update_tables() ;this function returns "table_list" and also operates on the GUI (which is why "size_titlebar" is made global):
{
global size_titlebar

WinGet, pid, PID, Welcome to the PartyPoker.com ;retrieves the process ID (using the window title of the lobby)

WinGet, id, list, Table ahk_pid%pid% ahk_class #32770, , Welcome to the PartyPoker.com Lobby, Side Bet ;make a list of windows IDs matching ahk_pid/class, excluding the lobby
Loop, %id%
{
StringTrimRight, this_id, id%a_index%, 0 ;look familiar?
WinGetPos, x, y, w, h, ahk_id %this_id%
w -= 50 ;this allows for slight overlap or slightly different table sizes
h -= 50

If (x < a_screenwidth/6 AND y < a_screenheight/6) ;determine the table number based on its position
table_1 = %this_id%
If (x < a_screenwidth/6 AND y > a_screenheight/6 AND y < 2*h)
table_2 = %this_id%
If (x < a_screenwidth/6 AND y >= 2*h)
table_3 = %this_id%
If (x > a_screenwidth/6 AND y < a_screenheight/6 AND x < 2*w AND y < 2*h)
table_4 = %this_id%
If (x > a_screenwidth/6 AND y > a_screenheight/6 AND x < 2*w AND y < 2*h)
table_5 = %this_id%
If (x > a_screenwidth/6 AND x < 2*w AND y >= 2*h)
table_6 = %this_id%
If (y < a_screenheight/6 AND x >= 2*w)
table_7 = %this_id%
If (y > a_screenheight/6 AND x >= 2*w AND y < 2*h)
table_8 = %this_id%
If (x > a_screenwidth/6 AND x >= 2*w AND y >= 2*h)
table_9 = %this_id%
}
table_list = %table_1%,%table_2%,%table_3%,%table_4%,%table_5%, %table_6%,%table_7%,%table_8%,%table_9%
w += 50 ;reset to the actual width

;modify the GUI according to the height of the titlebar, the width of the table(s)
;(this assumes all tables are roughly the same size) and round the edges because it looks better:

WinSet, Region, w%w% h%size_titlebar% 0-0 %w%-0 %w%-%size_titlebar% 0-%size_titlebar% R20-20, table_navigator

return, table_list ;return "table_list"
}


GetTarget(key) ;this function returns the new "def_t" when passed "key"
{
global def_t ;make these two variables global
global table_list

If key = down
new_order = 123456789 ;since this is the order the tables are in anyways, new_order equals the old order in this case
If key = up
new_order = 987654321 ;"up" is the opposite of "down" so we just reverse the order
If key = right
new_order = 147258369 ;the table to the right of table_1 is table_4 etc.
If key = left
new_order = 963852741 ;reverse the order for "right"

Loop, Parse, table_list, `, ;parse table_list, assigning each substring (ID) a new table number based on the new order
{
StringMid, new_number, new_order, %a_index%, 1
table_%new_number% = %a_loopfield%
}
Loop, 9
{
StringTrimRight, table, table_%a_index%, 0 ;acces the (new) array to find out which number the def_t is in the new order
If def_t = %table%
{
table_number = %a_index%
break
}
}
Loop, 9 ;this loop finds the number of the next table in the list (target)
{
table_number++ ;for instance: if the loop above determined that the def_t is table_5, this loop looks for table_6 first;
If table_%table_number% <> ;if "table_6" is empty, it looks for table_7 and so on
{
target = %table_number%
break
}
If table_number >= 9 ;if table_number reaches 9, tables 6 through 9 didn't exist, to continue the example above
table_number = 0 ;so we search for tables 1 through 4 (table_number is set to 1 at the beginning of the next loop iteration)
}
target := table_%target% ;once we've found "target", change it to be the ID of the table (using the array created by the first loop)
IfWinExist, ahk_id%target% ;only return a new de_t if it actually still exists; else, return the old def_t
{
def_t = %target%
}
Return, def_t ;return "def_t"
}
;_______end of code


edited to show title.
-Sam
TableNavigator Quote
02-09-2006 , 02:37 PM
Awesome. I use the MTH style, so I don't think I'll personally use this, but I'm psyched to see more AHK developement on the forum. I'll check-out your code; see if there're ideas I can steal in future scripts.
-Sam
TableNavigator Quote
02-09-2006 , 05:04 PM
Quote:
I hope somebody likes it:
I do! Tyvm for posting this, will check it out later tonight

Can I ask if anybody knows if there is a thread here which lists all of the available AHK scripts (I looked before but couldn't see it, so apologize if my searching not so good... ). I would love to adapt this so that it worked on a joy-pad and just need to find the relevant AHK snippets to do it.

Juk
TableNavigator Quote
02-09-2006 , 05:23 PM
Quote:
Can I ask if anybody knows if there is a thread here which lists all of the available AHK scripts
don’t know, but you might find this old thread helpful: link

And this is from the AHK tutorial: Remapping

I myself have no experience with remapping whatsoever (just ordered a game pad, hopfully it comes tomorrow ).

On a side note, I just tried to get Sams clicking script to use ahk_id instead of the window title, but no luck. I just don’t get the SetTitleMatchMode part. What does it do?
TableNavigator Quote
02-09-2006 , 06:19 PM
Quote:
On a side note, I just tried to get Sams clicking script to use ahk_id instead of the window title, but no luck. I just don’t get the SetTitleMatchMode part. What does it do?
I'm not sure what you mean and the ahk_id vs window title. "SetTitleMatchMode" is a parameter in how it searches. It changes from "Exact match" to "Begins this way" to "Contains this string".
-Sam
TableNavigator Quote
02-09-2006 , 07:59 PM
Well, I’m still not sure why you use SetTitleMatchMode (I’m tired - getting late over here in Germany) but here goes anway:


;__________________________Table Navigator_____________________

; AutoHotkey Version: 1.0.41.02
; Platform: WinXP
; Author: Roland & SamIAm

;some of Sams functions (these have to be in the auto-execute section as I found out; so apparently they get called . Getting late, like I said).

;FOLD = 1;
newButton("fold", 1, "AfxWnd42s14") ;(
newButton("checkFoldInTurn", 1, "AfxWnd42s20")
newButton("foldInTurn", 1, "AfxWnd42s19")
;CALL = 2;
newButton("call", 2, "Call (", 1)
newButton("check", 2, "AfxWnd42s15") ;(
newButton("cInTurn", 2, "AfxWnd42s21")
;RAISE = 3;
newButton("bet", 3, "Bet", 1)
newButton("raise", 3, "Raise ", 1)
newButton("r1InTurn", 3, "AfxWnd42s23")
;LEAVE = 4;
newButton("muckNow", 4, "Muck?", 2)
newButton("sitout", 4, "Sit Out")
newButton("muckInTurn", 4, "Muck Losing/Uncalled Hands")
;STAY = 5;
newButton("back", 5, "I am Back")
newButton("waitNow", 5, "AfxWnd42s16") ;(
newButton("waitInTurn", 5, "Wait for Big Blind")
;PLAY = 6;
newButton("post", 6, "Post", 1)
newButton("show", 6, "Show", 2)
newButton("autopost", 6, "Auto Post Blind")



SysGet, size_caption, 4
SysGet, size_boarder, 32
size_titlebar := size_caption + size_boarder ;I wanted the GUI to be the same height as the titlebar and this seems to do the trick

Gui, +alwaysontop +Lastfound +Owner
Gui, Color, 00008B ;a dark blue I quite like. Change it to whatever you want
WinSet, Transparent, 200 ;make the GUI slightly transparent - looks better that way
Gui, -Caption

Gosub, get_table_list ;get the table list without waiting for the timer. That way we can...
def_t = %table_1% ;... make table_1 the default table to have a starting point
SetTimer, get_table_list, 1000 ;update table_list every second
WinGetPos, x, y, , , ahk_id%def_t%
Gui, Show, w800 h%size_titlebar% x%x% y%y% NoActivate, table_navigator ;show the GUI on table_1
SetTimer, show_hide, 200
return

;_________end of auto-execute section___________

;_________subroutines:

get_table_list:
table_list := Update_tables() ; the function returns a comma seperated list of unique window IDs
Loop, Parse, table_list, `, ;assign these IDs to the variables "table_1", "table_2" etc.
{
table_%A_Index% = %A_LoopField%
}
return

show_hide: ;hide the GUI if a) def_t doesn't exist, b) def_t is minimized or c) the active window is maximized
IfWinExist, ahk_id%def_t%
{
WinGet, is_maximised_active, MinMax, A
WinGet, is_minimized_def_t, MinMax, ahk_id%def_t%
If (is_maximised_active = 1 or is_minimized_def_t = -1)
Gui, Hide
else
Gui, Show, NoActivate
}
else
Gui, Hide
return

;_________hotkeys:

down::
key = down
def_t := GetTarget(key) ;pass "key" to the GetTarget function which returns the new def_t
WinGetPos, px, py, , , ahk_id%def_t% ;move the GUI to the new de_t
Gui, Show, w%w% x%px% y%py% NoActivate
return

up::
key = up
def_t := GetTarget(key)
WinGetPos, px, py, , , ahk_id%def_t%
Gui, Show, w%w% x%px% y%py% NoActivate
return

right::
key = right
def_t := GetTarget(key)
WinGetPos, px, py, , , ahk_id%def_t%
Gui, Show, w%w% x%px% y%py% NoActivate
return

left::
key = left
def_t := GetTarget(key)
WinGetPos, px, py, , , ahk_id%def_t%
Gui, Show, w%w% x%px% y%py% NoActivate
return

;Sams hotkeys:

!1::
clickVis(1)
return
!2::
clickVis(2)
return
!3::
clickVis(3)
return
!4::
clickVis(4)
return
!5::
clickVis(5)
return
!6::
clickVis(6)
return
!7::
debug()
return


;_________functions:

Update_tables() ;this function returns "table_list" and also operates on the GUI (which is why "size_titlebar" is made global):
{
global size_titlebar

WinGet, pid, PID, Welcome to the PartyPoker.com ;retrieves the process ID (using the window title of the lobby)

WinGet, id, list, Table ahk_pid%pid% ahk_class #32770, , Welcome to the PartyPoker.com Lobby, Side Bet ;make a list of windows IDs matching ahk_pid/class, excluding the lobby
Loop, %id%
{
StringTrimRight, this_id, id%a_index%, 0 ;look familiar?
WinGetPos, x, y, w, h, ahk_id %this_id%
w -= 50 ;this allows for slight overlap or slightly different table sizes
h -= 50

If (x < a_screenwidth/6 AND y < a_screenheight/6) ;determine the table number based on its position
table_1 = %this_id%
If (x < a_screenwidth/6 AND y > a_screenheight/6 AND y < 2*h)
table_2 = %this_id%
If (x < a_screenwidth/6 AND y >= 2*h)
table_3 = %this_id%
If (x > a_screenwidth/6 AND y < a_screenheight/6 AND x < 2*w AND y < 2*h)
table_4 = %this_id%
If (x > a_screenwidth/6 AND y > a_screenheight/6 AND x < 2*w AND y < 2*h)
table_5 = %this_id%
If (x > a_screenwidth/6 AND x < 2*w AND y >= 2*h)
table_6 = %this_id%
If (y < a_screenheight/6 AND x >= 2*w)
table_7 = %this_id%
If (y > a_screenheight/6 AND x >= 2*w AND y < 2*h)
table_8 = %this_id%
If (x > a_screenwidth/6 AND x >= 2*w AND y >= 2*h)
table_9 = %this_id%
}
table_list = %table_1%,%table_2%,%table_3%,%table_4%,%table_5%, %table_6%,%table_7%,%table_8%,%table_9%
w += 50 ;reset to the actual width

;modify the GUI according to the height of the titlebar, the width of the table(s)
;(this assumes all tables are roughly the same size) and round the edges because it looks better:

WinSet, Region, w%w% h%size_titlebar% 0-0 %w%-0 %w%-%size_titlebar% 0-%size_titlebar% R20-20, table_navigator

return, table_list ;return "table_list"
}


GetTarget(key) ;this function returns the new "def_t" when passed "key"
{
global def_t ;make these two variables global
global table_list

If key = down
new_order = 123456789 ;since this is the order the tables are in anyways, new_order equals the old order in this case
If key = up
new_order = 987654321 ;"up" is the opposite of "down" so we just reverse the order
If key = right
new_order = 147258369 ;the table to the right of table_1 is table_4 etc.
If key = left
new_order = 963852741 ;reverse the order for "right"

Loop, Parse, table_list, `, ;parse table_list, assigning each substring (ID) a new table number based on the new order
{
StringMid, new_number, new_order, %a_index%, 1
table_%new_number% = %a_loopfield%
}
Loop, 9
{
StringTrimRight, table, table_%a_index%, 0 ;acces the (new) array to find out which number the def_t is in the new order
If def_t = %table%
{
table_number = %a_index%
break
}
}
Loop, 9 ;this loop finds the number of the next table in the list (target)
{
table_number++ ;for instance: if the loop above determined that the def_t is table_5, this loop looks for table_6 first;
If table_%table_number% <> ;if "table_6" is empty, it looks for table_7 and so on
{
target = %table_number%
break
}
If table_number >= 9 ;if table_number reaches 9, tables 6 through 9 didn't exist, to continue the example above
table_number = 0 ;so we search for tables 1 through 4 (table_number is set to 1 at the beginning of the next loop iteration)
}
target := table_%target% ;once we've found "target", change it to be the ID of the table (using the array created by the first loop)
IfWinExist, ahk_id%target% ;only return a new de_t if it actually still exists; else, return the old def_t
{
def_t = %target%
}
Return, def_t ;return "def_t"
}

;the rest of Sams functions:

debug()
{
local but, num, Output
but = 1
Loop
{
if(but > numButtons)
break
num = 1
Loop
{
if(num > numButtons%but%)
break
if(visible(but,num) = 1)
Output = % Output . names%but%x%num% . " is visible.`n"
num += 1
}
but += 1
}
MsgBox %Output%
}

clickVis(button)
{
local output, i, isVis, currString, currMatch
WinGetTitle, winTitle, ahk_id%def_t%
i = 1
Loop
{
if(i > numButtons%button%)
break
if (visible(button,i) = 1)
{
currMatch := matches%button%x%i%
SetTitleMatchMode, %currMatch%
currString := strings%button%x%i%
ControlClick, %currString%, %winTitle%
break
}
i += 1
}
}

visible(but, num)
{
local currentMatch, currentString
local output
currentMatch = % matches%but%x%num%
currentString = % strings%but%x%num%
SetTitleMatchMode % currentMatch
ControlGet, output, Visible, , %currentString%, %winTitle%
if output <> 1
{
output = 0
}
return output
}
newButton(name, button, string, match=3)
{
local buttonCount
numButtons += 1
numButtons%button% += 1
buttonCount := numButtons%button%
names%button%x%buttonCount% := name
matches%button%x%buttonCount% := match
strings%button%x%buttonCount% := string
}

;_______end of code_____
TableNavigator Quote
02-09-2006 , 08:44 PM
Thanks again for this, late here too (UK), but I will test this out either tonight or tomorrow and see how I get on using it

Juk
TableNavigator Quote
02-10-2006 , 10:20 AM
Love this, TYVM!

Just tried it out on my setup and so far so good!

I do have a slight overlap on my setup (using PartyPlanner for the layout) and all was ok too!

I just made a couple of changes, but only cosmetic:

A) Using !down::, !up::, etc rather than just down:: and up::, etc. (Just did this to keep in line with Sam's functions which use ALT key as the modifier, so I can keep running the script and still use the cursor keys elsewhere in windows).

B) I altered this line to allow it to be tested on Demo Money:

WinGet, id, list, Play ahk_pid%pid% ahk_class #32770, , Welcome to the PartyPoker.com Lobby, Side Bet ;make a list of windows IDs matching ahk_pid/class, excluding the lobby Loop, %id%

Also, I only 4-table 6max atm, and just wondered if it would be possible to stop the wrap-around effect (EG: So if I am in the top left window and press up or left, the GUI just stays at the top left).

I owe you one for this!!! I tried quite a few scripts and MTH, and IMHO this is by far the best hybrid yet!

Juk
TableNavigator Quote
02-10-2006 , 11:13 AM
Glad you like it.

Quote:
I do have a slight overlap on my setup
In this case you might want to try this:

up::
key = up
def_t := GetTarget(key)
WinGetPos, px, py, , , ahk_id%def_t%
Gui, Show, w%w% x%px% y%py% NoActivate
WinActivate, ahk_id%def_t%
Return

etc....

That way you’ll be able to see the entire table.

Good ideas with the demo money and the alt-modifier, thx for sharing.

Quote:
Also, I only 4-table 6max atm, and just wondered if it would be possible to stop the wrap-around effect (EG: So if I am in the top left window and press up or left, the GUI just stays at the top left).
No problem. Getting it to work was the hard part . Do you still want it to skip from the last table in the first row to the first table in the last row etc., or should I turn that off too?


Quote:
I owe you one for this!!!
Nope. I use Auto Resizer and love it (especially the auto-rebuy) so tyvm for that mate.
TableNavigator Quote
02-10-2006 , 02:03 PM
Quote:
Nope. I use Auto Resizer and love it (especially the auto-rebuy) so tyvm for that mate.
Ty for the compliment (alot more peeps use this than I realized! ). I just sorry the interface is a bit iffy for the testing version (interfaces not my strong point...), but eventually it will be improved when I get more time (along with the code), and hopefully most of the ideas can go into another project like PartyPlanner for the long term

Overall this forum has improved my mouse strain problems ten fold or more... Only a few months ago I used to 8/10-table 800x600 tables using built-in windows cascade mode as my only aid, so huge improvement now!

Quote:
Do you still want it to skip from the last table in the first row to the first table in the last row etc., or should I turn that off too?
I think for me just 4-tabling 6max atm, then perhaps easiest for me if this is off also. BUT I can see this being useful for others so I wouldn't totally disable it Possibly could there just be an option at the top of the script to turn it on/off?

Thanks again for sharing the script - Juk
TableNavigator Quote
02-10-2006 , 04:33 PM
Need help, very confused now... (and got AHK tilt now!!! hehe)

I just tried to get this working with a joypad, but I seem to be doing something wrong

I can use the joypad buttons just fine and have adapted your script to do this, but I can't seem to get the D-Pad to control the active window.

I run of out ideas now, the script bellow seems to be capable of sending cursor keys fine (ie: it will move around icons on my desktop, or move the cursor in notepad, etc), BUT it just wont send these keys to the other script (they work in parallel somehow, so I can use the keyboard cursors keys to move the active window, and STILL use the D-pad to send up/down/left/right etc) :

;_________________________________________________

;
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
; Author: A.N.Other <myemail@nowhere.com>
;
; Script Function:
; Template AutoHotkey script.
;
#Persistent ; Keep this script running until the user explicitly exits it.
SetTimer, WatchAxis, 5
return

WatchAxis:
GetKeyState, JoyX, JoyX ; Get position of X axis.
GetKeyState, JoyY, JoyY ; Get position of Y axis.
KeyToHoldDownPrev = %KeyToHoldDown% ; Prev now holds the key that was down before (if any).

if JoyX > 70
KeyToHoldDown = right
else if JoyX < 30
KeyToHoldDown = left
else if JoyY > 70
KeyToHoldDown = down
else if JoyY < 30
KeyToHoldDown = up
else
KeyToHoldDown =

if KeyToHoldDown = %KeyToHoldDownPrev% ; The correct key is already down.
return ; Do nothing.

; Otherwise, release the previous key and press down the new key:
SetKeyDelay -1 ; Avoid delays between keystrokes.
if KeyToHoldDownPrev ; There is a previous key to release.
Send, {%KeyToHoldDownPrev% up} ; Release it.
if KeyToHoldDown ; There is a key to press down.
Send, {%KeyToHoldDown% down} ; Press it down.
return

;_________________________________________________

I did originally try to merge this script with yours and write it all using functions, but had no luck getting it to work either...

I not used AHK much (tend to code stuff up using win32 calls) or use another macro-er called MacroSceduler (which is nothing like as good, but lets u write VB functions to get round its limitations).

It must be something I am doing which is really silly, but I just can't seem to work out what the heck I am doing wrong. Any help would be very much appreciated

Juk
TableNavigator Quote
02-10-2006 , 06:18 PM
I am having the saming problem with the U-V axis on my script. I use X-Y (the analog stick) as a mouse so I can move around the screen and act in turn but want to use U-V (the gamepad) to send keystrokes but have had no luck. I am still working on it, I'll let you know if I discover something.
TableNavigator Quote
02-10-2006 , 06:50 PM
Fixed my problem now but still no idea why it wouldn't work for me 1st time I tried? Very confusing...

While trying to fix this found this interesting freeware app: JoyToKey (It didn't fix the problem, but it might be of use in the future to others...).

Here is my modified version of the script:

;
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
; Author: A.N.Other <myemail@nowhere.com>
;
; Script Function:
; Template AutoHotkey script.
;

;__________________________Table Navigator V3____________________
; - This version works with demo $ tables (see ### Juk: Change 'list, Play' to 'list, Table' for real $.)
; - It now allows the joypad OR alt+cursor keys for navigation, along with joypadbuttons to press F/C/R.

; AutoHotkey Version: 1.0.41.02
; Platform: WinXP
; Author: Roland & SamIAm

; ### JUK: Added this to make it easier to change between "Play Money" and "Real Money" tables.
TableType := Play ;Table

;some of Sams functions (these have to be in the auto-execute section as I found out; so apparently they get called . Getting late, like I said).

;FOLD = 1;
newButton("fold", 1, "AfxWnd42s14") ;(
newButton("checkFoldInTurn", 1, "AfxWnd42s20")
newButton("foldInTurn", 1, "AfxWnd42s19")
;CALL = 2;
newButton("call", 2, "Call (", 1)
newButton("check", 2, "AfxWnd42s15") ;(
newButton("cInTurn", 2, "AfxWnd42s21")
;RAISE = 3;
newButton("bet", 3, "Bet", 1)
newButton("raise", 3, "Raise ", 1)
newButton("r1InTurn", 3, "AfxWnd42s23")
;LEAVE = 4;
newButton("muckNow", 4, "Muck?", 2)
newButton("sitout", 4, "Sit Out")
newButton("muckInTurn", 4, "Muck Losing/Uncalled Hands")
;STAY = 5;
newButton("back", 5, "I am Back")
newButton("waitNow", 5, "AfxWnd42s16") ;(
newButton("waitInTurn", 5, "Wait for Big Blind")
;PLAY = 6;
newButton("post", 6, "Post", 1)
newButton("show", 6, "Show", 2)
newButton("autopost", 6, "Auto Post Blind")

SysGet, size_caption, 4
SysGet, size_boarder, 32
size_titlebar := size_caption + size_boarder ;I wanted the GUI to be the same height as the titlebar and this seems to do the trick

Gui, +alwaysontop +Lastfound +Owner
Gui, Color, 00008B ;a dark blue I quite like. Change it to whatever you want
WinSet, Transparent, 200 ;make the GUI slightly transparent - looks better that way
Gui, -Caption

Gosub, get_table_list ;get the table list without waiting for the timer. That way we can...
def_t = %table_1% ;... make table_1 the default table to have a starting point
SetTimer, get_table_list, 1000 ;update table_list every second
WinGetPos, x, y, , , ahk_id%def_t%
Gui, Show, w800 h%size_titlebar% x%x% y%y% NoActivate, table_navigator ;show the GUI on table_1
SetTimer, show_hide, 200
SetTimer, WatchAxis, 5 ; ### Juk: Added this for Joyapd control (5ms?).
return

;_________end of auto-execute section___________

;_________subroutines:

get_table_list:
table_list := Update_tables() ; the function returns a comma seperated list of unique window IDs
Loop, Parse, table_list, `, ;assign these IDs to the variables "table_1", "table_2" etc.
{
table_%A_Index% = %A_LoopField%
}
return

show_hide: ;hide the GUI if a) def_t doesn't exist, b) def_t is minimized or c) the active window is maximized
IfWinExist, ahk_id%def_t%
{
WinGet, is_maximised_active, MinMax, A
WinGet, is_minimized_def_t, MinMax, ahk_id%def_t%
If (is_maximised_active = 1 or is_minimized_def_t = -1)
Gui, Hide
else
Gui, Show, NoActivate
}
else
Gui, Hide
return

; ### Juk added this to try to get Joypad working.
WatchAxis:
GetKeyState, JoyX, JoyX ; Get position of X axis.
GetKeyState, JoyY, JoyY ; Get position of Y axis.
KeyToHoldDownPrev = %KeyToHoldDown% ; Prev now holds the key that was down before (if any).
if JoyX > 70
KeyToHoldDown = right
else if JoyX < 30
KeyToHoldDown = left
else if JoyY > 70
KeyToHoldDown = down
else if JoyY < 30
KeyToHoldDown = up
else
KeyToHoldDown =
if KeyToHoldDown = %KeyToHoldDownPrev% ; The correct key is already down.
return ; Do nothing.
; Otherwise, release the previous key and press down the new key:
SetKeyDelay -1 ; Avoid delays between keystrokes.
if KeyToHoldDown ; There is a key to press down.
{
def_t := GetTarget(KeyToHoldDown) ;pass "key" to the GetTarget function which returns the new def_t
WinGetPos, px, py, , , ahk_id%def_t% ;move the GUI to the new de_t
Gui, Show, w%w% x%px% y%py% NoActivate
WinActivate, ahk_id%def_t%
}
return

;_________hotkeys:

!down::
key = down
def_t := GetTarget(key) ;pass "key" to the GetTarget function which returns the new def_t
WinGetPos, px, py, , , ahk_id%def_t% ;move the GUI to the new de_t
Gui, Show, w%w% x%px% y%py% NoActivate
WinActivate, ahk_id%def_t%
return

!up::
key = up
def_t := GetTarget(key)
WinGetPos, px, py, , , ahk_id%def_t%
Gui, Show, w%w% x%px% y%py% NoActivate
WinActivate, ahk_id%def_t%
return

!right::
key = right
def_t := GetTarget(key)
WinGetPos, px, py, , , ahk_id%def_t%
Gui, Show, w%w% x%px% y%py% NoActivate
WinActivate, ahk_id%def_t%
return

!left::
key = left
def_t := GetTarget(key)
WinGetPos, px, py, , , ahk_id%def_t%
Gui, Show, w%w% x%px% y%py% NoActivate
WinActivate, ahk_id%def_t%
return

;Sams hotkeys:

!1::
clickVis(1)
return
!2::
clickVis(2)
return
!3::
clickVis(3)
return
!4::
clickVis(4)
return
!5::
clickVis(5)
return
!6::
clickVis(6)
return
!7::
debug()
return

; ### JUK: Added these to make joypad buttons map to Sam's functions (for my joypad only).
Joy3::ClickVis(1)
Joy1::ClickVis(2)
Joy2::ClickVis(3)

;_________functions:
Update_tables() ;this function returns "table_list" and also operates on the GUI (which is why "size_titlebar" is made global):
{
global size_titlebar

WinGet, pid, PID, Welcome to the PartyPoker.com ;retrieves the process ID (using the window title of the lobby)

WinGet, id, list, %TableType% ahk_pid%pid% ahk_class #32770, , Welcome to the PartyPoker.com Lobby, Side Bet ;make a list of windows IDs matching ahk_pid/class, excluding the lobby
Loop, %id% ; ### Juk: Change 'list, Play' to 'list, Table' for real $.
{
StringTrimRight, this_id, id%a_index%, 0 ;look familiar?
WinGetPos, x, y, w, h, ahk_id %this_id%
w -= 50 ;this allows for slight overlap or slightly different table sizes
h -= 50

If (x < a_screenwidth/6 AND y < a_screenheight/6) ;determine the table number based on its position
table_1 = %this_id%
If (x < a_screenwidth/6 AND y > a_screenheight/6 AND y < 2*h)
table_2 = %this_id%
If (x < a_screenwidth/6 AND y >= 2*h)
table_3 = %this_id%
If (x > a_screenwidth/6 AND y < a_screenheight/6 AND x < 2*w AND y < 2*h)
table_4 = %this_id%
If (x > a_screenwidth/6 AND y > a_screenheight/6 AND x < 2*w AND y < 2*h)
table_5 = %this_id%
If (x > a_screenwidth/6 AND x < 2*w AND y >= 2*h)
table_6 = %this_id%
If (y < a_screenheight/6 AND x >= 2*w)
table_7 = %this_id%
If (y > a_screenheight/6 AND x >= 2*w AND y < 2*h)
table_8 = %this_id%
If (x > a_screenwidth/6 AND x >= 2*w AND y >= 2*h)
table_9 = %this_id%
}
table_list = %table_1%,%table_2%,%table_3%,%table_4%,%table_5%, %table_6%,%table_7%,%table_8%,%table_9%
w += 50 ;reset to the actual width

;modify the GUI according to the height of the titlebar, the width of the table(s)
;(this assumes all tables are roughly the same size) and round the edges because it looks better:

WinSet, Region, w%w% h%size_titlebar% 0-0 %w%-0 %w%-%size_titlebar% 0-%size_titlebar% R20-20, table_navigator

return, table_list ;return "table_list"
}


GetTarget(key) ;this function returns the new "def_t" when passed "key"
{
global def_t ;make these two variables global
global table_list

If key = down
new_order = 123456789 ;since this is the order the tables are in anyways, new_order equals the old order in this case
If key = up
new_order = 987654321 ;"up" is the opposite of "down" so we just reverse the order
If key = right
new_order = 147258369 ;the table to the right of table_1 is table_4 etc.
If key = left
new_order = 963852741 ;reverse the order for "right"

Loop, Parse, table_list, `, ;parse table_list, assigning each substring (ID) a new table number based on the new order
{
StringMid, new_number, new_order, %a_index%, 1
table_%new_number% = %a_loopfield%
}
Loop, 9
{
StringTrimRight, table, table_%a_index%, 0 ;acces the (new) array to find out which number the def_t is in the new order
If def_t = %table%
{
table_number = %a_index%
break
}
}
Loop, 9 ;this loop finds the number of the next table in the list (target)
{
table_number++ ;for instance: if the loop above determined that the def_t is table_5, this loop looks for table_6 first;
If table_%table_number% <> ;if "table_6" is empty, it looks for table_7 and so on
{
target = %table_number%
break
}
If table_number >= 9 ;if table_number reaches 9, tables 6 through 9 didn't exist, to continue the example above
table_number = 0 ;so we search for tables 1 through 4 (table_number is set to 1 at the beginning of the next loop iteration)
}
target := table_%target% ;once we've found "target", change it to be the ID of the table (using the array created by the first loop)
IfWinExist, ahk_id%target% ;only return a new de_t if it actually still exists; else, return the old def_t
{
def_t = %target%
}
Return, def_t ;return "def_t"
}

;the rest of Sams functions:

debug()
{
local but, num, Output
but = 1
Loop
{
if(but > numButtons)
break
num = 1
Loop
{
if(num > numButtons%but%)
break
if(visible(but,num) = 1)
Output = % Output . names%but%x%num% . " is visible.`n"
num += 1
}
but += 1
}
MsgBox %Output%
}

clickVis(button)
{
local output, i, isVis, currString, currMatch
WinGetTitle, winTitle, ahk_id%def_t%
i = 1
Loop
{
if(i > numButtons%button%)
break
if (visible(button,i) = 1)
{
currMatch := matches%button%x%i%
SetTitleMatchMode, %currMatch%
currString := strings%button%x%i%
ControlClick, %currString%, %winTitle%
break
}
i += 1
}
}

visible(but, num)
{
local currentMatch, currentString
local output
currentMatch = % matches%but%x%num%
currentString = % strings%but%x%num%
SetTitleMatchMode % currentMatch
ControlGet, output, Visible, , %currentString%, %winTitle%
if output <> 1
{
output = 0
}
return output
}
newButton(name, button, string, match=3)
{
local buttonCount
numButtons += 1
numButtons%button% += 1
buttonCount := numButtons%button%
names%button%x%buttonCount% := name
matches%button%x%buttonCount% := match
strings%button%x%buttonCount% := string
}

;_______end of code_____

Juk
TableNavigator Quote
02-10-2006 , 08:43 PM
Thanks for adding joypad support Juk. That’ll save me some work when my joypad arrives. I was hoping I’d get it today, but it’s been snowing on end here so the postman probably took one look at our drive, shook his head and put his car in reverse. Damn him.
Anways, I added a little GUI that lets you select a few things. It uses an .ini file to save your settings, so you’ll probably want to put the script in some folder somewhere and create a desktop shortcut; else you’ll have that file floating around all the time.
I hope I put all the stuff you added in the right places - no way to test it, since no joypad. Also, it’s getting late again over here. I always underestimate how long this stuff takes.
There are still some bugs (especially interesting is the one where WinGetPos returns -3200 for both the x and y position of table_1 ), but they’ll have to wait till tomorrow.
Here we go:


;__________________________Table Navigator V4_____________________

; AutoHotkey Version: 1.0.41.02
; Platform: WinXP & Win9x/NT (for joypad)
; Author: Roland, SamIAm & jukofyork

; this script now allows the joypad OR alt+cursor keys for navigation, along with joypadbuttons to press F/C/R.

IniRead, 3pos_x, TableNavigator.ini, Position, 3pos_x, 0
IniRead, 3pos_y, TableNavigator.ini, Position, 3pos_y, 0
IniRead, wrapping_on, TableNavigator.ini, Wrapping, wrapping_on, 1
IniRead, wrapping_off, TableNavigator.ini, Wrapping, wrapping_off, 0
IniRead, activate_on, TableNavigator.ini, ActivateTarget, activate_on, 1
IniRead, activate_off, TableNavigator.ini, ActivateTarget, activate_off, 0
IniRead, auto_launch, TableNavigator.ini, AutoLaunch, auto_launch, off

TableType = Table

SysGet, size_caption, 4
SysGet, size_boarder, 32
size_titlebar := size_caption + size_boarder ;I wanted the GUI to be the same height as the titlebar and this seems to do the trick

Gui, +alwaysontop +Lastfound +Owner
Gui, Color, 00008B ;a dark blue I quite like. Change it to whatever you want
WinSet, Transparent, 200 ;make the GUI slightly transparent - looks better that way
Gui, -Caption

If auto_launch = yes
{
Gosub, get_table_list ;get the table list without waiting for the timer. That way we can...
def_t = %table_1% ;... make table_1 the default table to have a starting point
SetTimer, get_table_list, 1000 ;update table_list every second
WinGetPos, x, y, , , ahk_id%def_t%
Gui, 1: Show, w800 h%size_titlebar% x%x% y%y% NoActivate, table_navigator ;show the GUI on table_1
SetTimer, show_hide, 200
SetTimer, WatchAxis, 5 ; ### Juk: Added this for Joyapd control (5ms?).
}



Gui, 2: +owner +lastfound +alwaysontop
Gui, 2: Color, 4F94CD
Gui, 2: Font, s30, Comic Sans MS
Gui, 2: Add, Text, vText1 cE0FFFF, Table
Gui, 2: Add, Text, vText2 cWhite, Navigator
WinSet, Transparent, 0
Gui, 2: -Caption
Gui, 2: Show, w259 h200 Center
GuiControlGet, Text1, 2: Pos, Text1
GuiControlGet, Text2, 2: Pos, Text2
GuiControl, 2: Move, Text1, % "x" (250 - Text1W)/2
GuiControl, 2: Move, Text2, % "x" (250 - Text2W)/2
Loop, 20
{
trans += 10
WinSet, Transparent, %trans%
Sleep, 50
}
Sleep, 500
Loop, 20
{
trans -= 10
WinSet, Transparent, %trans%
Sleep, 50
}
Gui, 2: Destroy

Menu, FileMenu, Add, Launch Navigator, LaunchNavigator
Menu, FileMenu, Add, Auto-Launch Navigator, AutoLaunchNavigator
Menu, FileMenu, Add
Menu, FileMenu, Add, Test on Play Money, PlayMoney
Menu, FileMenu, Add
Menu, FileMenu, Add, Exit, Exit

Menu, HelpMenu, Add, Help, Help

Menu, MenuBar, Add, File, :FileMenu
Menu, MenuBar, Add, Help, :HelpMenu
Menu, MenuBar, Color, FFFACD
Gui, 3: Menu, MenuBar

If auto_launch = yes
Menu, FileMenu, Check, Auto-Launch Navigator

Menu, Tray, Add, Show, Show
Menu, Tray, Default, Show

Gui, 3: +owner +lastfound
Gui, 3: Color, CDC9A5
Gui, 3: Font, s10, Arial
Gui, 3: Add, Text, Section w70 x20 y20, Wrapping:
Gui, 3: Add, Radio, ys checked%wrapping_on% gWrapping_on, On
Gui, 3: Add, Radio, checked%wrapping_off% gWrapping_off, Off
Gui, 3: Add, Text, x20 w70 Section, Activate target:
Gui, 3: Add, Radio, ys checked%activate_on% gActivate_on, On
Gui, 3: Add, Radio, checked%activate_off% gActivate_off, Off
Gui, 3: Show, x%3pos_x% y%3pos_y% w200 h130, Table Navigator




;call Sams functions:

;FOLD = 1;
newButton("fold", 1, "AfxWnd42s14") ;(
newButton("checkFoldInTurn", 1, "AfxWnd42s20")
newButton("foldInTurn", 1, "AfxWnd42s19")
;CALL = 2;
newButton("call", 2, "Call (", 1)
newButton("check", 2, "AfxWnd42s15") ;(
newButton("cInTurn", 2, "AfxWnd42s21")
;RAISE = 3;
newButton("bet", 3, "Bet", 1)
newButton("raise", 3, "Raise ", 1)
newButton("r1InTurn", 3, "AfxWnd42s23")
;LEAVE = 4;
newButton("muckNow", 4, "Muck?", 2)
newButton("sitout", 4, "Sit Out")
newButton("muckInTurn", 4, "Muck Losing/Uncalled Hands")
;STAY = 5;
newButton("back", 5, "I am Back")
newButton("waitNow", 5, "AfxWnd42s16") ;(
newButton("waitInTurn", 5, "Wait for Big Blind")
;PLAY = 6;
newButton("post", 6, "Post", 1)
newButton("show", 6, "Show", 2)
newButton("autopost", 6, "Auto Post Blind")

return

;_________end of auto-execute section___________

;_________subroutines:

get_table_list:
table_list := Update_tables() ; the function returns a comma seperated list of unique window IDs
Loop, Parse, table_list, `, ;assign these IDs to the variables "table_1", "table_2" etc.
{
table_%A_Index% = %A_LoopField%
}
return

show_hide: ;hide the GUI if a) def_t doesn't exist, b) def_t is minimized or c) the active window is maximized
IfWinExist, ahk_id%def_t%
{
WinGet, is_maximised_active, MinMax, A
WinGet, is_minimized_def_t, MinMax, ahk_id%def_t%
If (is_maximised_active = 1 or is_minimized_def_t = -1)
Gui, Hide
else
Gui, Show, NoActivate
}
else
Gui, Hide
return

LaunchNavigator: ;do what the original script did in the auto-execute-section (and still does, if auto-launch was selected)
Gosub, get_table_list
def_t = %table_1%
SetTimer, get_table_list, 1000
WinGetPos, x, y, , , ahk_id%def_t%
Gui, 1: Show, w800 h%size_titlebar% x%x% y%y% NoActivate, table_navigator
SetTimer, show_hide, 200
SetTimer, WatchAxis, 5 ; ### Juk: Added this for Joyapd control (5ms?).
return

Exit:
3GuiClose:
WinGetPos, 3pos_x, 3pos_y, , , Table Navigator
Gui, 3: Destroy

IniWrite, %3pos_x%, TableNavigator.ini, Position, 3pos_x
IniWrite, %3pos_y%, TableNavigator.ini, Position, 3pos_y
IniWrite, %wrapping_on%, TableNavigator.ini, Wrapping, wrapping_on
IniWrite, %wrapping_off%, TableNavigator.ini, Wrapping, wrapping_off
IniWrite, %activate_on%, TableNavigator.ini, ActivateTarget, activate_on
IniWrite, %activate_off%, TableNavigator.ini, ActivateTarget, activate_off
IniWrite, %auto_launch%, TableNavigator.ini, AutoLaunch, auto_launch
ExitApp
return

3GuiSize:
If ErrorLevel = 1
Gui, 3: Hide
return

Show:
Gui, 3: Restore
Gui, 3: Show
return

Wrapping_on:
wrapping_on = 1
wrapping_off = 0
return

Wrapping_off:
wrapping_off = 1
wrapping_on = 0
return

Activate_on:
activate_on = 1
activate_off = 0
return

Activate_off:
activate_off = 1
activate_on = 0
return

AutoLaunchNavigator:
If auto_launch = no
auto_launch = yes
else
auto_launch = no
Menu, FileMenu, ToggleCheck, Auto-Launch Navigator
return

PlayMoney:
If TableType = Play
TableType = Table
else
TableType = Play
Menu, FileMenu, ToggleCheck, Test on Play Money
return

Help:
Gui, 4: Color, F5F5DC
Gui, 4: Font, s10, Arial
Gui, 4: Add, Text, ,
(

1. Turning Wrapping off will prevent TN from
moving to the next row or column when it has
reached the last table in that row or column.

2. Turning "Activate Target" on will cause the table
under TN to be activated. This might be especially
useful when over-lapping.

3. Selecting "Auto-Launch Navigator" from the
File Menu will cause the Navigator to be launched
automatically the next time you start TN.

4. If you wish to test TN on play money first, select
"Test on Play Money" from the File Menu.

)
Gui, 4: Add, Button, vbutton_close_help Center gCloseHelp, Close
Gui, 4: Show, autosize Hide, Help
GuiControlGet, button_close_help, 4: pos
GuiControl, 4: Move, button_close_help, % "x" (334 - button_close_helpW)/2
Gui, 4: Show
return

CloseHelp:
Gui, 4: Destroy
return

; ### Juk added this to try to get Joypad working.
WatchAxis:
GetKeyState, JoyX, JoyX ; Get position of X axis.
GetKeyState, JoyY, JoyY ; Get position of Y axis.
KeyToHoldDownPrev = %KeyToHoldDown% ; Prev now holds the key that was down before (if any).
if JoyX > 70
KeyToHoldDown = right
else if JoyX < 30
KeyToHoldDown = left
else if JoyY > 70
KeyToHoldDown = down
else if JoyY < 30
KeyToHoldDown = up
else
KeyToHoldDown =
if KeyToHoldDown = %KeyToHoldDownPrev% ; The correct key is already down.
return ; Do nothing.
; Otherwise, release the previous key and press down the new key:
SetKeyDelay -1 ; Avoid delays between keystrokes.
if KeyToHoldDown ; There is a key to press down.
{
If wrapping_on = 1
def_t := GetTargetWrap(KeyToHoldDown)
else
def_t := GetTargetNoWrap(KeyToHoldDown)
WinGetPos, px, py, , , ahk_id%def_t% ;move the GUI to the new de_t
Gui, Show, w%w% x%px% y%py% NoActivate
WinActivate, ahk_id%def_t%
}
return

;_________hotkeys:

!down::
key = down
If wrapping_on = 1
def_t := GetTargetWrap(key) ;pass "key" to the GetTarget function which returns the new def_t
else
def_t := GetTargetNoWrap(key)
WinGetPos, px, py, , , ahk_id%def_t% ;move the GUI to the new de_t
Gui, Show, w%w% x%px% y%py% NoActivate
If activate_on = 1
WinActivate, ahk_id%def_t%
return

!up::
key = up
If wrapping_on = 1
def_t := GetTargetWrap(key)
else
def_t := GetTargetNoWrap(key)
WinGetPos, px, py, , , ahk_id%def_t%
Gui, Show, w%w% x%px% y%py% NoActivate
If activate_on = 1
WinActivate, ahk_id%def_t%
return

!right::
key = right
If wrapping_on = 1
def_t := GetTargetWrap(key)
else
def_t := GetTargetNoWrap(key)
WinGetPos, px, py, , , ahk_id%def_t%
Gui, Show, w%w% x%px% y%py% NoActivate
If activate_on = 1
WinActivate, ahk_id%def_t%
return

!left::
key = left
If wrapping_on = 1
def_t := GetTargetWrap(key)
else
def_t := GetTargetNoWrap(key)
WinGetPos, px, py, , , ahk_id%def_t%
Gui, Show, w%w% x%px% y%py% NoActivate
If activate_on = 1
WinActivate, ahk_id%def_t%
return

;Sams hotkeys:

1::
clickVis(1)
return
2::
clickVis(2)
return
3::
clickVis(3)
return
4::
clickVis(4)
return
5::
clickVis(5)
return
6::
clickVis(6)
return
7::
debug()
return


; ### JUK: Added these to make joypad buttons map to Sam's functions (for my joypad only).
Joy3::ClickVis(1)
Joy1::ClickVis(2)
Joy2::ClickVis(3)


;_________functions:

Update_tables() ;this function returns "table_list" and also operates on the GUI (which is why "size_titlebar" is made global):
{
global size_titlebar
global TableType

WinGet, pid, PID, Welcome to the PartyPoker.com ;retrieves the process ID (using the window title of the lobby)

WinGet, id, list, %TableType% ahk_pid%pid% ahk_class #32770, , Welcome to the PartyPoker.com Lobby, Side Bet ;make a list of windows IDs matching ahk_pid/class, excluding the lobby
Loop, %id%
{
StringTrimRight, this_id, id%a_index%, 0 ;look familiar?
WinGetPos, x, y, w, h, ahk_id %this_id%
w -= 50 ;this allows for slight overlap or slightly different table sizes
h -= 50

If (x < a_screenwidth/6 AND y < a_screenheight/6) ;determine the table number based on its position
table_1 = %this_id%
If (x < a_screenwidth/6 AND y > a_screenheight/6 AND y < 2*h)
table_2 = %this_id%
If (x < a_screenwidth/6 AND y >= 2*h)
table_3 = %this_id%
If (x > a_screenwidth/6 AND y < a_screenheight/6 AND x < 2*w AND y < 2*h)
table_4 = %this_id%
If (x > a_screenwidth/6 AND y > a_screenheight/6 AND x < 2*w AND y < 2*h)
table_5 = %this_id%
If (x > a_screenwidth/6 AND x < 2*w AND y >= 2*h)
table_6 = %this_id%
If (y < a_screenheight/6 AND x >= 2*w)
table_7 = %this_id%
If (y > a_screenheight/6 AND x >= 2*w AND y < 2*h)
table_8 = %this_id%
If (x > a_screenwidth/6 AND x >= 2*w AND y >= 2*h)
table_9 = %this_id%
}
table_list = %table_1%,%table_2%,%table_3%,%table_4%,%table_5%, %table_6%,%table_7%,%table_8%,%table_9%
w += 50 ;reset to the actual width

;modify the GUI according to the height of the titlebar, the width of the table(s)
;(this assumes all tables are roughly the same size) and round the edges because it looks better:

WinSet, Region, w%w% h%size_titlebar% 0-0 %w%-0 %w%-%size_titlebar% 0-%size_titlebar% R20-20, table_navigator

return, table_list ;return "table_list"
}


GetTargetWrap(key) ;this function returns the new "def_t" when passed "key"
{
global def_t ;make these two variables global
global table_list

If key = down
new_order = 123456789 ;since this is the order the tables are in anyways, new_order equals the old order in this case
If key = up
new_order = 987654321 ;"up" is the opposite of "down" so we just reverse the order
If key = right
new_order = 147258369 ;the table to the right of table_1 is table_4 etc.
If key = left
new_order = 963852741 ;reverse the order for "right"

Loop, Parse, table_list, `, ;parse table_list, assigning each substring (ID) a new table number based on the new order
{
StringMid, new_number, new_order, %a_index%, 1
table_%new_number% = %a_loopfield%
}
Loop, 9
{
StringTrimRight, table, table_%a_index%, 0 ;acces the (new) array to find out which number the def_t is in the new order
If def_t = %table%
{
table_number = %a_index%
break
}
}
Loop, 9 ;this loop finds the number of the next table in the list (target)
{
table_number++ ;for instance: if the loop above determined that the def_t is table_5, this loop looks for table_6 first;
If table_%table_number% <> ;if "table_6" is empty, it looks for table_7 and so on
{
target = %table_number%
break
}
If table_number >= 9 ;if table_number reaches 9, tables 6 through 9 didn't exist, to continue the example above
table_number = 0 ;so we search for tables 1 through 4 (table_number is set to 1 at the beginning of the next loop iteration)
}
target := table_%target% ;once we've found "target", change it to be the ID of the table (using the array created by the first loop)
IfWinExist, ahk_id%target% ;only return a new de_t if it actually still exists; else, return the old def_t
{
def_t = %target%
}
Return, def_t ;return "def_t"
}


GetTargetNoWrap(key) ;this function returns the new "def_t" when passed "key"
{
global def_t ;make these two variables global
global table_list


Loop, 9
{
StringTrimRight, table, table_%a_index%, 0 ;acces the (new) array to find out which number the def_t is in the new order
If def_t = %table%
{
table_number = %a_index%
break
}
}

If key = down
{
If table_number = 1
target = 2
If table_number = 2
target = 3
If table_number = 4
target = 5
If table_number = 5
target = 6
If table_number = 7
target = 8
If table_number = 8
target = 9
}
If key = up
{
If table_number = 9
target = 8
If table_number = 8
target = 7
If table_number = 6
target = 5
If table_number = 5
target = 4
If table_number = 3
target = 2
If table_number = 2
target = 1
}
If key = right
{
If table_number = 1
target = 4
If table_number = 4
target = 7
If table_number = 2
target = 5
If table_number = 5
target = 8
If table_number = 3
target = 6
If table_number = 6
target = 9
}
If key = left
{
If table_number = 9
target = 6
If table_number = 6
target = 3
If table_number = 8
target = 5
If table_number = 5
target = 2
If table_number = 7
target = 4
If table_number = 4
target = 1
}

target := table_%target% ;once we've found "target", change it to be the ID of the table (using the array created by the first loop)
IfWinExist, ahk_id%target% ;only return a new de_t if it actually still exists; else, return the old def_t
{
def_t = %target%
}
Return, def_t ;return "def_t"
}


;the rest of Sams functions:

debug()
{
local but, num, Output
but = 1
Loop
{
if(but > numButtons)
break
num = 1
Loop
{
if(num > numButtons%but%)
break
if(visible(but,num) = 1)
Output = % Output . names%but%x%num% . " is visible.`n"
num += 1
}
but += 1
}
MsgBox %Output%
}

clickVis(button)
{
local output, i, isVis, currString, currMatch
WinGetTitle, winTitle, ahk_id%def_t%
i = 1
Loop
{
if(i > numButtons%button%)
break
if (visible(button,i) = 1)
{
currMatch := matches%button%x%i%
SetTitleMatchMode, %currMatch%
currString := strings%button%x%i%
ControlClick, %currString%, %winTitle%
break
}
i += 1
}
}

visible(but, num)
{
local currentMatch, currentString
local output
currentMatch = % matches%but%x%num%
currentString = % strings%but%x%num%
SetTitleMatchMode % currentMatch
ControlGet, output, Visible, , %currentString%, %winTitle%
if output <> 1
{
output = 0
}
return output
}
newButton(name, button, string, match=3)
{
local buttonCount
numButtons += 1
numButtons%button% += 1
buttonCount := numButtons%button%
names%button%x%buttonCount% := name
matches%button%x%buttonCount% := match
strings%button%x%buttonCount% := string
}

;_______end of code_____
TableNavigator Quote
02-10-2006 , 09:43 PM
Good stuff. We don't have many posts, but the AHK threads are certainly the longest.

I stole some of your table-list stuff for another script I'm working on. Hope you don't mind.

Another thing: in posting stuff on the forum, your code will look prettier if you use the [ code ] [ /code ] brackets. It won't rip-out your indents and stuff.
-Sam

P.S. In Atlanta, the weather channel forecasts "chilly" for some time next week. I'll let you know if it ever happens.
TableNavigator Quote
02-10-2006 , 10:33 PM
Quote:
Another thing: in posting stuff on the forum, your code will look prettier if you use the [ code ] [ /code ] brackets. It won't rip-out your indents and stuff.
Ty, didn't know about this - will use this in future


Script seems to be working fine still, but I not having much luck with the .ini (seems to ignore/forget my settings, but I prolly doing something wrong... ).

I just added a couple of lines:

1. Post/Auto-post can be helpful if using AutoResizer at same time, so I used my last button for it:

Joy3::ClickVis(1) ; Fold
Joy1::ClickVis(2) ; Call
Joy2::ClickVis(3) ; Raise
Joy4::ClickVis(6) ; ### JUK: V5: Post

2. I get trouble sometimes if I have any HH windows open (sometimes it select HH window, but not sure why). This line fixes it bc on my PP client I killed off the casino/side-bets by deleting the sub-folder, so this prolly only work for people who also deleted the side-bet stuff:

WinGet, id, list, %TableType% ahk_pid%pid% ahk_class #32770, , Welcome to the PartyPoker.com Lobby, Click on a hand number to check hand history ;make a list of windows IDs matching ahk_pid/class, excluding the lobby
(Not 100% sure if there any way to test for both types of window and ignore them both.)


3. I also changed back the 1::, 2::, 3::, to !1::, !2::, !3::, etc keys after having a bit of a disaster talking in IM at same time as playing


Late here too now, but two other cool functions would be these:

1. If press the fold hotkey, then if the check button is visible press this instead (I use this in AutoResizer app, so the key is basically 'check or fold'), but tried the obvious hack and I can't seem to get this to work.

2. Sometimes if I open new tables, I lose the GUI bar, just wondered if there could be a quick reload hotkey (was gona try adding, but wasn't sure where to add and worried it would start recursive loading of script... ).


Also, my theory that the beta crashes only when clicking the mouse is wrong... Mine still crashes when just using the script (but seems to crash less than b4).


Overall this script is def the best setup I had yet (very few mis-clicks so far compared to other setups I tried... ).

Juk
TableNavigator Quote
02-11-2006 , 09:03 AM
Quote:
Good stuff. We don't have many posts, but the AHK threads are certainly the longest.
That’s for damn sure.

Quote:
I stole some of your table-list stuff for another script I'm working on. Hope you don't mind.
Hell no, you’re welcome. Your code has my name on it now too, after all.

Quote:
Another thing: in posting stuff on the forum, your code will look prettier if you use the [ code ] [ /code ] brackets. It won't rip-out your indents and stuff.
Maybe it’s just me, but when I copy & paste [ code ] I loose the linefeeds, resulting in one terribly long line.


Quote:
P.S. In Atlanta, the weather channel forecasts "chilly" for some time next week. I'll let you know if it ever happens.
Lol. Apparently the postman had a change of heart - my pad arrived today.
TableNavigator Quote
02-11-2006 , 09:25 AM
Hmm… the script assumes the .ini is in A_WorkingDir, the working directory of the script. So both the script and the .ini have to be in the same directory, which is why I said to put the script in a folder somewhere and create a desktop shortcut. Maybe I’m missing something though.

I don’t know how to exclude two windows either , although it can’t be that hard. I use Tigerites script to remove the sidebet crap though, so I’m not gonna try and find a solution unless someone asks me to.

Sorry about losing the Alt-key there - I hope you play limit.

I think I know what you mean with that Fold/Check thing - that’s when that little window pops up asking if you really want to fold etc…, right?
I’ll see what I can do.

A quick reload hotkey is a good idea - I’ve had weird stuff happen in other scripts (GUIs loosing their AlwaysOnTop attribute for no apparent reason, or completey disappering) and most times I just can’t tell what’s causing it (I.e. I can’t fix it). So a work-around will be it.
TableNavigator Quote
02-11-2006 , 10:26 AM
Quote:
Hmm… the script assumes the .ini is in A_WorkingDir, the working directory of the script. So both the script and the .ini have to be in the same directory, which is why I said to put the script in a folder somewhere and create a desktop shortcut. Maybe I’m missing something though.
It was me being sleepy... I was just quitting the script by right clicking the system tray, but when I looked at the script in more detail I saw I needed to use the exit function on the menu for the ini to be saved. All ok now

Quote:
I don’t know how to exclude two windows either , although it can’t be that hard. I use Tigerites script to remove the sidebet crap though, so I’m not gonna try and find a solution unless someone asks me to.
Same here, so long as party don't force the horrible sidebet thing on us, then it wont effect me either.

Quote:
A quick reload hotkey is a good idea - I’ve had weird stuff happen in other scripts (GUIs loosing their AlwaysOnTop attribute for no apparent reason, or completey disappering) and most times I just can’t tell what’s causing it (I.e. I can’t fix it). So a work-around will be it.
It could be something to do with my setup (or me being sleepy last night - like the ini file problem ), but after using this quite alot last night it seems that I needed to reload the script each time I closed/re-opened a new table (the GUI bar disappears [a bit like you mention for the quick reload key], but the set to foreground code still works and I can still navigate).

Glad you got the joypad at last - it feels a very 'natural' control system for me and found it MUCH easier to adapt to than MTH or my quick fold keys in AutoResizer. Ty again for this!

Juk
TableNavigator Quote
02-11-2006 , 10:51 AM
Quote:
I was just quitting the script by right clicking the system tray
Oh, that. That was me being sleepy - I had the same problem with another script and never fixed it, my bad. Should have known.

Quote:
It could be something to do with my setup (or me being sleepy last night - like the ini file problem ), but after using this quite alot last night it seems that I needed to reload the script each time I closed/re-opened a new table (the GUI bar disappears [a bit like you mention for the quick reload key], but the set to foreground code still works and I can still navigate).


I haven’t had any problems when closing/opening tables, but I’ll look into it.
TableNavigator Quote
02-11-2006 , 12:33 PM
Okay, the GUI disappearing was partly due to the NoWrap function not behaving itsself - I think I fixed that.

One other strange thing I don't get is this: When I launch the navigator prior to having any tables open and then open some tables, the GUI won't show when using the joypad; but it will show when using the keyboard.
Any ideas?

I'd rather post the new version once that's fixed, too.
TableNavigator Quote
02-11-2006 , 01:17 PM
I think (but not sure yet), it is something to do with the pseudo-thread 'WatchAxis'.

Not 100% sure how to fix yet, but I think just need some semaphore type flag in the other pseudo-threads.

Easier than this might be just try to merge 'WatchAxis' pseudo-thread into one of the other threads (but the timings are very different bc WatchAxis is polling the joypad, so has to be pretty quick. I think 5ms is prolly overkill though [I just used the example from AHK help, and they used 5ms too]).

Will post back in a few mins when find which solution works best.

Juk
TableNavigator Quote
02-11-2006 , 01:37 PM
Hmmm... I seem to be getting the original disappearing GUI type problem, so not sure if this fix might work for you:

It seems possible to have blocking threads if a priority is set [from the 'Threads' help page in AHK: "A hotkey, timed subroutine, or custom menu item with a priority lower than that of the current thread cannot interrupt it."] (in theory the line below should mean WatchAxis can't be called while in another thread as it has lower priority than the default 0):

SetTimer, WatchAxis, 5, , -1 ;

Again, I not sure if this works or not (it might be worth trying to set the thread priorities for each timer sepeartely - I just permuted all combinations, but no luck ).

Also I tried just moving the WatchAxis code into show_hide thread, but this didn't work either.

I think I having a different problem which looks similar (maybe even more severe version of same problem?).

Juk
TableNavigator Quote
02-11-2006 , 02:40 PM
Lol. This is the weirdest GUI ever.
First of all, mouseclicks shouldn't be falling through it, right?? I have a working script where I use buttons set to a transparency of 1, nevermind 200.

One other thing - the GUI will pop up if you right-click on the tray icon, always. WTF?

I can also, make it pop up by using a hotkey that says, "Gui, Show". Using that same command in the hotkeys for up, down, etc. has no effect whatsover though.

Talk about AHK tilt

This might be the WatchAxis thread, but I don't really see how it can be interfering. The hotkey thread should resume every time the WatchAxis thread finishes. So the Gui, Show command should be executed at some point.

I've tried various WinSet commands, but no luck.
TableNavigator Quote
02-11-2006 , 03:14 PM
Ah well, work around in order. Just map the !8:: hotkey to a free button on your joypad and you should be fine.

I also found a way to get it to click "Check" instead of fold when needed.

The GetTargetNoWrap() function has been updated to sort of simulate the behavior of the original function when needed (kinda like turning wrap on again just for the purpose of finding a target). I hope that works.

;__________________________Table Navigator V4_____________________

; AutoHotkey Version: 1.0.41.02
; Platform: WinXP & Win9x/NT (for joypad)
; Author: Roland, SamIAm & jukofyork

; this script now allows the joypad OR alt+cursor keys for navigation, along with joypadbuttons to press F/C/R.

IniRead, 3pos_x, TableNavigator.ini, Position, 3pos_x, 0
IniRead, 3pos_y, TableNavigator.ini, Position, 3pos_y, 0
IniRead, wrapping_on, TableNavigator.ini, Wrapping, wrapping_on, 1
IniRead, wrapping_off, TableNavigator.ini, Wrapping, wrapping_off, 0
IniRead, activate_on, TableNavigator.ini, ActivateTarget, activate_on, 1
IniRead, activate_off, TableNavigator.ini, ActivateTarget, activate_off, 0
IniRead, auto_launch, TableNavigator.ini, AutoLaunch, auto_launch, off

TableType = Table

SysGet, size_caption, 4
SysGet, size_boarder, 32
size_titlebar := size_caption + size_boarder ;I wanted the GUI to be the same height as the titlebar and this seems to do the trick

Gui, +alwaysontop +Lastfound +Owner
Gui, Color, 00008B ;a dark blue I quite like. Change it to whatever you want
WinSet, Transparent, 200 ;make the GUI slightly transparent - looks better that way
Gui, -Caption

If auto_launch = yes
{
Gosub, get_table_list ;get the table list without waiting for the timer. That way we can...
def_t = %table_1% ;... make table_1 the default table to have a starting point
SetTimer, get_table_list, 1000 ;update table_list every second
WinGetPos, x, y, , , ahk_id%def_t%
Gui, 1: Show, w800 h%size_titlebar% x%x% y%y% NoActivate, table_navigator ;show the GUI on table_1
SetTimer, show_hide, 200
SetTimer, WatchAxis, 5 ; ### Juk: Added this for Joyapd control (5ms?).
}



Gui, 2: +owner +lastfound +alwaysontop
Gui, 2: Color, 4F94CD
Gui, 2: Font, s30, Comic Sans MS
Gui, 2: Add, Text, vText1 cE0FFFF, Table
Gui, 2: Add, Text, vText2 cWhite, Navigator
WinSet, Transparent, 0
Gui, 2: -Caption
Gui, 2: Show, w259 h200 Center
GuiControlGet, Text1, 2: Pos, Text1
GuiControlGet, Text2, 2: Pos, Text2
GuiControl, 2: Move, Text1, % "x" (250 - Text1W)/2
GuiControl, 2: Move, Text2, % "x" (250 - Text2W)/2
Loop, 20
{
trans += 10
WinSet, Transparent, %trans%
Sleep, 50
}
Sleep, 500
Loop, 20
{
trans -= 10
WinSet, Transparent, %trans%
Sleep, 50
}
Gui, 2: Destroy

Menu, FileMenu, Add, Launch Navigator, LaunchNavigator
Menu, FileMenu, Add, Auto-Launch Navigator, AutoLaunchNavigator
Menu, FileMenu, Add
Menu, FileMenu, Add, Test on Play Money, PlayMoney
Menu, FileMenu, Add
Menu, FileMenu, Add, Exit, Exit

Menu, HelpMenu, Add, Help, Help

Menu, MenuBar, Add, File, :FileMenu
Menu, MenuBar, Add, Help, :HelpMenu
Menu, MenuBar, Color, FFFACD
Gui, 3: Menu, MenuBar

If auto_launch = yes
Menu, FileMenu, Check, Auto-Launch Navigator

Menu, Tray, Add, Show, Show
Menu, Tray, Default, Show

Gui, 3: +owner +lastfound
Gui, 3: Color, CDC9A5
Gui, 3: Font, s10, Arial
Gui, 3: Add, Text, Section w70 x20 y20, Wrapping:
Gui, 3: Add, Radio, ys checked%wrapping_on% gWrapping_on, On
Gui, 3: Add, Radio, checked%wrapping_off% gWrapping_off, Off
Gui, 3: Add, Text, x20 w70 Section, Activate target:
Gui, 3: Add, Radio, ys checked%activate_on% gActivate_on, On
Gui, 3: Add, Radio, checked%activate_off% gActivate_off, Off
Gui, 3: Show, x%3pos_x% y%3pos_y% w200 h130, Table Navigator




;call Sams functions:

;FOLD = 1;
newButton("fold", 1, "AfxWnd42s14") ;(
newButton("checkFoldInTurn", 1, "AfxWnd42s20")
newButton("foldInTurn", 1, "AfxWnd42s19")
;CALL = 2;
newButton("call", 2, "Call (", 1)
newButton("check", 2, "AfxWnd42s15") ;(
newButton("cInTurn", 2, "AfxWnd42s21")
;RAISE = 3;
newButton("bet", 3, "Bet", 1)
newButton("raise", 3, "Raise ", 1)
newButton("r1InTurn", 3, "AfxWnd42s23")
;LEAVE = 4;
newButton("muckNow", 4, "Muck?", 2)
newButton("sitout", 4, "Sit Out")
newButton("muckInTurn", 4, "Muck Losing/Uncalled Hands")
;STAY = 5;
newButton("back", 5, "I am Back")
newButton("waitNow", 5, "AfxWnd42s16") ;(
newButton("waitInTurn", 5, "Wait for Big Blind")
;PLAY = 6;
newButton("post", 6, "Post", 1)
newButton("show", 6, "Show", 2)
newButton("autopost", 6, "Auto Post Blind")

return

;_________end of auto-execute section___________

;_________subroutines:

get_table_list:
table_list := Update_tables() ; the function returns a comma seperated list of unique window IDs
Loop, Parse, table_list, `, ;assign these IDs to the variables "table_1", "table_2" etc.
{
table_%A_Index% = %A_LoopField%
}
return

show_hide: ;hide the GUI if a) def_t doesn't exist, b) def_t is minimized or c) the active window is maximized
IfWinExist, ahk_id%def_t%
{
WinGet, is_maximised_active, MinMax, A
WinGet, is_minimized_def_t, MinMax, ahk_id%def_t%
If (is_maximised_active = 1 or is_minimized_def_t = -1)
Gui, Hide
else
Gui, Show, NoActivate
}
else
Gui, Hide
return

LaunchNavigator: ;do what the original script did in the auto-execute-section (and still does, if auto-launch was selected)
Gosub, get_table_list
def_t = %table_1%
SetTimer, get_table_list, 1000
WinGetPos, x, y, , , ahk_id%def_t%
Gui, 1: Show, w800 h%size_titlebar% x%x% y%y% NoActivate, table_navigator
SetTimer, show_hide, 200
SetTimer, WatchAxis, 5 ; ### Juk: Added this for Joyapd control (5ms?).
return

Exit:
3GuiClose:
WinGetPos, 3pos_x, 3pos_y, , , Table Navigator
Gui, 3: Destroy

IniWrite, %3pos_x%, TableNavigator.ini, Position, 3pos_x
IniWrite, %3pos_y%, TableNavigator.ini, Position, 3pos_y
IniWrite, %wrapping_on%, TableNavigator.ini, Wrapping, wrapping_on
IniWrite, %wrapping_off%, TableNavigator.ini, Wrapping, wrapping_off
IniWrite, %activate_on%, TableNavigator.ini, ActivateTarget, activate_on
IniWrite, %activate_off%, TableNavigator.ini, ActivateTarget, activate_off
IniWrite, %auto_launch%, TableNavigator.ini, AutoLaunch, auto_launch
ExitApp
return

3GuiSize:
If ErrorLevel = 1
Gui, 3: Hide
return

Show:
Gui, 3: Restore
Gui, 3: Show
return

Wrapping_on:
wrapping_on = 1
wrapping_off = 0
return

Wrapping_off:
wrapping_off = 1
wrapping_on = 0
return

Activate_on:
activate_on = 1
activate_off = 0
return

Activate_off:
activate_off = 1
activate_on = 0
return

AutoLaunchNavigator:
If auto_launch = no
auto_launch = yes
else
auto_launch = no
Menu, FileMenu, ToggleCheck, Auto-Launch Navigator
return

PlayMoney:
If TableType = Play
TableType = Table
else
TableType = Play
Menu, FileMenu, ToggleCheck, Test on Play Money
return

Help:
Gui, 4: Color, F5F5DC
Gui, 4: Font, s10, Arial
Gui, 4: Add, Text, ,
(

1. Turning Wrapping off will prevent TN from
moving to the next row or column when it has
reached the last table in that row or column.

2. Turning "Activate Target" on will cause the table
under TN to be activated. This might be especially
useful when over-lapping.

3. Selecting "Auto-Launch Navigator" from the
File Menu will cause the Navigator to be launched
automatically the next time you start TN.

4. If you wish to test TN on play money first, select
"Test on Play Money" from the File Menu.

)
Gui, 4: Add, Button, vbutton_close_help Center gCloseHelp, Close
Gui, 4: Show, autosize Hide, Help
GuiControlGet, button_close_help, 4: pos
GuiControl, 4: Move, button_close_help, % "x" (334 - button_close_helpW)/2
Gui, 4: Show
return

CloseHelp:
Gui, 4: Destroy
return

; ### Juk added this to try to get Joypad working.
WatchAxis:
GetKeyState, JoyX, JoyX ; Get position of X axis.
GetKeyState, JoyY, JoyY ; Get position of Y axis.
KeyToHoldDownPrev = %KeyToHoldDown% ; Prev now holds the key that was down before (if any).
if JoyX > 70
KeyToHoldDown = right
else if JoyX < 30
KeyToHoldDown = left
else if JoyY > 70
KeyToHoldDown = down
else if JoyY < 30
KeyToHoldDown = up
else
KeyToHoldDown =
if KeyToHoldDown = %KeyToHoldDownPrev% ; The correct key is already down.
return ; Do nothing.
; Otherwise, release the previous key and press down the new key:
SetKeyDelay -1 ; Avoid delays between keystrokes.
if KeyToHoldDown ; There is a key to press down.
{
If wrapping_on = 1
def_t := GetTargetWrap(KeyToHoldDown)
else
def_t := GetTargetNoWrap(KeyToHoldDown)
WinGetPos, px, py, , , ahk_id%def_t% ;move the GUI to the new de_t
Gui, Show, w%w% x%px% y%py% NoActivate
If activate_on = 1
WinActivate, ahk_id%def_t%
}
return

;_________hotkeys:

!down::
key = down
If wrapping_on = 1
def_t := GetTargetWrap(key) ;pass "key" to the GetTarget function which returns the new def_t
else
def_t := GetTargetNoWrap(key)
WinGetPos, px, py, , , ahk_id%def_t% ;move the GUI to the new de_t
Gui, 1: Show, x0 y0 w800 h30
Gui, 1: Show, w%w% x%px% y%py% NoActivate
If activate_on = 1
WinActivate, ahk_id%def_t%
WinActivate, table_navigator
return

!up::
key = up
If wrapping_on = 1
def_t := GetTargetWrap(key)
else
def_t := GetTargetNoWrap(key)
WinGetPos, px, py, , , ahk_id%def_t%
Gui, 1: Show, w%w% x%px% y%py% NoActivate
If activate_on = 1
WinActivate, ahk_id%def_t%
return

!right::
key = right
If wrapping_on = 1
def_t := GetTargetWrap(key)
else
def_t := GetTargetNoWrap(key)
WinGetPos, px, py, , , ahk_id%def_t%
Gui, 1: Show, w%w% x%px% y%py% NoActivate
If activate_on = 1
WinActivate, ahk_id%def_t%
return

!left::
key = left
If wrapping_on = 1
def_t := GetTargetWrap(key)
else
def_t := GetTargetNoWrap(key)
WinGetPos, px, py, , , ahk_id%def_t%
Gui, 1: Show, w%w% x%px% y%py% NoActivate
If activate_on = 1
WinActivate, ahk_id%def_t%
return

;Sams hotkeys:

!1::
ControlGetText, check, AfxWnd42s15, ahk_id%def_t%
IfInString, check, Check ;this button has the same name as the call button, so we have to check if it actually is a Check-Button
{
ControlClick, AfxWnd42s15, ahk_id%def_t%
check =
}
else
ClickVis(1)
return


!2::
clickVis(2)
return
!3::
clickVis(3)
return
!4::
clickVis(4)
return
!5::
clickVis(5)
return
!6::
clickVis(6)
return
!7::
debug()
return
!8::
Gui, 1: Show ;This will restore the GUI if it gets lost
return



; ### JUK: Added these to make joypad buttons map to Sam's functions (for my joypad only).
Joy3::
ControlGetText, check, AfxWnd42s15, ahk_id%def_t%
IfInString, check, Check ;same as above
{
ControlClick, AfxWnd42s15, ahk_id%def_t%
check =
}
else
ClickVis(1)
return
Joy1::ClickVis(2)
Joy2::ClickVis(3)


;_________functions:

Update_tables() ;this function returns "table_list" and also operates on the GUI (which is why "size_titlebar" is made global):
{
global size_titlebar
global TableType

WinGet, pid, PID, Welcome to the PartyPoker.com ;retrieves the process ID (using the window title of the lobby)

WinGet, id, list, %TableType% ahk_pid%pid% ahk_class #32770, , Welcome to the PartyPoker.com Lobby, Side Bet ;make a list of windows IDs matching ahk_pid/class, excluding the lobby
Loop, %id%
{
StringTrimRight, this_id, id%a_index%, 0 ;look familiar?
WinGetPos, x, y, w, h, ahk_id %this_id%
w -= 50 ;this allows for slight overlap or slightly different table sizes
h -= 50

If (x < a_screenwidth/6 AND y < a_screenheight/6) ;determine the table number based on its position
table_1 = %this_id%
If (x < a_screenwidth/6 AND y > a_screenheight/6 AND y < 2*h)
table_2 = %this_id%
If (x < a_screenwidth/6 AND y >= 2*h)
table_3 = %this_id%
If (x > a_screenwidth/6 AND y < a_screenheight/6 AND x < 2*w AND y < 2*h)
table_4 = %this_id%
If (x > a_screenwidth/6 AND y > a_screenheight/6 AND x < 2*w AND y < 2*h)
table_5 = %this_id%
If (x > a_screenwidth/6 AND x < 2*w AND y >= 2*h)
table_6 = %this_id%
If (y < a_screenheight/6 AND x >= 2*w)
table_7 = %this_id%
If (y > a_screenheight/6 AND x >= 2*w AND y < 2*h)
table_8 = %this_id%
If (x > a_screenwidth/6 AND x >= 2*w AND y >= 2*h)
table_9 = %this_id%
}
table_list = %table_1%,%table_2%,%table_3%,%table_4%,%table_5%, %table_6%,%table_7%,%table_8%,%table_9%
w += 50 ;reset to the actual width

;modify the GUI according to the height of the titlebar, the width of the table(s)
;(this assumes all tables are roughly the same size) and round the edges because it looks better:

WinSet, Region, w%w% h%size_titlebar% 0-0 %w%-0 %w%-%size_titlebar% 0-%size_titlebar% R20-20, table_navigator

return, table_list ;return "table_list"
}


GetTargetWrap(key) ;this function returns the new "def_t" when passed "key"
{
global def_t ;make these two variables global
global table_list

If key = down
new_order = 123456789 ;since this is the order the tables are in anyways, new_order equals the old order in this case
If key = up
new_order = 987654321 ;"up" is the opposite of "down" so we just reverse the order
If key = right
new_order = 147258369 ;the table to the right of table_1 is table_4 etc.
If key = left
new_order = 963852741 ;reverse the order for "right"

Loop, Parse, table_list, `, ;parse table_list, assigning each substring (ID) a new table number based on the new order
{
StringMid, new_number, new_order, %a_index%, 1
table_%new_number% = %a_loopfield%
}
Loop, 9
{
StringTrimRight, table, table_%a_index%, 0 ;acces the (new) array to find out which number the def_t is in the new order
If def_t = %table%
{
table_number = %a_index%
break
}
}
Loop, 9 ;this loop finds the number of the next table in the list (target)
{
table_number++ ;for instance: if the loop above determined that the def_t is table_5, this loop looks for table_6 first;
If table_%table_number% <> ;if "table_6" is empty, it looks for table_7 and so on
{
target = %table_number%
break
}
If table_number >= 9 ;if table_number reaches 9, tables 6 through 9 didn't exist, to continue the example above
table_number = 0 ;so we search for tables 1 through 4 (table_number is set to 1 at the beginning of the next loop iteration)
}
target := table_%target% ;once we've found "target", change it to be the ID of the table (using the array created by the first loop)
IfWinExist, ahk_id%target% ;only return a new de_t if it actually still exists; else, return the old def_t
{
def_t = %target%
}
Return, def_t ;return "def_t"
}


GetTargetNoWrap(key) ;this function returns the new "def_t" when passed "key"
{
global def_t ;make these two variables global
global table_list


Loop, 9
{
StringTrimRight, table, table_%a_index%, 0 ;acces the array to find out which number the def_t is in the new order
If def_t = %table%
{
table_number = %a_index%
break
}
}

If table_number = ;we need to find a table_number; this isn't perfect, but it does the trick
{
Loop, Parse, table_list, `,
{
If a_loopfield <>
def_t = %a_loopfield%
}
}


If key = down
{
If table_number = 1
target = 2
If table_number = 2
target = 3
If table_number = 4
target = 5
If table_number = 5
target = 6
If table_number = 7
target = 8
If table_number = 8
target = 9
}
If key = up
{
If table_number = 9
target = 8
If table_number = 8
target = 7
If table_number = 6
target = 5
If table_number = 5
target = 4
If table_number = 3
target = 2
If table_number = 2
target = 1
}
If key = right
{
If table_number = 1
target = 4
If table_number = 4
target = 7
If table_number = 2
target = 5
If table_number = 5
target = 8
If table_number = 3
target = 6
If table_number = 6
target = 9
}
If key = left
{
If table_number = 9
target = 6
If table_number = 6
target = 3
If table_number = 8
target = 5
If table_number = 5
target = 2
If table_number = 7
target = 4
If table_number = 4
target = 1
}

target := table_%target% ;once we've found "target", change it to be the ID of the table (using the array created by the first loop)
IfWinExist, ahk_id%target% ;only return a new de_t if it actually still exists; else, return the old def_t
{
def_t = %target%
}
Return, def_t ;return "def_t"
}


;the rest of Sams functions:

debug()
{
local but, num, Output
but = 1
Loop
{
if(but > numButtons)
break
num = 1
Loop
{
if(num > numButtons%but%)
break
if(visible(but,num) = 1)
Output = % Output . names%but%x%num% . " is visible.`n"
num += 1
}
but += 1
}
MsgBox %Output%
}

clickVis(button)
{
local output, i, isVis, currString, currMatch
WinGetTitle, winTitle, ahk_id%def_t%
i = 1
Loop
{
if(i > numButtons%button%)
break
if (visible(button,i) = 1)
{
currMatch := matches%button%x%i%
SetTitleMatchMode, %currMatch%
currString := strings%button%x%i%
ControlClick, %currString%, %winTitle%
break
}
i += 1
}
}

visible(but, num)
{
local currentMatch, currentString
local output
currentMatch = % matches%but%x%num%
currentString = % strings%but%x%num%
SetTitleMatchMode % currentMatch
ControlGet, output, Visible, , %currentString%, %winTitle%
if output <> 1
{
output = 0
}
return output
}
newButton(name, button, string, match=3)
{
local buttonCount
numButtons += 1
numButtons%button% += 1
buttonCount := numButtons%button%
names%button%x%buttonCount% := name
matches%button%x%buttonCount% := match
strings%button%x%buttonCount% := string
}

;_______end of code_____
TableNavigator Quote

      
m