![]() |
|
#1
|
|||
|
|||
![]()
Okay, it seems to work (after almost crashing my computer when I got something wrong and it endlessly closed and re-opened all the tables [img]/images/graemlins/smile.gif[/img]). Wouldn't surprise me if there are a ton of bugs though (I told Sam he could optimize it [img]/images/graemlins/tongue.gif[/img]).
#Persistent SetTitleMatchMode, 2 ;____i forget why I used this, but don't want to break anything [img]/images/graemlins/smile.gif[/img] WinGet, lobby_id, ID, PartyPoker.com GroupAdd, tables, Good Luck ahk_class #32770 ;____used to minimize all the tables later game_type = full ;_____change this to "6max" if you want mine 6max ;_____chnage these to whatever you want: players_min_6max = 5 players_min_full = 10 players_max_6max = 6 players_max_full = 10 Gosub, OpenTables ;_____open the 10 tables SetTimer, CheckTables, 30000 ;______I figured it makes more sense to wait if somebody takes an open seat or whatever, thus 30 seconds return ;_____end of auto-execute section______ OpenTables: Critical ;______we don't want the CheckTables subroutine messing anything up table_number := id ;_____this will be blank the first time around; later it contains the number of tables already open ControlFocus, SysListView321, ahk_id%lobby_id% ;set focus to the ListView ControlGet, count, List, Count, SysListView321, ahk_id%lobby_id% ;____used below to break if we reach the end of the list before we find 10 tables ControlGet, focused, List, Count Focused, SysListView321, ahk_id%lobby_id% ;____we want to select the topmost row, ;_____so we just send %focused% amount of UP keystrokes: Loop, %focused% ControlSend, SysListView321, {UP}, ahk_id%lobby_id% Loop { ControlGet, players, List, Focused Col3, SysListView321, ahk_id%lobby_id% ;retrieve the contents of the 3rd column in the focused row (looks like 7/10 or whatever) StringRight, is_6max, players, 1 ;___if this is a 6max table this character will be "6" StringLeft, players, players, 2 ;____the two character from the left; will be either "10" or something like 9/ IfInString, players, / ;if the table isn't full we have to get rid of the "/" StringTrimRight, players, players, 1 ;_____using the number of players / game_type we just retrieved and the min/max player numbers definded in the auto-execute section, ;_____ we check if we want this table: If (((game_type = "6max") AND (is_6max = 6 AND players >= players_min_6max AND players <= players_max_6max)) OR ((game_type = "full") AND (is_6max <> 6 AND players >= players_min_full AND players <= players_max_full))) { ControlSend, SysListView321, {Enter}, ahk_id%lobby_id% ;_____if yes, send an enter keystroke to open it If ErrorLevel = 0 ;_____if we could open it, increase table_number by 1 (used below to break) table_number++ } ControlSend, SysListView321, {DOWN}, ahk_id%lobby_id% ;_____move to the next table If (table_number >= 10 OR a_index > count) ;____if we reach 10 tables or the end of the list, break break } WinMinimize, ahk_group tables ;_____minimize all the tables (mine get (censored) up if I leave them all maximised for too long) return CheckTables: ;_____check if we still like the tables id = 0 ;_____not sure about this array here but just in case... WinGet, id, List, Good Luck ahk_class #32770, , PartyPoker.com ;_____make a list of all the party tables, excluding Lobby If id < 10 ;_____if we have less then 10, open some (table_number in the OpenTables thread is set to %id% { Gosub, OpenTables return } Loop, %id% ;if we have 10 open, check them { StringTrimRight, this_id, id%a_index%, 0 ;_____access array WinGetTitle, title, ahk_id%this_id% ;_____retrieve the name of this table as shown in the lobby StringGetPos, pos, title, - StringLeft, title, title, %pos% StringTrimRight, title, title, 2 ControlGet, list, List, , SysListView321, ahk_id%lobby_id% ;______probably not the most elegant way to do it, but what the hell; just get all the info and parse it Loop, Parse, List, `n ;____(each row ends in a linefeed) { IfInString, a_loopfield, %title% { StringGetPos, pos_tab3, a_loopfield, %A_Tab%, L3 ;____if we find the title, retrieve the number of players StringGetPos, pos_tab2, a_loopfield, %A_Tab%, L2 StringLeft, players, a_loopfield, %pos_tab3% StringTrimLeft, players, players, % pos_tab2+1 StringLeft, players, players, 2 IfInString, players, / StringTrimRight, players, players, 1 ;______kinda like reversing the expression in the other thread; now we're checking if it DOESN'T suit us If (((game_type = "6max") AND (players < players_min_6max OR players > players_max_6max)) OR ((game_type = "full") AND (players < players_min_full OR players > players_max_full))) { WinClose, ahk_id%this_id% ;_____if we don't like it, close it { WinWaitClose, ahk_id%this_id% ;_____wait till it has closed id = 9 ;____since we got this far, we have to have 9 tables open (after closing number 10); another "just in case" or whatever Gosub, OpenTables ;____open a new table } } } } } return edit: Changed title to reflect new (goofy) name. -Sam |
#2
|
|||
|
|||
![]()
Looks like this is code to keep 10 tables open at a time, correct? What language is that, vbscript?? Can I save that as a .vbs file then fire away?
|
#3
|
|||
|
|||
![]()
No, this is AutoHotkey. Save it as .ahk and fire away... I hope it doesn't backfire [img]/images/graemlins/smile.gif[/img]
|
#4
|
|||
|
|||
![]()
sam and roland,
i finally get to use this cool script. it was great watching it come together and being privy to the thought processes that went into it. "bump"---as i foresee i-witness becoming rather popular in the wake of juk's recent release. cheers and thanks guys, sean |
#5
|
|||
|
|||
![]()
Awesome. Thanks. I'll take a look at it tonight.
-Sam P.S. Remember that the [ code ] tags will keep your perty indentation from getting garbled. |
#6
|
|||
|
|||
![]()
look at my post
http://forumserver.twoplustwo.com/showth...e=0#Post4809332 (its look that my fonts remain bug. (also when i change it to 96dpi and less (72 dpi) this no effect party font size) |
#7
|
|||
|
|||
![]()
Lol, I was just going to respond with a link to MiniLobby, then I saw you're my only taker so far. [img]/images/graemlins/smile.gif[/img]
There's no way I know of to change the font in a ListView with AutoHotkey, to answer your question. Btw, I would appreciate some feedback on the avg. pot size thing - I really like it, but I play Stud mostly and thus don't have all these other means of table selection. Do you think it is helpfull? |
#8
|
|||
|
|||
![]()
[ QUOTE ]
P.S. Remember that the [ code ] tags will keep your perty indentation from getting garbled. [/ QUOTE ] Yeah, but then you won't be able to simply copy&paste. Because it garbles the linefeeds instead. Besides, the tabs are way to wide - you'd have to scroll horizontally all the time just to take a look at it. Can't have everything. [img]/images/graemlins/frown.gif[/img] |
#9
|
|||
|
|||
![]()
[ QUOTE ]
[ QUOTE ] P.S. Remember that the [ code ] tags [/ QUOTE ] Yeah, but then you won't be able to simply copy&paste. Because it garbles the linefeeds instead. Can't have everything. [img]/images/graemlins/frown.gif[/img] [/ QUOTE ]Ah, but what if I link to the code, and THEN post it?! HA! (Wide-lines be damned. I have a big screen.) Below I added a GUI to enter preferences and added a .ini to save them. My code's in red below. I want to add better support for logged-out mining. I also haven't even gotten into your nitty & gritty details to do the optimizing you actually asked for; I'll get into those maybe tonight. I started calling it "FreeMine", since we're (clearly) giving-out the source. I expect we'll have some GPL mumbo-jumbo, to make sure nobody sells it, but publishing it here should stop that. [img]/images/graemlins/smile.gif[/img] -Sam <font class="small">Code:</font><hr /><pre> #Persistent SetTitleMatchMode, 2 ;____i forget why I used this, but don't want to break anything WinGet, lobby_id, ID, PartyPoker.com GroupAdd, tables, Good Luck ahk_class #32770 ;____used to minimize all the tables later<font color=" red"> ;Read all the stats string = 6 min IniRead, players_min_6max, FreeMine.ini, Prefs, %string%, 1 string = Full min IniRead, players_min_full, FreeMine.ini, Prefs, %string%, 2 string = Game Type IniRead, game_type, FreeMine.ini, Prefs, %string%, full string = Number of Tables IniRead, tables_max, FreeMine.ini, Prefs, %string%, 10 ;These are silly.</font> players_max_6max = 6 players_max_full = 10 <font color=" red">;Gui Gui, Add, Text, x6 y7 w100 h20, Min Players 6Max Gui, Add, Text, x6 y37 w100 h20, Max Players 10Max Gui, Add, DropDownList, x116 y7 w40 h20 vplayers_min_6max gGUISubmit, 1|2|3|4|5|6 Gui, Add, DropDownList, x116 y37 w40 h21 vplayers_min_full gGUISubmit, 1|2|3|4|5|6|7|8|9|10 Gui, Add, Radio, x6 y67 w50 h20 vgui_typebox gGUISubmit, 6Max ;The 2nd radio needs a different variable, just for setting and disabling. Dumb. Gui, Add, Radio, x96 y67 w60 h20 vgui_typebox2 gGUISubmit, Full ;Note that radio buttons have to be sequential to be in the same group. Gui, Add, Button, x6 y127 w70 h20 vgui_gobutton gGuiGo, Go Gui, Add, Button, x86 y127 w70 h20 vgui_stopbutton gGuiStop, Stop Gui, Add, Radio, x6 y97 w50 h20 vgui_loginbox gGUISubmit, Login Gui, Add, Radio, x96 y97 w60 h20 vgui_loginbox2 gGUISubmit, Logout Gui, Show, x953 y392 h156 w164, FreeMine ;Set the controls to the read stats. GuiControl, Choose, players_min_6max, %players_min_6max% GuiControl, Choose, players_min_full, %players_min_full% if game_type = 6max GuiControl,, gui_typebox, 1 else GuiControl,, gui_typebox2, 1 if tables_max = 10 GuiControl,, gui_loginbox, 1 else GuiControl,, gui_loginbox2, 1 ;--Disable the stop button. GuiControl, Disable, gui_stopbutton</font> return ;_____end of auto-execute section______ OpenTables: Critical ;______we don't want the CheckTables subroutine messing anything up table_number := id ;_____this will be blank the first time around; later it contains the number of tables already open ControlFocus, SysListView321, ahk_id%lobby_id% ;set focus to the ListView ControlGet, count, List, Count, SysListView321, ahk_id%lobby_id% ;____used below to break if we reach the end of the list before we find 10 tables ControlGet, focused, List, Count Focused, SysListView321, ahk_id%lobby_id% ;____we want to select the topmost row, ;_____so we just send %focused% amount of UP keystrokes: Loop, %focused% ControlSend, SysListView321, {UP}, ahk_id%lobby_id% Loop { ControlGet, players, List, Focused Col3, SysListView321, ahk_id%lobby_id% ;retrieve the contents of the 3rd column in the focused row (looks like 7/10 or whatever) StringRight, is_6max, players, 1 ;___if this is a 6max table this character will be "6" StringLeft, players, players, 2 ;____the two character from the left; will be either "10" or something like 9/ IfInString, players, / ;if the table isn't full we have to get rid of the "/" StringTrimRight, players, players, 1 ;_____using the number of players / game_type we just retrieved and the min/max player numbers definded in the auto-execute section, ;_____ we check if we want this table: If (((game_type = "6max") AND (is_6max = 6 AND players >= players_min_6max AND players <= players_max_6max)) OR ((game_type = "full") AND (is_6max <> 6 AND players >= players_min_full AND players <= players_max_full))) { ControlSend, SysListView321, {Enter}, ahk_id%lobby_id% ;_____if yes, send an enter keystroke to open it If ErrorLevel = 0 ;_____if we could open it, increase table_number by 1 (used below to break) table_number++ } ControlSend, SysListView321, {DOWN}, ahk_id%lobby_id% ;_____move to the next table If (table_number >= <font color=" red">tables_max</font> OR a_index > count) ;____if we reach 10 tables or the end of the list, break break } WinMinimize, ahk_group tables ;_____minimize all the tables (mine get (censored) up if I leave them all maximised for too long) return CheckTables: ;_____check if we still like the tables id = 0 ;_____not sure about this array here but just in case... WinGet, id, List, Good Luck ahk_class #32770, , PartyPoker.com ;_____make a list of all the party tables, excluding Lobby If id < <font color=" red">tables_max</font> ;_____if we have <font color="red">fewer</font> then 10, open some (table_number in the OpenTables thread is set to %id% { Gosub, OpenTables return } Loop, %id% ;if we have 10 open, check them { StringTrimRight, this_id, id%a_index%, 0 ;_____access array WinGetTitle, title, ahk_id%this_id% ;_____retrieve the name of this table as shown in the lobby StringGetPos, pos, title, - StringLeft, title, title, %pos% StringTrimRight, title, title, 2 ControlGet, list, List, , SysListView321, ahk_id%lobby_id% ;______probably not the most elegant way to do it, but what the hell; just get all the info and parse it Loop, Parse, List, `n ;____(each row ends in a linefeed) { IfInString, a_loopfield, %title% { StringGetPos, pos_tab3, a_loopfield, %A_Tab%, L3 ;____if we find the title, retrieve the number of players StringGetPos, pos_tab2, a_loopfield, %A_Tab%, L2 StringLeft, players, a_loopfield, %pos_tab3% StringTrimLeft, players, players, % pos_tab2+1 StringLeft, players, players, 2 IfInString, players, / StringTrimRight, players, players, 1 ;______kinda like reversing the expression in the other thread; now we're checking if it DOESN'T suit us If (((game_type = "6max") AND (players < players_min_6max OR players > players_max_6max)) OR ((game_type = "full") AND (players < players_min_full OR players > players_max_full))) { WinClose, ahk_id%this_id% ;_____if we don't like it, close it { WinWaitClose, ahk_id%this_id% ;_____wait till it has closed id = 9 ;____since we got this far, we have to have 9 tables open (after closing number 10); another "just in case" or whatever Gosub, OpenTables ;____open a new table } } } } } return <font color=" red"> ;--Records all the controls, both to variables and to .ini. GUISubmit: Gui, Submit, NoHide string = 6 Min IniWrite, %players_min_6max%, FreeMine.ini, Prefs, %string% string = Full Min IniWrite, %players_min_full%, FreeMine.ini, Prefs, %string% string = Game Type if gui_typebox = 1 game_type = 6max else game_type = full IniWrite, %game_type%, FreeMine.ini, Prefs, %string% string = Number of Tables if gui_loginbox = 1 tables_max = 10 else tables_max = 4 IniWrite, %tables_max%, FreeMine.ini, Prefs, %string% return GuiClose: ExitApp ;The GO button. Disables all buttons, starts the thread. GuiGo: ;Reconds the variables, just in case. GoSub GUISubmit ;Disables the buttons. GuiControl, Disable, players_min_6max GuiControl, Disable, players_min_full GuiControl, Disable, gui_typebox GuiControl, Disable, gui_typebox2 GuiControl, Disable, gui_loginbox GuiControl, Disable, gui_loginbox2 GuiControl, Disable, gui_gobutton GuiControl, Enable, gui_stopbutton ;Runs the original "go" code.</font> Gosub, OpenTables ;_____open the 10 tables SetTimer, CheckTables, 30000 ;______I figured it makes more sense to wait if somebody takes an open seat or whatever, thus 30 seconds <font color=" red">return ;The STOP button. Enables all buttons, stops the thread. GuiStop: ;Stop the timer. SetTimer, CheckTables, Off ;Re-enable the buttons. GuiControl, Enable, players_min_6max GuiControl, Enable, players_min_full GuiControl, Enable, gui_typebox GuiControl, Enable, gui_typebox2 GuiControl, Enable, gui_loginbox GuiControl, Enable, gui_loginbox2 GuiControl, Enable, gui_gobutton GuiControl, Disable, gui_stopbutton return</font></pre><hr /> |
#10
|
|||
|
|||
![]()
I was thinking about networking. I know this isn't really AHK's cup 'o tea, but it'd be really cool if we could totally replicate the original features of PartyMine in AHK.
I did a little research, but didn't find much. I thought, instead of real networking, we could just write the table-list to a file on the harddrive and share the folder. That'd require a bit more from the user to setup, but it'd be easy to write. This would have the added benefit of letting you use multiple Windows accounts, since there'd be no difference between 2 machines accessing the folder and 2 accounts accessing the folder. Whatcha think? -Sam |
![]() |
|
|