Jump to content

Reading contents of a combobox in a Delphi application


Recommended Posts

Hi there,

I have only recently discovered the wonders of AutoIt and suspect it will be one of those, "How did I ever survive without it" additions to my life!

I use a Delphi3 application call "Lexacom" which contains a ComboBox that always has 5 options in it.

I have written a script to interact with this application. My script is in the form of a toolbar that always stays ontop of other windows, and allows me to minimise the Delphi app so that I can work with info in other applications like Outlook etc.

In the Delphi application the combobox that I wish to read has Class = TComboBox and Instance = 3

The Delphi Application has the Windows title = Lexaxcom"

What I want to do is read the 5 lines of the combo box into a text file.

Why, coz the frequently change and If I don't check I can cause a howler!

I have searched the forums for an example but all of these seem to relate to reading a combobox in your own script, not an external application.

I've tried to use _GUICtrlComboGetList but I can't fathom the _GUICtrlComboGetList ( $idCombo [, $sDelimiter = "|" ] ) $idCombo or $sDelimiter bits.

Could someone plesae give me a pointer or, even better, a simple script I would be ever grateful!!

Many thanks

David

Link to comment
Share on other sites

Hi there,

I have only recently discovered the wonders of AutoIt and suspect it will be one of those, "How did I ever survive without it" additions to my life!

I use a Delphi3 application call "Lexacom" which contains a ComboBox that always has 5 options in it.

I have written a script to interact with this application. My script is in the form of a toolbar that always stays ontop of other windows, and allows me to minimise the Delphi app so that I can work with info in other applications like Outlook etc.

In the Delphi application the combobox that I wish to read has Class = TComboBox and Instance = 3

The Delphi Application has the Windows title = Lexaxcom"

What I want to do is read the 5 lines of the combo box into a text file.

Why, coz the frequently change and If I don't check I can cause a howler!

I have searched the forums for an example but all of these seem to relate to reading a combobox in your own script, not an external application.

I've tried to use _GUICtrlComboGetList but I can't fathom the _GUICtrlComboGetList ( $idCombo [, $sDelimiter = "|" ] ) $idCombo or $sDelimiter bits.

Could someone plesae give me a pointer or, even better, a simple script I would be ever grateful!!

Many thanks

David

When working with controls from external apps, you should consider working with Window and Control Handles. Have you tried doing ControlGetHandle() on it first, then passing that handle to the function for $idCombo?

$hLexaxcom = WinGetHandle("Lexaxcom", "")
If IsHWnd($hLexaxcom) Then
    $hCombo = ControlGetHandle($hLexaxcom, "", "[CLASS:TComboBox; INSTANCE:3]")
    If IsHWnd($hCombo) Then
        $sList = _GUICtrlComboGetList($hCombo)
        MsgBox(64, "Resuslts", "Combo list = " & $sList)
    Else
        MsgBox(16, "Error", "Failed to get control handle.")
    EndIf
Else
    MsgBox(16, "Error", "Failed to get window handle.")
EndIf

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Thank you for your reply.

I had a go with your suggestion and failed to make it work for me.

I managed to solve the problem by searching the registry for where the Delphi app stores the info I'm trying to read and get the desired data from there.

Thanks again.

Best regards,

David

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