Jump to content

Getting selected item from a listbox (see image)


Rorax
 Share

Recommended Posts

Hello,

What I'm trying to do is get the selected item from the listbox (see image)

alternative picture host: clicky

Posted Image

I've tried to use different types of currenttab and getcurrentselection but it doesnt seem to work. Is there any way to select/get information of a selection in that listbox?

Basically I want to make a automated script to scan for me using those two options. I got one working using the wizard XP have built in but need to make one that dont use that also. But kind of stuck at the beginning.

Tried to use commands like:

ControlCommand("Hp Smart Document Scan Software", "", "SysListView321", "CurrentTab", "")
ControlCommand("Hp Smart Document Scan Software", "", "SysListView321", "GetCurrentSelection", "")
[/code)

And then using a msgbox to display the result, but always get the result to either blank or 0. Any help would be appreciated!

Regards,
Rorax


            
                


    Edited  by Rorax
    
    

            
        

        

        
    

    

    




    Link to comment
    
        
    
    
    

    
    Share on other sites
    

    
        
            

    

        
            

    

        
            

    

        
            

    

        
    


    
    More sharing options...

    


    

                    
                    
                    
                

                    

                    
                    





    

    

    
        
            
                


    
        
    

                
                
                    
                        

                    
                
            
        
        
            
                


mcgill
            
            
                Posted 
                
            
        
    
    
        


mcgill
            
        
        
            
                
                    


    
        
    

                    
                    
                        

                    
                
            
            
                Active Members
                
            
            
                
                    
                        
                            
                                
                            
                                 54
                            
                                
                            
                        
                        
                    
                
            
            
                

            
        
    
    
        



    
        
            
                
                    
                    
                    
                    
                    
                
            
            
                
                    
                    
                        
                        
                            Share
                        
                        
                        
                        
                        
                            
                                
                            
                            
                            
                            
                            
                            
                        
                    
                
                
            
        

        
            Posted 
            
            
                
                
            
        
    

    

    

    
        
        
            Here is an example of getting the selected item from a listbox.  I hope this is what you are looking for.  

#include <GUIConstants.au3>

GLOBAL $MESSAGE = "The following buttons have been clicked"
GUICreate("My GUI list",280, 100) ; will create a dialog box that when displayed is centered

$Add=GUICtrlCreateButton ("Add", 0,0,75,25)
$Clear=GUICtrlCreateButton ("Clear", 0,25,75,25)
$MyList=GUICtrlCreateList ("buttons that have been clicked",75,0,205,110)
GUICtrlSetLimit(-1,200) ; to limit horizontal scrolling
GUICtrlSetData(-1,$MESSAGE)
$DisplayText = GUICtrlCreateButton ("Display", 0,50,75,25)
$Close=GUICtrlCreateButton ("Close", 0,75,75,25)

GUISetState ()

$msg = 0

While $msg <> $GUI_EVENT_CLOSE
$msg = GUIGetMsg()

Select
    Case $msg = $Add
            GUICtrlSetData($mylist,"You clicked button No1|")
    Case $msg = $Clear
            GUICtrlSetData($mylist,"")
    Case $msg = $DisplayText
            msgbox(4096,"TEST", GUICTRLRead($mylist))
                Case $msg = $Close
            MsgBox(0,"", "the closing button has been clicked",2)
            Exit
EndSelect
Wend


            
        

        

        
    

    

    




    Link to comment
    
        
    
    
    

    
    Share on other sites
    

    
        
            

    

        
            

    

        
            

    

        
            

    

        
    


    
    More sharing options...

    


    

                    
                    
                    
                

                    

                    
                    





    

    

    
        
            
                


    
        
    

                
                
                    
                        

                    
                
            
        
        
            
                


Rorax
            
            
                Posted 
                
            
        
    
    
        


Rorax
            
        
        
            
                
                    


    
        
    

                    
                    
                        

                    
                
            
            
                Active Members
                
            
            
                
                    
                        
                            
                                
                            
                                 41
                            
                                
                            
                        
                        
                    
                
            
            
                

            
        
    
    
        



    
        
            
                
                    
                        Author
                    
                    
                    
                    
                    
                
            
            
                
                    
                    
                        
                        
                            Share
                        
                        
                        
                        
                        
                            
                                
                            
                            
                            
                            
                            
                            
                        
                    
                
                
            
        

        
            Posted 
            
            
                
                
            
        
    

    

    

    
        
        
            Sort of, but that code makes a GUI itself and set events for what to happen when you click a button. I need to read the info in a listbox thats already made from another program (named SysListView321)


            
        

        

        
    

    

    




    Link to comment
    
        
    
    
    

    
    Share on other sites
    

    
        
            

    

        
            

    

        
            

    

        
            

    

        
    


    
    More sharing options...

    


    

                    
                    
                    
                

                    

                    
                    





    

    

    
        
            
                


    
        
    

                
                
                    
                        

                    
                
            
        
        
            
                


Rorax
            
            
                Posted 
                
            
        
    
    
        


Rorax
            
        
        
            
                
                    


    
        
    

                    
                    
                        

                    
                
            
            
                Active Members
                
            
            
                
                    
                        
                            
                                
                            
                                 41
                            
                                
                            
                        
                        
                    
                
            
            
                

            
        
    
    
        



    
        
            
                
                    
                        Author
                    
                    
                    
                    
                    
                
            
            
                
                    
                    
                        
                        
                            Share
                        
                        
                        
                        
                        
                            
                                
                            
                            
                            
                            
                            
                            
                        
                    
                
                
            
        

        
            Posted 
            
            
                
                    (edited)
                
                
            
        
    

    

    

    
        
        
            I've tried the latest beta now to just get anything from the listbox:
$ID is either 1003 or "SysListView321", tried using both (and I know $ID isnt declared in the code here but I have it of course declared in the code I'm trying)

#Include <GuiListView.au3>
WinActivate("HP Smart Document Scan Software")
WinWaitActive("HP Smart Document Scan Software")
$Selected = _GUICtrlListViewGetItemCount($ID)
msgbox(4096, "Listbox", $Selected)

Selected is displayed as: 0

#Include <GuiListView.au3>
WinActivate("HP Smart Document Scan Software")
WinWaitActive("HP Smart Document Scan Software")
$Selected = _GUICtrlListViewGetCurSel($ID)
msgbox(4096, "Title", $Selected)

Selected is displayed as: 0

----------------------------------------------------------------

I'm probably using this wrong, but I'm kind of new to autoit so hoping someone with more experience them me can shed som light on this.

Edited by Rorax
Link to comment
Share on other sites

Have you tried

#Include <GuiListView.au3>

_GUICtrlListViewGetSelectedIndices($h_listview[, $i_ReturnType=0]))

i dont know if it works though. I remember having a problem with getting info from a similair control classname:SysListView321

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