Descolada / Acc-v2

Acc library for AHK v2
MIT License
40 stars 6 forks source link

Outline Object not expandabkle? #2

Closed lublak closed 1 year ago

lublak commented 1 year ago

Hi i found you Acc and UIA scripts :) they are awesome! Now i have an OutlineObject (in UAI its called Type:"TreeItem") But if i try to call Expand or get the Expand sate it alweys says that there is not method for this object. But for me its importend to expand them (i can call just DoDefaultAction but here its impossible to check the current state, and it would be and issue if the item gets collapsed not expanded)

Descolada commented 1 year ago

Hello! Are you using Acc or UIA? They are very different: 1) In Acc there is no Expand() method. Instead only DoDefaultAction(), and sometimes you can get the expand/collapse state with Element.State 2) In UIA the ExpandCollapsePattern has the Expand() and Collapse() methods, which you should be able to call with Element.Expand() (make sure you have an uptodate UIA.ahk, I've updated it a LOT recently). It also has the ExpandCollapseState to get the current state.

lublak commented 1 year ago

@Descolada I used mostly UIA. I switched to aac because i have no idea what im doing. I found this example and tried it:https://github.com/Descolada/UIA-v2/blob/main/Examples/Example10_ExpandCollapsePattern.ahk grafik

Now i try to switch to aac and hope it works here? Because its older and more supported by microsoft for old guis?

And okay to UIA its easier for me to use i think? Currenlty for me its not importend. AAC or UIA both is fine.

And im up to date. I downloaded it just now!

lublak commented 1 year ago

Ah! Okay now i get it :3 acc works fine. UAI is not working because method ExpandCollapseState is not found.

acc:

ep := bdeadminEl.FindElement({Name: "Konfiguration", Role: 36}).State

MsgBox(ep & Acc.State.Expanded == Acc.State.Expanded) // returns 1! nice!
MsgBox(ep & Acc.State.Collapsed == Acc.State.Collapsed)

so i change my code from uai to acc

lublak commented 1 year ago

@Descolada i think we can move this issue to UIA than :)