Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
get name of the currently open tab
#1
I need to get the name of the currently open tab in the Linqpad window (indicated by the pink arrow in the image),
The text obtained after executing the LA code (indicated by the red arrow below),
The text obtained after executing the QM code (indicated by the green arrow below).
Which tag should be added to solve this problem?

Code:
Copy      Help
// script "LA_getTab.cs"
//.
script.setup(trayIcon: true, sleepExit: true);
//..

var w = wnd.find(1, "LINQPad 8 [admin]", "*.Window.*").Activate();
var e = w.Elm["PAGETABLIST", prop: "class=HwndWrapper[DefaultDomain;*"]["PAGETAB", "LINQPad.UI.HybridTab.Internal.SlaveTabItem*", "state=SELECTED, FOCUSABLE, SELECTABLE", navig: "fi"].Find(3);
print.it(e.Name);


Macro QM_getTab
Trigger Aa     Help - how to add the trigger to the macro
Code:
Copy      Help
out 
int w=win("LINQPad 8 [admin]" "*.Window.*")
Acc a.Find(w "PAGETABLIST" "" "class=HwndWrapper[DefaultDomain;;*]" 0x1004 3)
ARRAY(Acc) ac
a.GetChildObjects(ac)
for _i 0 ac.len
,Acc& r=ac[_i]
,out r.Role; out r.State
,if r.Role=37 and r.State=0x300002
,,Acc a2.Find(r.Hwnd "STATICTEXT")
,,mes a2.Name


Attached Files Image(s)
   
#2
Are you posting questions day and night?? I see your question are everywhere in the forum and in Various way.
#3
Skip 1 PAGETABLIST.

Code:
Copy      Help
var w = wnd.find(1, "LINQPad 8*", "*.Window.*");
var e = w.Elm["PAGETABLIST", prop: "class=HwndWrapper[DefaultDomain;*", skip: 1]["PAGETAB", prop: "state=SELECTED", navig: "fi"].Find(1);
print.it(e.Name);
#4
@birdywen
I have been using QM for quite some time now and am currently trying to replace the tasks previously done with QM with LA. In many aspects, it feels very good.
Most of the issues are related to the interaction between programming languages (PowerShell, Python, QM, LA).

@Gintaras Thanks for your help.
Was the code for #3 Auto generated using the functionality in the Ctrl+Shift+E dialog?
#5
Yes. I captured the PAGETAB, then added it to path, then selected its parent PAGETABLIST, set skip 1, added to path. Finally removed unnecessary properties.
#6
Thank you again.

Using LA's unique path-based approach, once mastered, does indeed prove to be more convenient than RPA software.

By the way, does QM have a "skip" parameter? I tried the method below, but it didn't work.

Acc a.Find(w "PAGETABLIST" "" "class=HwndWrapper[DefaultDomain;;*]" 0x1004 3 0 "Next") ;;or "Down"
#7
In QM its name is matchIndex.
#8
Quote:Yes. I captured the PAGETAB, then added it to path, then selected its parent PAGETABLIST, set skip 1, added to path. Finally removed unnecessary properties.

After several attempts, I found an issue:
the generated code lacks the (prop:) tag. I have to add it manually; otherwise, the element cannot be correctly located.
Please see the demonstration in the below.
https://i.ibb.co/6sbcp51/A.gif

If possible, it is recommended to consistently add the "prop:" tag.
#9
I frequently conduct extensive tests to confirm that the 'state' attribute in the QM code below does not take effect and can only iterate through each sub-object.

This works in LA and the code is simple and easy to understand

ARRAY(Acc) c; a.GetChildObjects(c -1 "PAGETAB" "" "class=HwndWrapper[DefaultDomain;;*][]state=0x300002 0")
#10
#10. I usually just uncheck name in the Find UI element tool. But if want to delete the name argument later in code, it's easy to replace it with `null` or add `prop:`.

#11. To easily create correct state code, click the state text field in the "Find" tool. A small button will appear at its right side...
#11
Quote:#10. I usually just uncheck name in the Find UI element tool. But if want to delete the name argument later in code, it's easy to replace it with `null` or add `prop:`.
Very useful.
 
Quote:#11. To easily create correct state code, click the state text field in the "Find" tool. A small button will appear at its right side...

I've tried it, but it didn't work.

Macro get_Tab
Code:
Copy      Help
out
int w=win("LINQPad" "*.Window.*")
Acc a.Find(w "PAGETABLIST" "" "class=HwndWrapper[DefaultDomain;;*]" 0x1004 3 2)
ARRAY(Acc) c; a.GetChildObjects(c -1 "PAGETAB" "" "class=HwndWrapper[DefaultDomain;;*][]state=0x300002 0x0")
c[0].State(_s); out _s
out c[0].Name
#12
If the tool generates code where the second state number is 0 (eg `state=0x300002 0x0`), it means you did not check anything in the Use column in the State dialog.
#13
You're right. The problem has been solved! Thank you very much!
ARRAY(Acc) c; a.GetChildObjects(c -1 "PAGETAB" "" "class=HwndWrapper[DefaultDomain;;*][]state=0x2 0x2")


Forum Jump:


Users browsing this thread: 1 Guest(s)