![]() |
Re: A script you might like
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. |
Re: A script you might like
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 [img]/images/graemlins/smile.gif[/img] |
Re: A script you might like
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 [img]/images/graemlins/frown.gif[/img]). 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?). [img]/images/graemlins/smile.gif[/img] Juk [img]/images/graemlins/smile.gif[/img] |
Re: A script you might like
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 [img]/images/graemlins/crazy.gif[/img] 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. |
Re: A script you might like
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: <font color="red"> !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 </font> !2:: clickVis(2) return !3:: clickVis(3) return !4:: clickVis(4) return !5:: clickVis(5) return !6:: clickVis(6) return !7:: debug() return <font color="red"> !8:: Gui, 1: Show ;This will restore the GUI if it gets lost return </font> ; ### 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 <font color="red"> ;same as above</font> { 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? [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 } } <font color="red"> 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% } } </font> 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_____ |
Re: A script you might like
Lol, AHK tilt setting in for me too [img]/images/graemlins/confused.gif[/img]
I have a gut feeling some of this strangeness has to be the psudo-threads (they seem like thread like probs to me...) [img]/images/graemlins/smile.gif[/img] I gona try to get everything in 1 timer and use counters to fix the sepearte delays if needed. Mouseclicks fall through it for me too, but wont fall through for the scripts setting dialog - very strange, but was using this as a feature to be able to click 'X' on the tables. I found making the GUI a bit less wide and offseting it a bit helped avoid this (and using PartyPlanner, so offset avoids overlap with PartyPlanner's tab in the top left): w -= 50 WinSet, Region, w%w% h%size_titlebar% 25-0 %w%-0 %w%-%size_titlebar% 0-%size_titlebar% R20-20, table_navigator Juk [img]/images/graemlins/smile.gif[/img] |
Re: A script you might like
Im a terrible newbie, but I did tried my best to search, and didn't come to a solution.
- Doest this work with party only? - Do I have to sit at the tables to navigate, or can it be used with observing tables to? - Why do I have to chance play to real $? Neither one seems to work for me. Thanks in advance, .carriermonkey |
Re: A script you might like
[ QUOTE ]
- Doest this work with party only? [/ QUOTE ] Currently, yes. Getting this to work with other sites is can't be a big deal though; the more tedious part is finding the controls to be clicked, since they'll have different names on other sites of course. I believe there are some scripts for other sites around though. If someone could post a link I'd be happy to modify the navigating part (once I've played all those hands I have to play to get the new Party bonus, lol.) [ QUOTE ] - Do I have to sit at the tables to navigate, or can it be used with observing tables to? [/ QUOTE ] You don't have to sit at the table, no. [ QUOTE ] - Why do I have to chance play to real $? Neither one seems to work for me. [/ QUOTE ] Try the latest version; that should work. If it still doesn't, let me know. |
Re: A script you might like
Well to cut a long story short: Tested the new script, added the !8:: options to back button of joypad, everything looked fine, was like "oh yes, can finally play some poker with new setup!", stood up to get a drink ready, tripped over USB wire and broke the [censored] joypad [img]/images/graemlins/mad.gif[/img]
So now I have 1 100% broken USB joypad, and 2 old midi-style ones where the buttons stick and I don't trust em enough for poker [img]/images/graemlins/frown.gif[/img] Oh well, lets just hope I have more luck at the tables [img]/images/graemlins/laugh.gif[/img] On Monday I get a new (hopefully indestructible!) joypad, but until then I will try to put the keyboard command to work. Juk [img]/images/graemlins/smile.gif[/img] |
Re: A script you might like
Man, you have terrible luck.
I’ve been thinking about what to do with all the free buttons on my joypad; tried this, but no luck: Joy7:: Critical GetBeer, MyFavorite, Cold return [img]/images/graemlins/frown.gif[/img] [img]/images/graemlins/laugh.gif[/img] |
All times are GMT -4. The time now is 10:01 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.