Jump to content

Issue when getting items from ListBox


Hugo9773
 Share

Recommended Posts

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

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...