Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GetChildObjects in LA
#1
I want to retrieve all the child controls contained within a certain control (the purple box in the image below). In QM, I can use the GetChildObjects function(The following code is automatically generated by QM). I couldn't find a similar command in the LA action panel(the red box in the image below).
https://i.ibb.co/GQ3XZMV/aa.png

Could you add this command Automatically generate relevant code? It's very commonly used, as shown the image below in QM. 
https://i.ibb.co/bRpN5ZX/gc.png

Now, I would like to know the LA code equivalent(GetChildObjects) to the following QM code

Macro test
Code:
Copy      Help
int w=win("Designer" "*.Window.*")
Acc _a.Find(w "CLIENT" "Data Panel" "class=*.Window.*[]wfName=gridVariablesPane" 0x1005)
ARRAY(Acc) ac
_a.GetChildObjects(ac)
for _i 0 ac.len
,Acc& r=ac[_i]
,out r.Value
#2
Could you provide a relevant code example? As shown in the image below, I'd like to retrieve the text of all entries in the chat list. Thank you!
https://i.ibb.co/stf1xrB/zzz.png
#3
Code:
Copy      Help
// script ""
var w = wnd.find(1, "LibreAutomate", "HwndWrapper[Au.Editor;*");
var e = w.Elm["CLIENT", "Find panel"].Find(1);
var all = e.Elm[null].FindAll();
print.it("-- all --");
print.it(all);
var allButtons = e.Elm["BUTTON"].FindAll();
print.it("-- allButtons --");
print.it(allButtons);
#4
Thanks for your example. The functionality I need seems to already exist, it's included in the FindAll menu item in the action menu.
The following code is generated automatically by LA, but it only retrieves the text of the last entry. What am I missing?
https://i.ibb.co/stf1xrB/zzz.png

Code:
Copy      Help
var w = wnd.find(1, "*- Google Chrome", "Chrome_WidgetWin_1").Activate();
var rows = w.Elm["web:GROUPING", "Today", navig: "ne"].FindAll();
for (int ir = 0; ir < rows.Length; ir++) {
    var a = rows[ir].Elm[prop: "level=0"].FindAll(); 
    print.it(a[2].Elm["LINK"].Find(0).Name); 
}
#5
Your code finds all "Today", not all children of "Today". The tool does not generate code you need.

Example
Code:
Copy      Help
// script ""
var w = wnd.find(1, "ChatGPT - Google Chrome", "Chrome_WidgetWin_1");
var e = w.Elm["web:GROUPING", "Previous 7 Days", navig: "ne"].Find(1);
foreach (var link in e.Elm["LINK"].FindAll()) {
    print.it(link);
}
#6
Thanks for your help.
LA provides a unique way of element positioning, and the code is very elegant


Forum Jump:


Users browsing this thread: 2 Guest(s)