Jump to content

Help me get item values in listbox


danghoan83
 Share

Recommended Posts

I have a Window Info (of an application installed on the windows operating system) as follows:
Title Dialog
Class ListBox
Instance 1
ClassnameNN ListBox1
ID 1660
............
You help me get all the item prices in the msgbox output (each item per line).
Thank you very much

P/S: I am Vietnamese and my English is not good. I have Google translator. I'm sorry.

Link to comment
Share on other sites

Since you have no code at all, maybe this can give you a push. Keep in mind it's not specific for your issue.

You have to change the class of window for whatever it is right now, and the SysListView321 to the value you get from the info tool.

$hWnd = WinGetHandle("[CLASS:WINDOWTHATHASTHELISTBOX]", "")
$iCount = ControlListView($hWnd, "", "SysListView321", "GetItemCount")
    For $k = 0 To $iCount - 1
        $sText1 = ControlListView($hWnd, "", "SysListView321", "GetText", $k, 0)
        ConsoleWrite('Line - ' & $k & ' - ' & $sText1 & @CRLF)
    Next

 

Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

16 hours ago, careca said:

Vì bạn không có mã nào, có lẽ điều này có thể giúp bạn đẩy nhanh. Lưu ý rằng vấn đề của bạn không cụ thể.

Bạn phải thay đổi lớp cửa sổ cho bất cứ điều gì ngay bây giờ, và SysListView321 với giá trị bạn nhận được từ công cụ thông tin.

$ hWnd  =  WinGetHandle ( "[CLASS: WINDOWTHATHASTHELISTBOX]" ,  "" ) 
$ iCount  =  ControlListView ( $ hWnd ,  "" ,  "SysListView321" ,  "GetItemCount" ) 
    Đối với  $ k  =  0  Để  $ iCount  -  1 
        $ sText1  =  ControlListView ( $ hWnd ,  "" ,  "SysListView321" ,  "GetText" ,  $ k ,  0 ) 
        ConsoleWrite ( 'Dòng - '  & $ k  &  '-'  &  $ sText1  &  @CRLF ) 
    Tiếp theo

 

I so sorry.
Here is the details of the window. 

Can you help you move items into the array instead of ConsoleWrite?
ConsoleWrite does not show anything. (Sorry, I know a little bit about autoit)

2.png

Edited by danghoan83
Link to comment
Share on other sites

Of course it doesn't. What did you change to the code, in order to make it show the values? I would focus on getting it to show the values, and then worry about the array.

$hWnd = WinGetHandle("[CLASS:#32770]", "")
$iCount = ControlListView($hWnd, "", "ListBox", "GetItemCount")
    For $k = 0 To $iCount - 1
        $sText1 = ControlListView($hWnd, "", "ListBox", "GetText", $k, 0)
        ConsoleWrite('Line - ' & $k & ' - ' & $sText1 & @CRLF)
    Next

 

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

17 hours ago, careca said:

Of course it doesn't. What did you change to the code, in order to make it show the values? I would focus on getting it to show the values, and then worry about the array.

$hWnd = WinGetHandle("[CLASS:#32770]", "")
$iCount = ControlListView($hWnd, "", "ListBox", "GetItemCount")
    For $k = 0 To $iCount - 1
        $sText1 = ControlListView($hWnd, "", "ListBox", "GetText", $k, 0)
        ConsoleWrite('Line - ' & $k & ' - ' & $sText1 & @CRLF)
    Next

 

I tried but did not see the items.
I exported $ iCount but ICount = 0. Can you help me?

item.png

 

Edited by danghoan83
Link to comment
Share on other sites

I think there is a little confusion here.  Firstly, a ListBox and a ListView are not the same thing.  i wouldn't (necessary) expect the ListView functions to work properly with a ListBox.  i think careca mistakenly made a bad recommendation to use the ControlListView function.

Look in your help file for the _GUICtrlListBox_* functions (_GetSelItems* might be of particular interest to you).  There are some good examples in there too.  Have a look and let us know where you get stuck.

Edited by spudw2k
Link to comment
Share on other sites

3 hours ago, spudw2k said:

I think there is a little confusion here.  Firstly, a ListBox and a ListView are not the same thing.  i wouldn't (necessary) expect the ListView functions to work properly with a ListBox.  i think careca mistakenly made a bad recommendation to use the ControlListView function.

Look in your help file for the _GUICtrlListBox_* functions (_GetSelItems* might be of particular interest to you).  There are some good examples in there too.  Have a look and let us know where you get stuck.

Thank you very much.
But I do not understand: $ idListBox will equal something in the Listbox.
I tried and the results were still nothing. I'm so bad.

#include <GUIConstantsEx.au3>
#include <GuiListBox.au3>
#include <MsgBoxConstants.au3>

WinWaitActive("Dialog")
$idListBox = WinGetHandle("[CLASS:#32770]","")
$iCount = _GUICtrlListBox_GetCount($idListBox)
   ConsoleWrite('iCount = '&$iCount & @CRLF)

P/S: iCount = 0

 

Link to comment
Share on other sites

Thanks to everyone, I have found a solution to my problem.
Thank you very much for careca and spudw2k.

#include <GUIConstantsEx.au3>
#include <GuiListBox.au3>
#include <MsgBoxConstants.au3>
;Dim $i
;Dim $hWindow
;Dim $hControl
;Dim $iCount
;Dim $item

WinWaitActive("Dialog")
Local $hWindow = WinGetHandle("Dialog")
Local $hControl = ControlGetHandle($hWindow, "", "[CLASS:ListBox; INSTANCE:1]")
Local $iCount = _GUICtrlListBox_GetCount($hControl)
;Dim $mang[$iCount]
Local $item
   for $i = 0 to $iCount - 1
      ConsoleWrite(_GUICtrlListBox_GetText($hControl,$i)& @CRLF)
   Next

 

Link to comment
Share on other sites

Yeah my bad on the ControlListView.

Glad you sorted that out. :)

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

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...