Posts: 1,031
Threads: 246
Joined: Jul 2022
03-04-2024, 09:24 PM
(This post was last modified: 03-04-2024, 10:35 PM by Davider.)
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
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
Posts: 1,031
Threads: 246
Joined: Jul 2022
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
Posts: 12,071
Threads: 140
Joined: Dec 2002
// 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);
Posts: 1,031
Threads: 246
Joined: Jul 2022
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
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);
}
Posts: 12,071
Threads: 140
Joined: Dec 2002
Your code finds all "Today", not all children of "Today". The tool does not generate code you need.
Example
// 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);
}
Posts: 1,031
Threads: 246
Joined: Jul 2022
Thanks for your help.
LA provides a unique way of element positioning, and the code is very elegant