Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting and Inserting ControlID as a string
#1
Hello All,
I am trying to get the text from a specific window element but the control id is variable and that seems to be the most reliable way of getting at that window (once I manually set the control id).
I tried to use a quick GetWinID to find it out and then insert the resultant value into the control id location of my getwintext line but it doesn't seem to be working. Could this just be a syntax error for how to insert a str function into that getwintext function? The variable number (in this case 5309158) should probably be wildcarded since that is the variable part!) but I don't know how to do this.
The example is below:

int controlid=GetWinId(child(5309158 "" "WindowsForms10.STATIC.app.0.378734a" win("Commissure RadWhere" "WindowsForms10.Window.8.app.0.378734a") 0x1))

mrn.getwintext(id(controlid win("Commissure RadWhere" "WindowsForms10.Window.8.app.0.378734a")))

Thanks so much!!!!!!
Stuart
#2
I think you don't need id. Function child() returns control handle. Function id() too. Use the handle with getwintext.

int h=child(...)

mrn.getwintext(h)
#3
I am having a terrible time with this...

I am trying to get the text of a field that has a child id. Unfortunately that child id is variable from login to login to this app

act child(2950816 "0855180" "WindowsForms10.STATIC.app.0.378734a" win("Commissure RadWhere" "WindowsForms10.Window.8.app.0.378734a") 0x1 961 215)




Sometimes it is 2950816, sometimes other numbers,

However if I take that child id out of the statement, QM can sometimes not find the window or gets the information from the previous window. It seems I HAVE to know that ID to get the text of this window.
I could identify it by xy coordinates but they change from time to time depending on the way the screen is set up.

I tried using child() function, but this seems to require the child id....

I also tried getting at it through Accessible element instead of window:

act child(2950816 "" "WindowsForms10.STATIC.app.0.378734a" win("Commissure RadWhere" "WindowsForms10.Window.8.app.0.378734a") 0x1 961 215)

But this also seems to need the child id.

Any ideas on what I may be doing wrong?

Stuart
#4
It is difficult to find correct child window if all its attributes - id, class, text, coordinates - are variable or not unique. You also can try to find another accessible object near to it and navigate to it using the Navigate field. For example, it may be a static text at left, or parent or ancestor.
#5
Hi Gintaras,
A friend using AutoHotkey has been able to get at this window reliably through the TextClass part of its identifiers (which in this case are specific and stable).

They are stable but not specific in the QM readout.
Example:

QM generates this statement:
str mrn.getwintext(child("" "WindowsForms10.STATIC.app.0.378734a" win("Commissure RadWhere" "WindowsForms10.Window.8.app.0.378734a") 0x5))

His program generates

"WindowsForms10.STATIC.app.0.378734a3" for 1 child window and
"WindowsForms10.STATIC.app.0.378734a31" for the next, etc

This way, its stable AND specific

QM is reading out:
"WindowsForms10.STATIC.app.0.378734a" everytime without the very last numbers.

Any idea why this maybe the case. I love scripting in QM and figure this is probably an easy issue to resolve.

Thanks,
Stuart
#6
The class is "WindowsForms10.STATIC.app.0.378734a", but ahk adds control index in collection of controls of the same class. QM child() and id() functions currently don't support it. Use acc() with navigation.
#7
Thanks for the response. Navigation doesn't seem to work though I am not sure why.
I put in next or down, etc, and then when I test it, it replies that it can't find that window....

Will try again. Any advice on using navigation...

Sometimes I notice that "test" fails but then when I run the macro for real, it works....

Stuart


Forum Jump:


Users browsing this thread: 1 Guest(s)