Hugo9773 Posted February 11, 2016 Share Posted February 11, 2016 Hello all, I'm trying to get values from two differents Listboxes. For the 1st one everything is fine, but for the 2nd it's not. My code : ;start application run($programLocation) $hWnd = WinWait("[CLASS:MyProgramMain]", "", 10) WinActivate($hWnd) Sleep(10000) ;takes time to really show up... ; work with listbox Local $hControl = ControlGetHandle($hWnd, "", "ListBox1") $itemText = ControlCommand ($hWnd,"",$hControl,"GetCurrentSelection","") MsgBox(0, "", $itemText) So, this code works fine for the "ListBox1". But for the "ListBox2", it doesn't. I'm ever able to use "SetCurrentSelection" on this "ListBox2", but when I select an item and use GetCurrentSelection, I got a blank message... Someone has any idea to help me..? I'm using Windows 10 (64 bits) and AutoIT v3.3.12.0. Thank you for your help ! Link to comment Share on other sites More sharing options...
Hugo9773 Posted February 11, 2016 Author Share Posted February 11, 2016 I forgot, but sometimes I got this message when I try to read item's value from ListBox : Link to comment Share on other sites More sharing options...
EmilyLove Posted February 11, 2016 Share Posted February 11, 2016 You can use GuiCtrlRead to read the value of the listbox. Link to comment Share on other sites More sharing options...
Hugo9773 Posted February 12, 2016 Author Share Posted February 12, 2016 Hello BetaLeaf and thank you for your quick answer. Unfortunately, I tried to use GuiCtrlRead but the result is worst. Even for my first Listbox (the one who works with GetCurrentSelection) shows me a "0" (and I had a selected item). My listboxes are inside a program, I'm looking to automatize some processes with this program. I understand that GuiCtrlRead was used with controls returned by GuiCtrilCreate..() and that's not my case, since I'm trying to automatize processes with an external software. Link to comment Share on other sites More sharing options...
Hugo9773 Posted February 12, 2016 Author Share Posted February 12, 2016 Sorry, my mistake ! I tried again and the result is better, but exactly the same as GetCurrentSelection... My result 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