Jump to content
Sign in to follow this  
Rammanan

_GUICtrlListBox_FindString

Recommended Posts

Local $ttlWindow = "DSD Window UserInterface (Ver 1.16.1) - ntmmm"
Local $cidList = "[CLASS:ListBox; INSTANCE:1]"
Local $hsfserver = "LSD_6_INCH
$hdlWindow = WinGetHandle($ttlWindow)
$hListBox = ControlGetHandle($hdlWindow, "",$cidList)
$iI = _GUICtrlListBox_FindString($hListBox,$hsfserver)
 _GUICtrlListBox_SetCurSel($hListBox, $iI)
    MsgBox($MB_SYSTEMMODAL, "Test", "Item: " & $iI)
     MsgBox($MB_SYSTEMMODAL, "Test", "Select: " & _GUICtrlListBox_GetCurSel($hListBox))

Hi All,

Here i have attach my listbox and code. This code totally not work for this listbox.

Please help to solve.

Thanks

 

ScreenHunter_02 Oct. 23 14.19.gif

Edited by Rammanan

Share this post


Link to post
Share on other sites

Hi @Rammanan.
Did you check that every function you call does return the correct information?


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites

Im not sure you can use that function to read external/listboxes not created by you...but maybe you can, some expert chime in pls.

One thing you could try is ControlListView, read the list sequentially an get the text.

´PS or ControlCommand

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

Share this post


Link to post
Share on other sites
28 minutes ago, careca said:

Im not sure you can use that function to read external/listboxes not created by you

Of course you can, that's exactly its purpose.

29 minutes ago, careca said:

One thing you could try is ControlListView

Don't try this, you have a listbox, this is only for a Listview they are not the same type of control.

 

BTW, can you show the output from the Summary page of the Au3Info tool so that we can see what the tool can identify?

From the image you posted, that looks like a Listview, and not a list box, but your control ID says listbox, so I'm guessing you got that from somewhere.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Hi @BrewManNH,

Below are the autoit window info

 

>>>> Window <<<<
Title:    DSD Window UserInterface (Ver 1.16.1) - ntmmm
Class:    Afx:400000:b:10011:6:10181
Position:    0, 0
Size:    1024, 768
Style:    0x144BC000
ExStyle:    0x00000100
Handle:    0x00390112

>>>> Control <<<<
Class:    ListBox
Instance:    1
ClassnameNN:    ListBox1
Name:    
Advanced (Class):    [CLASS:ListBox; INSTANCE:1]
ID:    7200
Text:    
Position:    14, 144
Size:    892, 544
ControlClick Coords:    198, 16
Style:    0x50810191
ExStyle:    0x00000204
Handle:    0x000301A8

>>>> Mouse <<<<
Position:    215, 163
Cursor ID:    0
Color:    0xFFFFFF

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
FBAR_6_INCH
ENGINEERING_REWORK_FBAR  
2018/10/25 10:47:59
DISABLE

 

Share this post


Link to post
Share on other sites

One thing you can try is to see if any of the commands you're using before the _GUICtrlListBox_FindString returns the correct information, such as the control's handle being correct, or the GUI handle. Put in some ConsoleWrites like this for example.

Local $ttlWindow = "DSD Window UserInterface (Ver 1.16.1) - ntmmm"
Local $cidList = "[CLASS:ListBox; INSTANCE:1]"
Local $hsfserver = "LSD_6_INCH"
$hdlWindow = WinGetHandle($ttlWindow)
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hdlWindow = ' & $hdlWindow & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
$hListBox = ControlGetHandle($hdlWindow, "", $cidList)
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hListBox = ' & $hListBox & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
$iI = _GUICtrlListBox_FindString($hListBox, $hsfserver)
_GUICtrlListBox_SetCurSel($hListBox, $iI)
MsgBox($MB_SYSTEMMODAL, "Test", "Item: " & $iI)
MsgBox($MB_SYSTEMMODAL, "Test", "Select: " & _GUICtrlListBox_GetCurSel($hListBox))

 


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Hi @BrewManNH

Fyi i can select follow by row but the problem is i cannot select with string that i have. exp"LCD_6_INCH".

With try console write i get below:-

 >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\New AutoIt v3 Script (3).au3"    
@@ Debug(25) : $hdlWindow = 0x00390112
>Error code: 0
@@ Debug(27) : $hListBox = 0x0007019A
>Error code: 0

>Process failed to respond; forcing abrupt termination...>Exit code: 0    Time: 7.094

Share this post


Link to post
Share on other sites
On 25/10/2018 at 5:29 AM, Rammanan said:

Fyi i can select follow by row but the problem is i cannot select with string that i have. exp"LCD_6_INCH".

So you can intract with the control with the other _GUICtrl_ListBox* functions, but you are not able to find the string you're looking for with _GUICtrl_ListBoxFindString() ? :)


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites

@Rammanan
Can I suggest you to use _GUICtrlListBox_FindInText() function instead of _GUICtrlListBox_FindString() ?
Try it and let us know ( post the code then ) :)


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites

Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites

@Rammanan
Did you included GuiListView.au3 in your script? :)

#include <GuiListView.au3>

 


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites

@FrancescoDiMuro

same result. I think function GuiListView or GuiListbox cannot use for this format listbox.

Because its look like listview but autoit info show listbox. We need use different way to select.

Any idea other way that can choose?

 

Share this post


Link to post
Share on other sites

@Rammanan
You could try ControlListView() either :)
But post your code...

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites

@FrancescoDiMuro

Still get  -1.:sweating:

Local $ttlWindow = "DSD Window UserInterface (Ver 1.16.1) - ntmmm"
Local $cidList = "[CLASS:ListBox; INSTANCE:1]"
Local $hsfserver = "LSD_6_INCH"

WinActivate("DSD Window UserInterface (Ver 1.16.1) - ntmmm")
WinWaitActive("DSD Window UserInterface (Ver 1.16.1) - ntmmm")
$hdlWindow = WinGetHandle($ttlWindow)
Local $control_hd = ControlGetHandle($hdlWindow, "", "[CLASS:ListBox; INSTANCE:1]")
$iSelect = ControlListView($hdlWindow, "", $control_hd, "FindItem", "LSD_6_INCH")
MsgBox(32,'',$iSelect)

 

Share this post


Link to post
Share on other sites
#include <Array.au3>
#include <File.au3>
#include <GUIConstantsEx.au3>
#include <GuiListBox.au3>


Local $ttlWindow = "DSD Window UserInterface (Ver 1.16.1) - ntmmm"
Local $cidList = "[CLASS:ListBox; INSTANCE:1]"
Local $hsfserver = "LSD_6_INCH"

WinActivate("DSD Window UserInterface (Ver 1.16.1) - ntmmm")

WinMove ( $ttlWindow , "" , 0, 0 )

This is working or not ?


My video tutorials : HERE ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...