Jump to content

Collecting data from rid


Mitya
 Share

Recommended Posts

23 hours ago, FrancescoDiMuro said:

You can try some other Control* functions, since you got the handle of the control, but if there are no "native" functions which will solve your problem, then, as already suggested above by @seadoggie01, you should go for UI Automation :)

Dear Francesco,

Finally I got some time today, so I started with the Control* functions as you recommended. It seems to be working so far. Please find attached my script.

So far this is good, I could live with it, but would be nice to be able to press the right mouse and then the first item on the context menu.

#include <GuiListView.au3>
#include <MsgBoxConstants.au3>

#include <WindowsConstants.au3>
#include "SendMessage.au3"
#Include <GuiMenu.au3>
#include <String.au3>

Global $hdlListView, _
       $intListViewItemsCount = 0


$hdlListView = ControlGetHandle("[REGEXPTITLE:(?i)Race Analyzer \-.*\.vcr]", "", "[CLASS:WindowsForms10.Window.8.app.0.225e691_r9_ad1; INSTANCE:23]")
If IsHWnd($hdlListView) Then

    WinWait ("[WindowsForms10.Window.8.app.0.225e691_r9_ad1]")

    If WinExists("[CLASS:WindowsForms10.Window.8.app.0.225e691_r9_ad1]") Then
        $hnd = WinGetHandle("[CLASS:WindowsForms10.Window.8.app.0.225e691_r9_ad1]")

        if @error Then
            ConsoleWrite("ERR: " & @error & @CRLF)
        EndIf

        $name = InputBox("Driver name", "Driver name")

        ControlFocus($hnd, "", "[NAME:tableEvents]")
        ControlSend($hnd, "", "[NAME:tableEvents]", _StringRepeat("{PGDN}", 150))
        ControlSend($hnd, "", "[NAME:tableEvents]","^c")
        $last = ClipGet()
        ControlSend($hnd, "", "[NAME:tableEvents]", _StringRepeat("{PGUP}", 151))

        while(1)

            ControlSend($hnd, "", "[NAME:tableEvents]","^c")
            $cur = ClipGet()

            if (StringInStr($cur, $name) > 0) Then
                sleep(3000)
            EndIf

            if (StringCompare($cur, $last) == 0) Then
                exit
            EndIf

            ControlSend($hnd, "", "[NAME:tableEvents]","{DOWN}")

        WEnd


    Else
        MsgBox(0, '', "Error: " & @error & @CRLF)
    EndIf
Else
    MsgBox(0, '', "Error2: " & @error & @CRLF)
EndIf

 

Any comments are welcome.

Thanks,

Mitya

 

 

Edited by Mitya
insert the script rather than attach it
Link to comment
Share on other sites

@Mitya
Happy to have helped a bit, then!

One suggestion is to use variables for the Window Class, Control Name (tableEvents), so if for some reason it would change somehow, you have to change it just in one place (where you assign the variable its value).
 For the part about clicking on the Menu Item from your application, then take a look at this post :)

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

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