#1
|
|||
|
|||
AHK Coding Problem/Opening Tables on Party
As a few of you use AHK a lot, I thought I'd have some luck asking here, as it's a Party-specific problem, rather than one related to AHK. I think.
I have four strings containing the names of tables on Party. For example, the contents of table_name1 might be "Table 126640". I now want to open these four tables. The problem is that it'll open the first, immediately go back to the lobby, open the second, go back, etc. This then quite often leaves it only opening one or two of the tables. If I have no lag and if my PC is doing nothing else, it's fine. How do I get AHK to not go to the next step in the loop until the table is open? I have close to zero experience with AHK. <font class="small">Code:</font><hr /><pre> array_count = 0 ; Reset array to zero (it starts at 1) Loop, 4 ; Do all of this four times { array_count++ ControlFocus, SysListView321, ahk_id%lobby_id% ControlGet, focused, List, Count Focused, SysListView321, ahk_id%lobby_id% ControlGet, table_count, List, Count, SysListView321, ahk_id%lobby_id% Loop, %focused% ; Go to top of the table list ControlSend, SysListView321, {UP}, ahk_id%lobby_id% Loop, %table_count% ; Go down list, search for table, if you find it, open it { ControlGet, name, List, Focused Col1, SysListView321, ahk_id%lobby_id% test := name = table_name%array_count% if test = 1 ControlSend, SysListView321, {Enter}, ahk_id%lobby_id% if test = 0 ControlSend, SysListView321, {DOWN}, ahk_id%lobby_id% } }</pre><hr /> |
#2
|
|||
|
|||
Re: AHK Problem/Opening Tables
I tried using Sleep, but it didn't work for some reason and it's not exactly the most elegent of solutions (though as you can tell, I am not a master of elegance anyway)
|
#3
|
|||
|
|||
Re: AHK Problem/Opening Tables
Just send the table name instead:
SendRaw %table_name% or something. Then check if you got there and open it. |
#4
|
|||
|
|||
Re: AHK Problem/Opening Tables
[ QUOTE ]
Just send the table name instead: SendRaw %table_name% or something. Then check if you got there and open it. [/ QUOTE ] Thanks, I didn't even know that command existed :] |
#5
|
|||
|
|||
Re: AHK Problem/Opening Tables
[ QUOTE ]
Just send the table name instead: SendRaw %table_name% or something. Then check if you got there and open it. [/ QUOTE ] Is there a way to see which table I just opened? I know how to check to see if the table I want open is open yet, but the probelm is that if %table_name1% isn't on the list anymore (which is possible), it'll open the wrong table when I send {Enter} |
#6
|
|||
|
|||
Re: AHK Problem/Opening Tables
ControlGet, var, list, focused (or selected or something)
|
#7
|
|||
|
|||
Re: AHK Problem/Opening Tables
[ QUOTE ]
ControlGet, var, list, focused (or selected or something) [/ QUOTE ] Excellent, thanks. |
#8
|
|||
|
|||
Re: AHK Problem/Opening Tables
Sciolist,
What is your script aiming to do? Does SafeMine not already do what (I guess) you are attempting? Prolly worth a look through the code for that anyway - it deos plenty of dealing with the Party lobby / opening + closing tables. dave. |
#9
|
|||
|
|||
Re: AHK Problem/Opening Tables
[ QUOTE ]
Sciolist, What is your script aiming to do? Does SafeMine not already do what (I guess) you are attempting? Prolly worth a look through the code for that anyway - it deos plenty of dealing with the Party lobby / opening + closing tables. dave. [/ QUOTE ] I've been looking at the old iwitness code a bit, as you can probably tell, I'll go look for SafeMine too. |
#10
|
|||
|
|||
Re: AHK Problem/Opening Tables
OK, now I am unable to get it to put focus back in the lobby for some reason. The first table opens fine, but then the second SendRaw doesn't do anything (it doesn't send, as far as I can see, or if it does, it sends somewhere else). Am I putting focus on the lobby in the wrong way?
table_name1 to 4 have the data in correctly. <font class="small">Code:</font><hr /><pre> array_count = 0 array_count++ ; Just doing it this way for test, will be loop ControlFocus, SysListView321, ahk_id%lobby_id% SendRaw, % table_name%array_count% ControlGet, name, List, Focused Col1, SysListView321, ahk_id%lobby_id% If (name = table_name%array_count%) { ControlSend, SysListView321, {Enter}, ahk_id%lobby_id% Loop { IfWinExist, % table_name%array_count% { break } } } array_count++ ; Back to start of "loop" ControlFocus, SysListView321, ahk_id%lobby_id% SendRaw, % table_name%array_count% ; Nothing happens? </pre><hr /> |
|
|