chssoccer Posted December 24, 2007 Share Posted December 24, 2007 (edited) For $a = 0 To _GUICtrlListCount($ListBox) - 1 ;MsgBox(0,0,ControlGetHandle ( "Find Player", "", "ListBox1" )) GUICtrlCreateListViewItem(_GUICtrlListGetText($ListBox, $a), $sListview) Next The code above somehow is returning double of every listbox item it returns, so if there are 2 list items it will return 4. Whats the problem? Edited December 24, 2007 by chssoccer Link to comment Share on other sites More sharing options...
chssoccer Posted December 24, 2007 Author Share Posted December 24, 2007 ? Link to comment Share on other sites More sharing options...
martin Posted December 24, 2007 Share Posted December 24, 2007 For $a = 0 To _GUICtrlListCount($ListBox) - 1 ;MsgBox(0,0,ControlGetHandle ( "Find Player", "", "ListBox1" )) GUICtrlCreateListViewItem(_GUICtrlListGetText($ListBox, $a), $sListview) NextThe code above somehow is returning double of every listbox item it returns, so if there are 2 list items it will return 4. Whats the problem?I don't quite get your question.You have a list box with say n items, then you say for $a = 0 to n - 1 create a new item equal to item $a. Then are you ask why you have doubled the items? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
chssoccer Posted December 24, 2007 Author Share Posted December 24, 2007 Ok, it is returning properly, just too many items. For example, if there are items abc and def in the listbox, it will copy those items plus one more of each into my listview so it will appear like this in my listview: abc abc def def when its supposed to appear as abc def Link to comment Share on other sites More sharing options...
chssoccer Posted December 24, 2007 Author Share Posted December 24, 2007 It'll be easier to solve this problem with my full code: WinClose("Find Player", "") If WinExists("Full Tilt Poker - Logged In As", "" ) Then WinActivate("Full Tilt Poker - Logged In As", "") $buddiesSearch = StringSplit($var, ",") Send("{CTRLDOWN}{f}"); Opens Find Player window Send("{CTRLUP}") WinWait("Find Player", ""); Waits for it to open ControlSetText("Find Player", "", "Edit1", "") If IsArray($buddiesSearch) Then For $i = 1 To $buddiesSearch[0] ControlSend("Find Player", "", $Edit, $buddiesSearch[$i] & "{Enter}"); Searches for each individual player $ListBox = ControlGetHandle ( "Find Player", "", "ListBox1" ) For $a = 0 To _GUICtrlListCount($ListBox) - 1 ;MsgBox(0,0,ControlGetHandle ( "Find Player", "", "ListBox1" )) GUICtrlCreateListViewItem(_GUICtrlListGetText($ListBox, $a), $sListview) Next Next EndIf Else MsgBox(16, "Error", "Full Tilt isn't running!") EndIf Link to comment Share on other sites More sharing options...
martin Posted December 24, 2007 Share Posted December 24, 2007 It'll be easier to solve this problem with my full code: WinClose("Find Player", "") If WinExists("Full Tilt Poker - Logged In As", "" ) Then WinActivate("Full Tilt Poker - Logged In As", "") $buddiesSearch = StringSplit($var, ",") Send("{CTRLDOWN}{f}"); Opens Find Player window Send("{CTRLUP}") WinWait("Find Player", ""); Waits for it to open ControlSetText("Find Player", "", "Edit1", "") If IsArray($buddiesSearch) Then For $i = 1 To $buddiesSearch[0] ControlSend("Find Player", "", $Edit, $buddiesSearch[$i] & "{Enter}"); Searches for each individual player $ListBox = ControlGetHandle ( "Find Player", "", "ListBox1" ) For $a = 0 To _GUICtrlListCount($ListBox) - 1 ;MsgBox(0,0,ControlGetHandle ( "Find Player", "", "ListBox1" )) GUICtrlCreateListViewItem(_GUICtrlListGetText($ListBox, $a), $sListview) Next Next EndIf Else MsgBox(16, "Error", "Full Tilt isn't running!") EndIf I see that I didn't read your first post correctly. I would guess that you simply need to put a debug line or two inside the For $i = 1 to $buddiessearch because every time you go round that loop you are adding the items to the listview again. If yu only want the items added once then why put it inside a loop? Where is $var set anyway? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
chssoccer Posted December 24, 2007 Author Share Posted December 24, 2007 I see that I didn't read your first post correctly. I would guess that you simply need to put a debug line or two inside the For $i = 1 to $buddiessearch because every time you go round that loop you are adding the items to the listview again. If yu only want the items added once then why put it inside a loop? Where is $var set anyway? FYI: $var = INIRead("C:\buddies.ini", "BuddyList", "Buddies", "Unable to read INI.") So it would be like this?:WinClose("Find Player", "") If WinExists("Full Tilt Poker - Logged In As", "" ) Then WinActivate("Full Tilt Poker - Logged In As", "") $buddiesSearch = StringSplit($var, ",") Send("{CTRLDOWN}{f}"); Opens Find Player window Send("{CTRLUP}") WinWait("Find Player", ""); Waits for it to open ControlSetText("Find Player", "", "Edit1", "") If IsArray($buddiesSearch) Then For $i = 1 To $buddiesSearch[0] ControlSend("Find Player", "", $Edit, $buddiesSearch[$i] & "{Enter}"); Searches for each individual player $ListBox = ControlGetHandle ( "Find Player", "", "ListBox1" ) Next For $a = 0 To _GUICtrlListCount($ListBox) - 1 GUICtrlCreateListViewItem(_GUICtrlListGetText($ListBox, $a), $sListview) Next EndIf Else MsgBox(16, "Error", "Full Tilt isn't running!") EndIf Link to comment Share on other sites More sharing options...
chssoccer Posted December 24, 2007 Author Share Posted December 24, 2007 Yep, that works. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now