![]() |
|
#41
|
|||
|
|||
|
[ QUOTE ]
I have also pretty much given up on writing something that lets you select a specific open seat via joypad - I have some nice code that highlights a seat but I can't find an easy way to ignore all kinds of other controls with the same name (which are reported as visible even if I can't see them...). I just use brute force now - just have it click every friggin button it can find with that name and then close all the "this seat has already been reserved etc." pop-ups. [img]/images/graemlins/grin.gif[/img] Of course this just takes the first free seat it can find - to select a specific seat you'll have to use the keyboard I guess. [/ QUOTE ] Screw that. I got it to work. Guess I shouldn't try to do that kind of stuff at two in the morning. [img]/images/graemlins/laugh.gif[/img] |
|
#42
|
|||
|
|||
|
Lol, late night AHK tilt again? [img]/images/graemlins/smile.gif[/img]
I look forward to seeing/using it! Juk [img]/images/graemlins/smile.gif[/img] |
|
#43
|
|||
|
|||
|
Lol juk - I'm sorry, but this is ...uhm... not as easy as I though. 2 in the morning again and AHK tilt setting in. [img]/images/graemlins/crazy.gif[/img] Have to finish it tomorrow.
|
|
#44
|
|||
|
|||
|
Lol, I know the feeling and don't think I will get chance to test it until tomorrow now anyway [img]/images/graemlins/smile.gif[/img]
Only 1am here, but late night Win32-GDI tilt set in for me now - Just spend last two hours on about 10 lines of code, and it still not working [img]/images/graemlins/confused.gif[/img] Maybe sleep will help me too... Juk [img]/images/graemlins/smile.gif[/img] |
|
#45
|
|||
|
|||
|
This was pretty easy - thanks to Bishop22 for finding the new control names [img]/images/graemlins/smile.gif[/img]
Just a quick fix, mind you. ;__________________________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 = 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 Menu, Tray, Add, Exit, Exit 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 = Joy1; Will attempt to find fold buttons in the following order: newButton("fold", 1, "AfxWnd4217") ;( newButton("checkFoldInTurn", 1, "AfxWnd4223") newButton("foldInTurn", 1, "AfxWnd4222") ;CALL = Joy2; Will attempt to find check/call buttons in order: newButton("call", 2, "Call (", 1) newButton("check", 2, "AfxWnd4218") ;( newButton("cInTurn", 2, "AfxWnd4224") ;RAISE = Joy3; Will attempt to find bet/raise buttons in this order: newButton("bet", 3, "Bet", 1) newButton("raise", 3, "Raise", 1) newButton("r1InTurn", 3, "AfxWnd4226") ;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") ;( ; <font color="red"> __________________I don't know what this button does; somebody find the the new control name please</font> 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 money TableType = else TableType = Play money 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:: 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 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 global TableType WinGet, pid, PID, PartyPoker.com: ;retrieves the process ID (using the window title of the lobby) WinGet, id, list, %TableType% ahk_pid%pid% ahk_class #32770, , PartyPoker.com: , BLACK ;make a list of windows IDs matching ahk_pid/class, excluding the lobby Loop, %id% { StringTrimRight, this_id, id%a_index%, 0 ;look familiar? [img]/images/graemlins/smile.gif[/img] 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" [img]/images/graemlins/smile.gif[/img] 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 = { 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_____ |
|
#46
|
|||
|
|||
|
Thanks again for this Roland! [img]/images/graemlins/smile.gif[/img]
Will give it a real good test tomorrow when no so sleepy... [img]/images/graemlins/smile.gif[/img] BTW: Does/did the 'anti-slip' thing cause any problems with the script? Juk [img]/images/graemlins/smile.gif[/img] |
|
#47
|
|||
|
|||
|
[ QUOTE ]
BTW: Does/did the 'anti-slip' thing cause any problems with the script? [/ QUOTE ] Nope, but only tested on two tables so far. I'm pretty sure it'll be okay though - in the MiniLobby script I can click a button that's totally [censored] up and won't react to mouseclicks whatsoever; bit of anti-slip can't be any trouble. [img]/images/graemlins/grin.gif[/img] |
|
#48
|
|||
|
|||
|
Nice! No more anti-slip and I am a very happy man [img]/images/graemlins/laugh.gif[/img]
Juk [img]/images/graemlins/smile.gif[/img] |
|
#49
|
|||
|
|||
|
I'm inspired by Roland and what AHK can do with him. I mean, vice versa.
Anyway, I'm going to enable hotkeys for PartyPlanner to make it conducive to building into AHK scripts. . . As a base, planning to KB hook CTRL-0 through CTRL-9 to activate/foreground the corresponding table slots, and CTRL-S to cause a swap between the last two hot-keyed table slots. Should make it really easy to roll into hotkey buttons. . . gonna pick up a joypad for myself. Any thoughts? I'm thinking to wire up keys to Lobby Up/Lobby down, too. . . maybe CTRL-U and CTRL-D. These would be Global KB hooks, but I would make them optional if people want. If I have time to blow, I'll make them remappable, but not any time soon. |
|
#50
|
|||
|
|||
|
I'm glad I... err... AHK inspired you.
No thoughts at the moment but this should be intersting. |
![]() |
|
|