Hugo9773

Issue when getting items from ListBox

5 posts in this topic

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 !

Share this post


Link to post
Share on other sites



I forgot, but sometimes I got this message when I try to read item's value from ListBox :  

Share this post


Link to post
Share on other sites

You can use GuiCtrlRead to read the value of the listbox.


False Positive Reporter - Mass email all anti virus vendors with an attachment of your program for fast and easy whitelisting.

PortableApps.com App Creation Wizard  - A simple GUI-based Wizard for creating PortableApps.

SoundBoard - Play any song or sound you want at the press of a hotkey.

My GitHub Page: https://github.com/BetaLeaf

Share this post


Link to post
Share on other sites

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.

 

Share this post


Link to post
Share on other sites

Sorry, my mistake ! I tried again and the result is better, but exactly the same as GetCurrentSelection...

My result :(
 

Capture.PNG

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now