appium-novawindows2-driver 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -201
- package/README.md +554 -554
- package/build/lib/commands/app.d.ts.map +1 -1
- package/build/lib/commands/app.js +35 -31
- package/build/lib/commands/app.js.map +1 -1
- package/build/lib/commands/extension.d.ts +1 -1
- package/build/lib/commands/extension.d.ts.map +1 -1
- package/build/lib/commands/extension.js +26 -26
- package/build/lib/commands/extension.js.map +1 -1
- package/build/lib/commands/file.js +22 -22
- package/build/lib/commands/functions.js +189 -189
- package/build/lib/commands/index.d.ts +1 -1
- package/build/lib/commands/index.d.ts.map +1 -1
- package/build/lib/commands/powershell.d.ts.map +1 -1
- package/build/lib/commands/powershell.js +164 -197
- package/build/lib/commands/powershell.js.map +1 -1
- package/build/lib/driver.d.ts +0 -1
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +7 -3
- package/build/lib/driver.js.map +1 -1
- package/build/lib/powershell/elements.js +738 -738
- package/build/lib/powershell/msaa.d.ts +10 -0
- package/build/lib/powershell/msaa.d.ts.map +1 -0
- package/build/lib/powershell/msaa.js +188 -0
- package/build/lib/powershell/msaa.js.map +1 -0
- package/build/lib/temp/MSAAHelper.dll +0 -0
- package/build/lib/winapi/uia.d.ts +163 -0
- package/build/lib/winapi/uia.d.ts.map +1 -0
- package/build/lib/winapi/uia.js +677 -0
- package/build/lib/winapi/uia.js.map +1 -0
- package/build/lib/xpath/native.d.ts +14 -0
- package/build/lib/xpath/native.d.ts.map +1 -0
- package/build/lib/xpath/native.js +329 -0
- package/build/lib/xpath/native.js.map +1 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +64 -63
|
@@ -4,253 +4,253 @@ exports.FoundAutomationElement = exports.AutomationElementGroup = exports.Automa
|
|
|
4
4
|
const core_1 = require("./core");
|
|
5
5
|
const common_1 = require("./common");
|
|
6
6
|
// TODO: Move the methods to a separate file, some of them are too complicated and are not easy to maintain
|
|
7
|
-
const FIND_ALL_ANCESTOR = (0, core_1.pwsh$ /* ps1 */) `
|
|
8
|
-
$treeWalker = [TreeWalker]::new($cacheRequest.TreeFilter)
|
|
9
|
-
$els = New-Object System.Collections.Generic.List[AutomationElement]
|
|
10
|
-
|
|
11
|
-
${0} | ForEach-Object {
|
|
12
|
-
$el = $_
|
|
13
|
-
while ($null -ne ($parent = $treeWalker.GetParent($el))) {
|
|
14
|
-
$el = $parent
|
|
15
|
-
$validEl = $el.FindFirst([TreeScope]::Element, ${1})
|
|
16
|
-
|
|
17
|
-
if ($null -ne $validEl) {
|
|
18
|
-
$els.Add($validEl)
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
Write-Output $els
|
|
7
|
+
const FIND_ALL_ANCESTOR = (0, core_1.pwsh$ /* ps1 */) `
|
|
8
|
+
$treeWalker = [TreeWalker]::new($cacheRequest.TreeFilter)
|
|
9
|
+
$els = New-Object System.Collections.Generic.List[AutomationElement]
|
|
10
|
+
|
|
11
|
+
${0} | ForEach-Object {
|
|
12
|
+
$el = $_
|
|
13
|
+
while ($null -ne ($parent = $treeWalker.GetParent($el))) {
|
|
14
|
+
$el = $parent
|
|
15
|
+
$validEl = $el.FindFirst([TreeScope]::Element, ${1})
|
|
16
|
+
|
|
17
|
+
if ($null -ne $validEl) {
|
|
18
|
+
$els.Add($validEl)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
Write-Output $els
|
|
24
24
|
`;
|
|
25
|
-
const FIND_FIRST_ANCESTOR = (0, core_1.pwsh$ /* ps1 */) `
|
|
26
|
-
$treeWalker = [TreeWalker]::new($cacheRequest.TreeFilter)
|
|
27
|
-
|
|
28
|
-
${0} | ForEach-Object {
|
|
29
|
-
$el = $_
|
|
30
|
-
while ($null -ne ($parent = $treeWalker.GetParent($el))) {
|
|
31
|
-
$el = $parent
|
|
32
|
-
$validEl = $el.FindFirst([TreeScope]::Element, ${1})
|
|
33
|
-
|
|
34
|
-
if ($null -ne $validEl) {
|
|
35
|
-
Write-Output $el
|
|
36
|
-
break
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
25
|
+
const FIND_FIRST_ANCESTOR = (0, core_1.pwsh$ /* ps1 */) `
|
|
26
|
+
$treeWalker = [TreeWalker]::new($cacheRequest.TreeFilter)
|
|
27
|
+
|
|
28
|
+
${0} | ForEach-Object {
|
|
29
|
+
$el = $_
|
|
30
|
+
while ($null -ne ($parent = $treeWalker.GetParent($el))) {
|
|
31
|
+
$el = $parent
|
|
32
|
+
$validEl = $el.FindFirst([TreeScope]::Element, ${1})
|
|
33
|
+
|
|
34
|
+
if ($null -ne $validEl) {
|
|
35
|
+
Write-Output $el
|
|
36
|
+
break
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
40
|
`;
|
|
41
|
-
const FIND_ALL_ANCESTOR_OR_SELF = (0, core_1.pwsh$ /* ps1 */) `
|
|
42
|
-
$treeWalker = [TreeWalker]::new($cacheRequest.TreeFilter)
|
|
43
|
-
$els = New-Object System.Collections.Generic.List[AutomationElement]
|
|
44
|
-
|
|
45
|
-
${0} | ForEach-Object {
|
|
46
|
-
$el = $_
|
|
47
|
-
while ($null -ne $el) {
|
|
48
|
-
$validEl = $el.FindFirst([TreeScope]::Element, ${1})
|
|
49
|
-
|
|
50
|
-
if ($null -ne $validEl) {
|
|
51
|
-
$els.Add($validEl)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
$el = $treeWalker.GetParent($el)
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
Write-Output $els
|
|
41
|
+
const FIND_ALL_ANCESTOR_OR_SELF = (0, core_1.pwsh$ /* ps1 */) `
|
|
42
|
+
$treeWalker = [TreeWalker]::new($cacheRequest.TreeFilter)
|
|
43
|
+
$els = New-Object System.Collections.Generic.List[AutomationElement]
|
|
44
|
+
|
|
45
|
+
${0} | ForEach-Object {
|
|
46
|
+
$el = $_
|
|
47
|
+
while ($null -ne $el) {
|
|
48
|
+
$validEl = $el.FindFirst([TreeScope]::Element, ${1})
|
|
49
|
+
|
|
50
|
+
if ($null -ne $validEl) {
|
|
51
|
+
$els.Add($validEl)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
$el = $treeWalker.GetParent($el)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
Write-Output $els
|
|
59
59
|
`;
|
|
60
|
-
const FIND_FIRST_ANCESTOR_OR_SELF = (0, core_1.pwsh$ /* ps1 */) `
|
|
61
|
-
$treeWalker = [TreeWalker]::new($cacheRequest.TreeFilter)
|
|
62
|
-
|
|
63
|
-
${0} | ForEach-Object {
|
|
64
|
-
$el = $_
|
|
65
|
-
while ($null -ne $el) {
|
|
66
|
-
$validEl = $el.FindFirst([TreeScope]::Element, ${1})
|
|
67
|
-
|
|
68
|
-
if ($null -ne $validEl) {
|
|
69
|
-
Write-Output $el
|
|
70
|
-
break
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
$el = $treeWalker.GetParent($el)
|
|
74
|
-
}
|
|
75
|
-
}
|
|
60
|
+
const FIND_FIRST_ANCESTOR_OR_SELF = (0, core_1.pwsh$ /* ps1 */) `
|
|
61
|
+
$treeWalker = [TreeWalker]::new($cacheRequest.TreeFilter)
|
|
62
|
+
|
|
63
|
+
${0} | ForEach-Object {
|
|
64
|
+
$el = $_
|
|
65
|
+
while ($null -ne $el) {
|
|
66
|
+
$validEl = $el.FindFirst([TreeScope]::Element, ${1})
|
|
67
|
+
|
|
68
|
+
if ($null -ne $validEl) {
|
|
69
|
+
Write-Output $el
|
|
70
|
+
break
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
$el = $treeWalker.GetParent($el)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
76
|
`;
|
|
77
|
-
const FIND_PARENT = (0, core_1.pwsh$ /* ps1 */) `
|
|
78
|
-
$treeWalker = [TreeWalker]::new($cacheRequest.TreeFilter)
|
|
79
|
-
|
|
80
|
-
${0} | ForEach-Object {
|
|
81
|
-
$el = $_
|
|
82
|
-
$el = $treeWalker.GetParent($el).FindFirst([TreeScope]::Element, ${1})
|
|
83
|
-
Write-Output $el
|
|
84
|
-
}
|
|
77
|
+
const FIND_PARENT = (0, core_1.pwsh$ /* ps1 */) `
|
|
78
|
+
$treeWalker = [TreeWalker]::new($cacheRequest.TreeFilter)
|
|
79
|
+
|
|
80
|
+
${0} | ForEach-Object {
|
|
81
|
+
$el = $_
|
|
82
|
+
$el = $treeWalker.GetParent($el).FindFirst([TreeScope]::Element, ${1})
|
|
83
|
+
Write-Output $el
|
|
84
|
+
}
|
|
85
85
|
`;
|
|
86
|
-
const FIND_FOLLOWING = (0, core_1.pwsh$ /* ps1 */) `
|
|
87
|
-
$treeWalker = [TreeWalker]::new([AndCondition]::new($cacheRequest.TreeFilter, ${1}))
|
|
88
|
-
$els = New-Object System.Collections.Generic.List[AutomationElement]
|
|
89
|
-
|
|
90
|
-
${0} | ForEach-Object {
|
|
91
|
-
$el = $_
|
|
92
|
-
while ($null -ne $el) {
|
|
93
|
-
if ($null -ne ($nextSibling = $treeWalker.GetNextSibling($el))) {
|
|
94
|
-
$el = $nextSibling
|
|
95
|
-
|
|
96
|
-
Write-Output $el
|
|
97
|
-
break
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
$el = $treeWalker.GetParent($el)
|
|
101
|
-
}
|
|
102
|
-
}
|
|
86
|
+
const FIND_FOLLOWING = (0, core_1.pwsh$ /* ps1 */) `
|
|
87
|
+
$treeWalker = [TreeWalker]::new([AndCondition]::new($cacheRequest.TreeFilter, ${1}))
|
|
88
|
+
$els = New-Object System.Collections.Generic.List[AutomationElement]
|
|
89
|
+
|
|
90
|
+
${0} | ForEach-Object {
|
|
91
|
+
$el = $_
|
|
92
|
+
while ($null -ne $el) {
|
|
93
|
+
if ($null -ne ($nextSibling = $treeWalker.GetNextSibling($el))) {
|
|
94
|
+
$el = $nextSibling
|
|
95
|
+
|
|
96
|
+
Write-Output $el
|
|
97
|
+
break
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
$el = $treeWalker.GetParent($el)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
103
|
`;
|
|
104
|
-
const FIND_ALL_FOLLOWING = (0, core_1.pwsh$ /* ps1 */) `
|
|
105
|
-
$treeWalker = [TreeWalker]::new($cacheRequest.TreeFilter)
|
|
106
|
-
$els = New-Object System.Collections.Generic.List[AutomationElement]
|
|
107
|
-
|
|
108
|
-
${0} | ForEach-Object {
|
|
109
|
-
$el = $_
|
|
110
|
-
while ($null -ne $el) {
|
|
111
|
-
if ($null -ne ($nextSibling = $treeWalker.GetNextSibling($el))) {
|
|
112
|
-
$el = $nextSibling
|
|
113
|
-
$els.Add($el)
|
|
114
|
-
$els.AddRange($el.FindAll([TreeScope]::Children, ${1}))
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
$el = $treeWalker.GetParent($el)
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
Write-Output $els
|
|
104
|
+
const FIND_ALL_FOLLOWING = (0, core_1.pwsh$ /* ps1 */) `
|
|
105
|
+
$treeWalker = [TreeWalker]::new($cacheRequest.TreeFilter)
|
|
106
|
+
$els = New-Object System.Collections.Generic.List[AutomationElement]
|
|
107
|
+
|
|
108
|
+
${0} | ForEach-Object {
|
|
109
|
+
$el = $_
|
|
110
|
+
while ($null -ne $el) {
|
|
111
|
+
if ($null -ne ($nextSibling = $treeWalker.GetNextSibling($el))) {
|
|
112
|
+
$el = $nextSibling
|
|
113
|
+
$els.Add($el)
|
|
114
|
+
$els.AddRange($el.FindAll([TreeScope]::Children, ${1}))
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
$el = $treeWalker.GetParent($el)
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
Write-Output $els
|
|
122
122
|
`;
|
|
123
|
-
const FIND_FOLLOWING_SIBLING = (0, core_1.pwsh$ /* ps1 */) `
|
|
124
|
-
$treeWalker = [TreeWalker]::new($cacheRequest.TreeFilter)
|
|
125
|
-
|
|
126
|
-
${0} | ForEach-Object {
|
|
127
|
-
$el = $_
|
|
128
|
-
while ($null -ne ($nextSibling = $treeWalker.GetNextSibling($el))) {
|
|
129
|
-
$el = $nextSibling
|
|
130
|
-
$validEl = $el.FindFirst([TreeScope]::Element, ${1})
|
|
131
|
-
|
|
132
|
-
if ($null -ne $validEl) {
|
|
133
|
-
Write-Output $el
|
|
134
|
-
break
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
123
|
+
const FIND_FOLLOWING_SIBLING = (0, core_1.pwsh$ /* ps1 */) `
|
|
124
|
+
$treeWalker = [TreeWalker]::new($cacheRequest.TreeFilter)
|
|
125
|
+
|
|
126
|
+
${0} | ForEach-Object {
|
|
127
|
+
$el = $_
|
|
128
|
+
while ($null -ne ($nextSibling = $treeWalker.GetNextSibling($el))) {
|
|
129
|
+
$el = $nextSibling
|
|
130
|
+
$validEl = $el.FindFirst([TreeScope]::Element, ${1})
|
|
131
|
+
|
|
132
|
+
if ($null -ne $validEl) {
|
|
133
|
+
Write-Output $el
|
|
134
|
+
break
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
138
|
`;
|
|
139
|
-
const FIND_ALL_FOLLOWING_SIBLING = (0, core_1.pwsh$ /* ps1 */) `
|
|
140
|
-
$treeWalker = [TreeWalker]::new($cacheRequest.TreeFilter)
|
|
141
|
-
$els = New-Object System.Collections.Generic.List[AutomationElement]
|
|
142
|
-
|
|
143
|
-
${0} | ForEach-Object {
|
|
144
|
-
$el = $_
|
|
145
|
-
while ($null -ne ($nextSibling = $treeWalker.GetNextSibling($el))) {
|
|
146
|
-
$el = $nextSibling
|
|
147
|
-
$validEl = $el.FindFirst([TreeScope]::Element, ${1})
|
|
148
|
-
|
|
149
|
-
if ($null -ne $validEl) {
|
|
150
|
-
$els.Add($validEl)
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
Write-Output $els
|
|
139
|
+
const FIND_ALL_FOLLOWING_SIBLING = (0, core_1.pwsh$ /* ps1 */) `
|
|
140
|
+
$treeWalker = [TreeWalker]::new($cacheRequest.TreeFilter)
|
|
141
|
+
$els = New-Object System.Collections.Generic.List[AutomationElement]
|
|
142
|
+
|
|
143
|
+
${0} | ForEach-Object {
|
|
144
|
+
$el = $_
|
|
145
|
+
while ($null -ne ($nextSibling = $treeWalker.GetNextSibling($el))) {
|
|
146
|
+
$el = $nextSibling
|
|
147
|
+
$validEl = $el.FindFirst([TreeScope]::Element, ${1})
|
|
148
|
+
|
|
149
|
+
if ($null -ne $validEl) {
|
|
150
|
+
$els.Add($validEl)
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
Write-Output $els
|
|
156
156
|
`;
|
|
157
|
-
const FIND_PRECEDING = (0, core_1.pwsh$ /* ps1 */) `
|
|
158
|
-
$treeWalker = [TreeWalker]::new([AndCondition]::new($cacheRequest.TreeFilter, ${1}))
|
|
159
|
-
|
|
160
|
-
${0} | ForEach-Object {
|
|
161
|
-
$el = $_
|
|
162
|
-
while ($null -ne $el) {
|
|
163
|
-
if ($null -ne ($previousSibling = $treeWalker.GetPreviousSibling($el))) {
|
|
164
|
-
$el = $previousSibling
|
|
165
|
-
|
|
166
|
-
Write-Output $el
|
|
167
|
-
break
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
$el = $treeWalker.GetParent($el)
|
|
171
|
-
}
|
|
172
|
-
}
|
|
157
|
+
const FIND_PRECEDING = (0, core_1.pwsh$ /* ps1 */) `
|
|
158
|
+
$treeWalker = [TreeWalker]::new([AndCondition]::new($cacheRequest.TreeFilter, ${1}))
|
|
159
|
+
|
|
160
|
+
${0} | ForEach-Object {
|
|
161
|
+
$el = $_
|
|
162
|
+
while ($null -ne $el) {
|
|
163
|
+
if ($null -ne ($previousSibling = $treeWalker.GetPreviousSibling($el))) {
|
|
164
|
+
$el = $previousSibling
|
|
165
|
+
|
|
166
|
+
Write-Output $el
|
|
167
|
+
break
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
$el = $treeWalker.GetParent($el)
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
173
|
`;
|
|
174
|
-
const FIND_ALL_PRECEDING = (0, core_1.pwsh$ /* ps1 */) `
|
|
175
|
-
$treeWalker = [TreeWalker]::new([AndCondition]::new($cacheRequest.TreeFilter, ${1}))
|
|
176
|
-
$els = New-Object System.Collections.Generic.List[AutomationElement]
|
|
177
|
-
|
|
178
|
-
${0} | ForEach-Object {
|
|
179
|
-
$el = $_
|
|
180
|
-
while ($null -ne $el) {
|
|
181
|
-
if ($null -ne ($previousSibling = $treeWalker.GetPreviousSibling($el))) {
|
|
182
|
-
$el = $previousSibling
|
|
183
|
-
$els.Add($el)
|
|
184
|
-
$els.AddRange($el.FindAll([TreeScope]::Children, ${1}))
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
$el = $treeWalker.GetParent($el)
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
Write-Output $els
|
|
174
|
+
const FIND_ALL_PRECEDING = (0, core_1.pwsh$ /* ps1 */) `
|
|
175
|
+
$treeWalker = [TreeWalker]::new([AndCondition]::new($cacheRequest.TreeFilter, ${1}))
|
|
176
|
+
$els = New-Object System.Collections.Generic.List[AutomationElement]
|
|
177
|
+
|
|
178
|
+
${0} | ForEach-Object {
|
|
179
|
+
$el = $_
|
|
180
|
+
while ($null -ne $el) {
|
|
181
|
+
if ($null -ne ($previousSibling = $treeWalker.GetPreviousSibling($el))) {
|
|
182
|
+
$el = $previousSibling
|
|
183
|
+
$els.Add($el)
|
|
184
|
+
$els.AddRange($el.FindAll([TreeScope]::Children, ${1}))
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
$el = $treeWalker.GetParent($el)
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
Write-Output $els
|
|
192
192
|
`;
|
|
193
|
-
const FIND_PRECEDING_SIBLING = (0, core_1.pwsh$ /* ps1 */) `
|
|
194
|
-
$treeWalker = [TreeWalker]::new($cacheRequest.TreeFilter)
|
|
195
|
-
|
|
196
|
-
${0} | ForEach-Object {
|
|
197
|
-
$el = $_
|
|
198
|
-
while ($null -ne ($previousSibling = $treeWalker.GetPreviousSibling($el))) {
|
|
199
|
-
$el = $previousSibling
|
|
200
|
-
$validEl = $el.FindFirst([TreeScope]::Element, ${1})
|
|
201
|
-
|
|
202
|
-
if ($null -ne $validEl) {
|
|
203
|
-
Write-Output $el
|
|
204
|
-
break
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
193
|
+
const FIND_PRECEDING_SIBLING = (0, core_1.pwsh$ /* ps1 */) `
|
|
194
|
+
$treeWalker = [TreeWalker]::new($cacheRequest.TreeFilter)
|
|
195
|
+
|
|
196
|
+
${0} | ForEach-Object {
|
|
197
|
+
$el = $_
|
|
198
|
+
while ($null -ne ($previousSibling = $treeWalker.GetPreviousSibling($el))) {
|
|
199
|
+
$el = $previousSibling
|
|
200
|
+
$validEl = $el.FindFirst([TreeScope]::Element, ${1})
|
|
201
|
+
|
|
202
|
+
if ($null -ne $validEl) {
|
|
203
|
+
Write-Output $el
|
|
204
|
+
break
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
208
|
`;
|
|
209
|
-
const FIND_ALL_PRECEDING_SIBLING = (0, core_1.pwsh$ /* ps1 */) `
|
|
210
|
-
$treeWalker = [TreeWalker]::new($cacheRequest.TreeFilter)
|
|
211
|
-
$els = New-Object System.Collections.Generic.List[AutomationElement]
|
|
212
|
-
|
|
213
|
-
${0} | ForEach-Object {
|
|
214
|
-
$el = $_
|
|
215
|
-
while ($null -ne ($previousSibling = $treeWalker.GetPreviousSibling($el))) {
|
|
216
|
-
$el = $previousSibling
|
|
217
|
-
$validEl = $el.FindFirst([TreeScope]::Element, ${1})
|
|
218
|
-
|
|
219
|
-
if ($null -ne $validEl) {
|
|
220
|
-
$els.Add($validEl)
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
Write-Output $els
|
|
209
|
+
const FIND_ALL_PRECEDING_SIBLING = (0, core_1.pwsh$ /* ps1 */) `
|
|
210
|
+
$treeWalker = [TreeWalker]::new($cacheRequest.TreeFilter)
|
|
211
|
+
$els = New-Object System.Collections.Generic.List[AutomationElement]
|
|
212
|
+
|
|
213
|
+
${0} | ForEach-Object {
|
|
214
|
+
$el = $_
|
|
215
|
+
while ($null -ne ($previousSibling = $treeWalker.GetPreviousSibling($el))) {
|
|
216
|
+
$el = $previousSibling
|
|
217
|
+
$validEl = $el.FindFirst([TreeScope]::Element, ${1})
|
|
218
|
+
|
|
219
|
+
if ($null -ne $validEl) {
|
|
220
|
+
$els.Add($validEl)
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
Write-Output $els
|
|
226
226
|
`;
|
|
227
|
-
const FIND_CHILDREN_OR_SELF = (0, core_1.pwsh$ /* ps1 */) `
|
|
228
|
-
$els = New-Object System.Collections.Generic.List[AutomationElement]
|
|
229
|
-
|
|
230
|
-
${0} | ForEach-Object {
|
|
231
|
-
$el = $_
|
|
232
|
-
$validEl = $el.FindFirst([TreeScope]::Element -bor [TreeScope]::Children, ${1});
|
|
233
|
-
|
|
234
|
-
if ($null -ne $validEl) {
|
|
235
|
-
$els.Add($validEl)
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
Write-Output $els
|
|
227
|
+
const FIND_CHILDREN_OR_SELF = (0, core_1.pwsh$ /* ps1 */) `
|
|
228
|
+
$els = New-Object System.Collections.Generic.List[AutomationElement]
|
|
229
|
+
|
|
230
|
+
${0} | ForEach-Object {
|
|
231
|
+
$el = $_
|
|
232
|
+
$validEl = $el.FindFirst([TreeScope]::Element -bor [TreeScope]::Children, ${1});
|
|
233
|
+
|
|
234
|
+
if ($null -ne $validEl) {
|
|
235
|
+
$els.Add($validEl)
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
Write-Output $els
|
|
240
240
|
`;
|
|
241
|
-
const FIND_ALL_CHILDREN_OR_SELF = (0, core_1.pwsh$ /* ps1 */) `
|
|
242
|
-
$els = New-Object System.Collections.Generic.List[AutomationElement]
|
|
243
|
-
|
|
244
|
-
${0} | ForEach-Object {
|
|
245
|
-
$el = $_
|
|
246
|
-
$validEl = $el.FindAll([TreeScope]::Element -bor [TreeScope]::Children, ${1});
|
|
247
|
-
|
|
248
|
-
if ($null -ne $validEl) {
|
|
249
|
-
$els.Add($validEl)
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
Write-Output $els
|
|
241
|
+
const FIND_ALL_CHILDREN_OR_SELF = (0, core_1.pwsh$ /* ps1 */) `
|
|
242
|
+
$els = New-Object System.Collections.Generic.List[AutomationElement]
|
|
243
|
+
|
|
244
|
+
${0} | ForEach-Object {
|
|
245
|
+
$el = $_
|
|
246
|
+
$validEl = $el.FindAll([TreeScope]::Element -bor [TreeScope]::Children, ${1});
|
|
247
|
+
|
|
248
|
+
if ($null -ne $validEl) {
|
|
249
|
+
$els.Add($validEl)
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
Write-Output $els
|
|
254
254
|
`;
|
|
255
255
|
const FIND_DESCENDANTS = (0, core_1.pwsh$ /* ps1 */) `Find-ChildrenRecursively -element (${0}) -condition (${1})`;
|
|
256
256
|
const FIND_ALL_DESCENDANTS = (0, core_1.pwsh$ /* ps1 */) `Find-AllChildrenRecursively -element (${0}) -condition (${1})`;
|
|
@@ -261,227 +261,227 @@ const FIND_ALL = (0, core_1.pwsh$ /* ps1 */) `${0}.FindAll([TreeScope]::${1}, ${
|
|
|
261
261
|
const AUTOMATION_ROOT = /* ps1 */ `$rootElement`;
|
|
262
262
|
const FOCUSED_ELEMENT = /* ps1 */ `[AutomationElement]::FocusedElement`;
|
|
263
263
|
const ROOT_ELEMENT = /* ps1 */ `[AutomationElement]::RootElement`;
|
|
264
|
-
const SAVE_TO_ELEMENT_TABLE_AND_RETURN_ID = (0, core_1.pwsh$ /* ps1 */) `
|
|
265
|
-
${0} | Where-Object { $null -ne $_ } | ForEach-Object {
|
|
266
|
-
$runtimeId = $_.GetCurrentPropertyValue([AutomationElement]::RuntimeIdProperty) -join '.';
|
|
267
|
-
|
|
268
|
-
if (-not $elementTable.ContainsKey($runtimeId)) {
|
|
269
|
-
$elementTable.Add($runtimeId, $_)
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
$runtimeId
|
|
273
|
-
}
|
|
264
|
+
const SAVE_TO_ELEMENT_TABLE_AND_RETURN_ID = (0, core_1.pwsh$ /* ps1 */) `
|
|
265
|
+
${0} | Where-Object { $null -ne $_ } | ForEach-Object {
|
|
266
|
+
$runtimeId = $_.GetCurrentPropertyValue([AutomationElement]::RuntimeIdProperty) -join '.';
|
|
267
|
+
|
|
268
|
+
if (-not $elementTable.ContainsKey($runtimeId)) {
|
|
269
|
+
$elementTable.Add($runtimeId, $_)
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
$runtimeId
|
|
273
|
+
}
|
|
274
274
|
`;
|
|
275
275
|
const ELEMENT_TABLE_GET = (0, core_1.pwsh$ /* ps1 */) `$elementTable['${0}']`;
|
|
276
276
|
// TODO: maybe encode the result first? Some properties may be on multiple lines, it may cause a problem when returning multiple element results at once
|
|
277
277
|
const GET_CACHED_ELEMENT_PROPERTY = (0, core_1.pwsh$ /* ps1 */) `if ($null -ne ${0}) { ${0}.GetCachedPropertyValue([AutomationElement]::${1}Property) }`;
|
|
278
|
-
const GET_CURRENT_ELEMENT_PROPERTY = (0, core_1.pwsh$ /* ps1 */) `
|
|
279
|
-
if ($null -ne ${0}) {
|
|
280
|
-
try {
|
|
281
|
-
$target = "${1}"
|
|
282
|
-
|
|
283
|
-
# 1. Handle dotted Pattern.Property format (e.g. Window.CanMaximize or LegacyIAccessible.Name)
|
|
284
|
-
if ($target.Contains(".")) {
|
|
285
|
-
$parts = $target.Split(".")
|
|
286
|
-
if ($parts.Length -ge 2) {
|
|
287
|
-
$pKey = $parts[0]
|
|
288
|
-
$propName = $parts[1]
|
|
289
|
-
|
|
290
|
-
# Sweep supported properties for a match on the programmatic name (pattern + property)
|
|
291
|
-
foreach ($prop in ${0}.GetSupportedProperties()) {
|
|
292
|
-
# ProgrammaticName is usually something like "WindowPatternIdentifiers.CanMaximizeProperty"
|
|
293
|
-
if ($prop.ProgrammaticName -like "*$pKey*$propName*") {
|
|
294
|
-
$val = ${0}.GetCurrentPropertyValue($prop)
|
|
295
|
-
if ($null -ne $val) { return $val.ToString() }
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
# Custom Aliases / MSAA Fallback for dotted names (LegacyIAccessible.Name -> Name)
|
|
300
|
-
if ($pKey -eq "LegacyIAccessible") {
|
|
301
|
-
if ($propName -eq "Name") { return ${0}.Current.Name }
|
|
302
|
-
if ($propName -eq "Description") { return ${0}.Current.HelpText }
|
|
303
|
-
if ($propName -eq "Role") { return ${0}.Current.LocalizedControlType }
|
|
304
|
-
if ($propName -eq "State") { return "" }
|
|
305
|
-
if ($propName -eq "Value") { return "" }
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
# 2. Try standard AutomationElement property (e.g. NameProperty)
|
|
311
|
-
try {
|
|
312
|
-
$p = [System.Windows.Automation.AutomationElement]::($target + "Property")
|
|
313
|
-
if ($null -ne $p) {
|
|
314
|
-
$val = ${0}.GetCurrentPropertyValue($p)
|
|
315
|
-
if ($null -ne $val) { return $val.ToString() }
|
|
316
|
-
}
|
|
317
|
-
} catch {}
|
|
318
|
-
|
|
319
|
-
# 3. Fallback search through all supported properties for short names (e.g. "CanMaximize")
|
|
320
|
-
foreach ($prop in ${0}.GetSupportedProperties()) {
|
|
321
|
-
if ($prop.ProgrammaticName.EndsWith(".$($target)Property") -or $prop.ProgrammaticName.Contains(".$($target)")) {
|
|
322
|
-
$val = ${0}.GetCurrentPropertyValue($prop)
|
|
323
|
-
if ($null -ne $val) { return $val.ToString() }
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
# 4. Try pattern-based lookup for short names using common identifiers
|
|
328
|
-
$commonPatterns = @("Window", "Transform", "ExpandCollapse", "Toggle", "Value", "RangeValue", "LegacyIAccessible")
|
|
329
|
-
foreach ($pKey in $commonPatterns) {
|
|
330
|
-
try {
|
|
331
|
-
$pTypeName = "System.Windows.Automation.$($pKey)Pattern"
|
|
332
|
-
$pProp = Invoke-Expression "[$pTypeName]::$($target)Property"
|
|
333
|
-
if ($null -ne $pProp) {
|
|
334
|
-
$val = ${0}.GetCurrentPropertyValue($pProp)
|
|
335
|
-
if ($null -ne $val) { return $val.ToString() }
|
|
336
|
-
}
|
|
337
|
-
} catch {}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
# 5. UIA 3.0 / Driver-specific aliases (Safe Defaults)
|
|
341
|
-
if ($target -eq "IsDialog") { return "False" }
|
|
342
|
-
if ($target -eq "ProviderDescription") { return "" }
|
|
343
|
-
if ($target -eq "LegacyName") { return ${0}.Current.Name }
|
|
344
|
-
|
|
345
|
-
} catch { return $null }
|
|
346
|
-
}
|
|
278
|
+
const GET_CURRENT_ELEMENT_PROPERTY = (0, core_1.pwsh$ /* ps1 */) `
|
|
279
|
+
if ($null -ne ${0}) {
|
|
280
|
+
try {
|
|
281
|
+
$target = "${1}"
|
|
282
|
+
|
|
283
|
+
# 1. Handle dotted Pattern.Property format (e.g. Window.CanMaximize or LegacyIAccessible.Name)
|
|
284
|
+
if ($target.Contains(".")) {
|
|
285
|
+
$parts = $target.Split(".")
|
|
286
|
+
if ($parts.Length -ge 2) {
|
|
287
|
+
$pKey = $parts[0]
|
|
288
|
+
$propName = $parts[1]
|
|
289
|
+
|
|
290
|
+
# Sweep supported properties for a match on the programmatic name (pattern + property)
|
|
291
|
+
foreach ($prop in ${0}.GetSupportedProperties()) {
|
|
292
|
+
# ProgrammaticName is usually something like "WindowPatternIdentifiers.CanMaximizeProperty"
|
|
293
|
+
if ($prop.ProgrammaticName -like "*$pKey*$propName*") {
|
|
294
|
+
$val = ${0}.GetCurrentPropertyValue($prop)
|
|
295
|
+
if ($null -ne $val) { return $val.ToString() }
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
# Custom Aliases / MSAA Fallback for dotted names (LegacyIAccessible.Name -> Name)
|
|
300
|
+
if ($pKey -eq "LegacyIAccessible") {
|
|
301
|
+
if ($propName -eq "Name") { return ${0}.Current.Name }
|
|
302
|
+
if ($propName -eq "Description") { return ${0}.Current.HelpText }
|
|
303
|
+
if ($propName -eq "Role") { return ${0}.Current.LocalizedControlType }
|
|
304
|
+
if ($propName -eq "State") { return "" }
|
|
305
|
+
if ($propName -eq "Value") { return "" }
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
# 2. Try standard AutomationElement property (e.g. NameProperty)
|
|
311
|
+
try {
|
|
312
|
+
$p = [System.Windows.Automation.AutomationElement]::($target + "Property")
|
|
313
|
+
if ($null -ne $p) {
|
|
314
|
+
$val = ${0}.GetCurrentPropertyValue($p)
|
|
315
|
+
if ($null -ne $val) { return $val.ToString() }
|
|
316
|
+
}
|
|
317
|
+
} catch {}
|
|
318
|
+
|
|
319
|
+
# 3. Fallback search through all supported properties for short names (e.g. "CanMaximize")
|
|
320
|
+
foreach ($prop in ${0}.GetSupportedProperties()) {
|
|
321
|
+
if ($prop.ProgrammaticName.EndsWith(".$($target)Property") -or $prop.ProgrammaticName.Contains(".$($target)")) {
|
|
322
|
+
$val = ${0}.GetCurrentPropertyValue($prop)
|
|
323
|
+
if ($null -ne $val) { return $val.ToString() }
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
# 4. Try pattern-based lookup for short names using common identifiers
|
|
328
|
+
$commonPatterns = @("Window", "Transform", "ExpandCollapse", "Toggle", "Value", "RangeValue", "LegacyIAccessible")
|
|
329
|
+
foreach ($pKey in $commonPatterns) {
|
|
330
|
+
try {
|
|
331
|
+
$pTypeName = "System.Windows.Automation.$($pKey)Pattern"
|
|
332
|
+
$pProp = Invoke-Expression "[$pTypeName]::$($target)Property"
|
|
333
|
+
if ($null -ne $pProp) {
|
|
334
|
+
$val = ${0}.GetCurrentPropertyValue($pProp)
|
|
335
|
+
if ($null -ne $val) { return $val.ToString() }
|
|
336
|
+
}
|
|
337
|
+
} catch {}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
# 5. UIA 3.0 / Driver-specific aliases (Safe Defaults)
|
|
341
|
+
if ($target -eq "IsDialog") { return "False" }
|
|
342
|
+
if ($target -eq "ProviderDescription") { return "" }
|
|
343
|
+
if ($target -eq "LegacyName") { return ${0}.Current.Name }
|
|
344
|
+
|
|
345
|
+
} catch { return $null }
|
|
346
|
+
}
|
|
347
347
|
`;
|
|
348
|
-
const GET_ELEMENT_PROPERTY = (0, core_1.pwsh$ /* ps1 */) `
|
|
349
|
-
try {
|
|
350
|
-
$prop = [AutomationElement]::${1}Property
|
|
351
|
-
if ($null -ne $prop) {
|
|
352
|
-
try {
|
|
353
|
-
${0}.GetCachedPropertyValue($prop)
|
|
354
|
-
} catch {
|
|
355
|
-
${0}.GetCurrentPropertyValue($prop)
|
|
356
|
-
}
|
|
357
|
-
} else { $null }
|
|
358
|
-
} catch {
|
|
359
|
-
$null
|
|
360
|
-
}
|
|
348
|
+
const GET_ELEMENT_PROPERTY = (0, core_1.pwsh$ /* ps1 */) `
|
|
349
|
+
try {
|
|
350
|
+
$prop = [AutomationElement]::${1}Property
|
|
351
|
+
if ($null -ne $prop) {
|
|
352
|
+
try {
|
|
353
|
+
${0}.GetCachedPropertyValue($prop)
|
|
354
|
+
} catch {
|
|
355
|
+
${0}.GetCurrentPropertyValue($prop)
|
|
356
|
+
}
|
|
357
|
+
} else { $null }
|
|
358
|
+
} catch {
|
|
359
|
+
$null
|
|
360
|
+
}
|
|
361
361
|
`;
|
|
362
|
-
const GET_ELEMENT_RUNTIME_ID = (0, core_1.pwsh$ /* ps1 */) `
|
|
363
|
-
${0} | ForEach-Object {
|
|
364
|
-
$_.GetCurrentPropertyValue([AutomationElement]::RuntimeIdProperty) -join '.'
|
|
365
|
-
}
|
|
362
|
+
const GET_ELEMENT_RUNTIME_ID = (0, core_1.pwsh$ /* ps1 */) `
|
|
363
|
+
${0} | ForEach-Object {
|
|
364
|
+
$_.GetCurrentPropertyValue([AutomationElement]::RuntimeIdProperty) -join '.'
|
|
365
|
+
}
|
|
366
366
|
`;
|
|
367
|
-
const GET_ELEMENT_RECT = (0, core_1.pwsh$ /* ps1 */) `
|
|
368
|
-
if ($null -ne ${0}) {
|
|
369
|
-
try { $rect = ${0}.Cached.BoundingRectangle } catch { $rect = ${0}.Current.BoundingRectangle }
|
|
370
|
-
$rect |
|
|
371
|
-
Select-Object X, Y, Width, Height |
|
|
372
|
-
ForEach-Object { $_ | ConvertTo-Json -Compress } |
|
|
373
|
-
ForEach-Object { if ($null -ne $_) { $_.ToLower() } }
|
|
374
|
-
}
|
|
367
|
+
const GET_ELEMENT_RECT = (0, core_1.pwsh$ /* ps1 */) `
|
|
368
|
+
if ($null -ne ${0}) {
|
|
369
|
+
try { $rect = ${0}.Cached.BoundingRectangle } catch { $rect = ${0}.Current.BoundingRectangle }
|
|
370
|
+
$rect |
|
|
371
|
+
Select-Object X, Y, Width, Height |
|
|
372
|
+
ForEach-Object { $_ | ConvertTo-Json -Compress } |
|
|
373
|
+
ForEach-Object { if ($null -ne $_) { $_.ToLower() } }
|
|
374
|
+
}
|
|
375
375
|
`;
|
|
376
|
-
const GET_ELEMENT_LEGACY_VALUE = (0, core_1.pwsh$ /* ps1 */) `
|
|
377
|
-
try {
|
|
378
|
-
${0}.GetCurrentPattern([System.Windows.Automation.LegacyIAccessiblePattern]::Pattern).Current.Value
|
|
379
|
-
} catch {
|
|
380
|
-
try {
|
|
381
|
-
$hwnd = ${0}.Current.NativeWindowHandle
|
|
382
|
-
if ($hwnd -gt 0) {
|
|
383
|
-
[MSAAHelper]::GetLegacyProperty([IntPtr]$hwnd, "accValue")
|
|
384
|
-
} else { $null }
|
|
385
|
-
} catch { $null }
|
|
386
|
-
}
|
|
376
|
+
const GET_ELEMENT_LEGACY_VALUE = (0, core_1.pwsh$ /* ps1 */) `
|
|
377
|
+
try {
|
|
378
|
+
${0}.GetCurrentPattern([System.Windows.Automation.LegacyIAccessiblePattern]::Pattern).Current.Value
|
|
379
|
+
} catch {
|
|
380
|
+
try {
|
|
381
|
+
$hwnd = ${0}.Current.NativeWindowHandle
|
|
382
|
+
if ($hwnd -gt 0) {
|
|
383
|
+
[MSAAHelper]::GetLegacyProperty([IntPtr]$hwnd, "accValue")
|
|
384
|
+
} else { $null }
|
|
385
|
+
} catch { $null }
|
|
386
|
+
}
|
|
387
387
|
`;
|
|
388
|
-
const GET_ELEMENT_LEGACY_NAME = (0, core_1.pwsh$ /* ps1 */) `
|
|
389
|
-
if ($null -ne ${0}) {
|
|
390
|
-
try {
|
|
391
|
-
${0}.GetCurrentPattern([System.Windows.Automation.LegacyIAccessiblePattern]::Pattern).Current.Name
|
|
392
|
-
} catch {
|
|
393
|
-
try {
|
|
394
|
-
$hwnd = ${0}.Current.NativeWindowHandle
|
|
395
|
-
if ($hwnd -gt 0) {
|
|
396
|
-
[MSAAHelper]::GetLegacyProperty([IntPtr]$hwnd, "accName")
|
|
397
|
-
} else { $null }
|
|
398
|
-
} catch { $null }
|
|
399
|
-
}
|
|
400
|
-
}
|
|
388
|
+
const GET_ELEMENT_LEGACY_NAME = (0, core_1.pwsh$ /* ps1 */) `
|
|
389
|
+
if ($null -ne ${0}) {
|
|
390
|
+
try {
|
|
391
|
+
${0}.GetCurrentPattern([System.Windows.Automation.LegacyIAccessiblePattern]::Pattern).Current.Name
|
|
392
|
+
} catch {
|
|
393
|
+
try {
|
|
394
|
+
$hwnd = ${0}.Current.NativeWindowHandle
|
|
395
|
+
if ($hwnd -gt 0) {
|
|
396
|
+
[MSAAHelper]::GetLegacyProperty([IntPtr]$hwnd, "accName")
|
|
397
|
+
} else { $null }
|
|
398
|
+
} catch { $null }
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
401
|
`;
|
|
402
|
-
const GET_ELEMENT_LEGACY_DESCRIPTION = (0, core_1.pwsh$ /* ps1 */) `
|
|
403
|
-
if ($null -ne ${0}) {
|
|
404
|
-
try {
|
|
405
|
-
${0}.GetCurrentPattern([System.Windows.Automation.LegacyIAccessiblePattern]::Pattern).Current.Description
|
|
406
|
-
} catch {
|
|
407
|
-
try {
|
|
408
|
-
$hwnd = ${0}.Current.NativeWindowHandle
|
|
409
|
-
if ($hwnd -gt 0) {
|
|
410
|
-
[MSAAHelper]::GetLegacyProperty([IntPtr]$hwnd, "accDescription")
|
|
411
|
-
} else { $null }
|
|
412
|
-
} catch { $null }
|
|
413
|
-
}
|
|
414
|
-
}
|
|
402
|
+
const GET_ELEMENT_LEGACY_DESCRIPTION = (0, core_1.pwsh$ /* ps1 */) `
|
|
403
|
+
if ($null -ne ${0}) {
|
|
404
|
+
try {
|
|
405
|
+
${0}.GetCurrentPattern([System.Windows.Automation.LegacyIAccessiblePattern]::Pattern).Current.Description
|
|
406
|
+
} catch {
|
|
407
|
+
try {
|
|
408
|
+
$hwnd = ${0}.Current.NativeWindowHandle
|
|
409
|
+
if ($hwnd -gt 0) {
|
|
410
|
+
[MSAAHelper]::GetLegacyProperty([IntPtr]$hwnd, "accDescription")
|
|
411
|
+
} else { $null }
|
|
412
|
+
} catch { $null }
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
415
|
`;
|
|
416
|
-
const GET_ELEMENT_LEGACY_ROLE = (0, core_1.pwsh$ /* ps1 */) `
|
|
417
|
-
if ($null -ne ${0}) {
|
|
418
|
-
try {
|
|
419
|
-
${0}.GetCurrentPattern([System.Windows.Automation.LegacyIAccessiblePattern]::Pattern).Current.Role
|
|
420
|
-
} catch {
|
|
421
|
-
try {
|
|
422
|
-
$hwnd = ${0}.Current.NativeWindowHandle
|
|
423
|
-
if ($hwnd -gt 0) {
|
|
424
|
-
[MSAAHelper]::GetLegacyProperty([IntPtr]$hwnd, "accRole")
|
|
425
|
-
} else { $null }
|
|
426
|
-
} catch { $null }
|
|
427
|
-
}
|
|
428
|
-
}
|
|
416
|
+
const GET_ELEMENT_LEGACY_ROLE = (0, core_1.pwsh$ /* ps1 */) `
|
|
417
|
+
if ($null -ne ${0}) {
|
|
418
|
+
try {
|
|
419
|
+
${0}.GetCurrentPattern([System.Windows.Automation.LegacyIAccessiblePattern]::Pattern).Current.Role
|
|
420
|
+
} catch {
|
|
421
|
+
try {
|
|
422
|
+
$hwnd = ${0}.Current.NativeWindowHandle
|
|
423
|
+
if ($hwnd -gt 0) {
|
|
424
|
+
[MSAAHelper]::GetLegacyProperty([IntPtr]$hwnd, "accRole")
|
|
425
|
+
} else { $null }
|
|
426
|
+
} catch { $null }
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
429
|
`;
|
|
430
|
-
const GET_ELEMENT_LEGACY_STATE = (0, core_1.pwsh$ /* ps1 */) `
|
|
431
|
-
if ($null -ne ${0}) {
|
|
432
|
-
try {
|
|
433
|
-
${0}.GetCurrentPattern([System.Windows.Automation.LegacyIAccessiblePattern]::Pattern).Current.State
|
|
434
|
-
} catch {
|
|
435
|
-
try {
|
|
436
|
-
$hwnd = ${0}.Current.NativeWindowHandle
|
|
437
|
-
if ($hwnd -gt 0) {
|
|
438
|
-
[MSAAHelper]::GetLegacyProperty([IntPtr]$hwnd, "accState")
|
|
439
|
-
} else { $null }
|
|
440
|
-
} catch { $null }
|
|
441
|
-
}
|
|
442
|
-
}
|
|
430
|
+
const GET_ELEMENT_LEGACY_STATE = (0, core_1.pwsh$ /* ps1 */) `
|
|
431
|
+
if ($null -ne ${0}) {
|
|
432
|
+
try {
|
|
433
|
+
${0}.GetCurrentPattern([System.Windows.Automation.LegacyIAccessiblePattern]::Pattern).Current.State
|
|
434
|
+
} catch {
|
|
435
|
+
try {
|
|
436
|
+
$hwnd = ${0}.Current.NativeWindowHandle
|
|
437
|
+
if ($hwnd -gt 0) {
|
|
438
|
+
[MSAAHelper]::GetLegacyProperty([IntPtr]$hwnd, "accState")
|
|
439
|
+
} else { $null }
|
|
440
|
+
} catch { $null }
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
443
|
`;
|
|
444
|
-
const GET_ELEMENT_LEGACY_HELP = (0, core_1.pwsh$ /* ps1 */) `
|
|
445
|
-
if ($null -ne ${0}) {
|
|
446
|
-
try {
|
|
447
|
-
${0}.GetCurrentPattern([System.Windows.Automation.LegacyIAccessiblePattern]::Pattern).Current.Help
|
|
448
|
-
} catch {
|
|
449
|
-
try {
|
|
450
|
-
$hwnd = ${0}.Current.NativeWindowHandle
|
|
451
|
-
if ($hwnd -gt 0) {
|
|
452
|
-
[MSAAHelper]::GetLegacyProperty([IntPtr]$hwnd, "accHelp")
|
|
453
|
-
} else { $null }
|
|
454
|
-
} catch { $null }
|
|
455
|
-
}
|
|
456
|
-
}
|
|
444
|
+
const GET_ELEMENT_LEGACY_HELP = (0, core_1.pwsh$ /* ps1 */) `
|
|
445
|
+
if ($null -ne ${0}) {
|
|
446
|
+
try {
|
|
447
|
+
${0}.GetCurrentPattern([System.Windows.Automation.LegacyIAccessiblePattern]::Pattern).Current.Help
|
|
448
|
+
} catch {
|
|
449
|
+
try {
|
|
450
|
+
$hwnd = ${0}.Current.NativeWindowHandle
|
|
451
|
+
if ($hwnd -gt 0) {
|
|
452
|
+
[MSAAHelper]::GetLegacyProperty([IntPtr]$hwnd, "accHelp")
|
|
453
|
+
} else { $null }
|
|
454
|
+
} catch { $null }
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
457
|
`;
|
|
458
|
-
const GET_ELEMENT_LEGACY_KEYBOARD_SHORTCUT = (0, core_1.pwsh$ /* ps1 */) `
|
|
459
|
-
if ($null -ne ${0}) {
|
|
460
|
-
try {
|
|
461
|
-
${0}.GetCurrentPattern([System.Windows.Automation.LegacyIAccessiblePattern]::Pattern).Current.KeyboardShortcut
|
|
462
|
-
} catch {
|
|
463
|
-
try {
|
|
464
|
-
$hwnd = ${0}.Current.NativeWindowHandle
|
|
465
|
-
if ($hwnd -gt 0) {
|
|
466
|
-
[MSAAHelper]::GetLegacyProperty([IntPtr]$hwnd, "accKeyboardShortcut")
|
|
467
|
-
} else { $null }
|
|
468
|
-
} catch { $null }
|
|
469
|
-
}
|
|
470
|
-
}
|
|
458
|
+
const GET_ELEMENT_LEGACY_KEYBOARD_SHORTCUT = (0, core_1.pwsh$ /* ps1 */) `
|
|
459
|
+
if ($null -ne ${0}) {
|
|
460
|
+
try {
|
|
461
|
+
${0}.GetCurrentPattern([System.Windows.Automation.LegacyIAccessiblePattern]::Pattern).Current.KeyboardShortcut
|
|
462
|
+
} catch {
|
|
463
|
+
try {
|
|
464
|
+
$hwnd = ${0}.Current.NativeWindowHandle
|
|
465
|
+
if ($hwnd -gt 0) {
|
|
466
|
+
[MSAAHelper]::GetLegacyProperty([IntPtr]$hwnd, "accKeyboardShortcut")
|
|
467
|
+
} else { $null }
|
|
468
|
+
} catch { $null }
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
471
|
`;
|
|
472
|
-
const GET_ELEMENT_LEGACY_DEFAULT_ACTION = (0, core_1.pwsh$ /* ps1 */) `
|
|
473
|
-
if ($null -ne ${0}) {
|
|
474
|
-
try {
|
|
475
|
-
${0}.GetCurrentPattern([System.Windows.Automation.LegacyIAccessiblePattern]::Pattern).Current.DefaultAction
|
|
476
|
-
} catch {
|
|
477
|
-
try {
|
|
478
|
-
$hwnd = ${0}.Current.NativeWindowHandle
|
|
479
|
-
if ($hwnd -gt 0) {
|
|
480
|
-
[MSAAHelper]::GetLegacyProperty([IntPtr]$hwnd, "accDefaultAction")
|
|
481
|
-
} else { $null }
|
|
482
|
-
} catch { $null }
|
|
483
|
-
}
|
|
484
|
-
}
|
|
472
|
+
const GET_ELEMENT_LEGACY_DEFAULT_ACTION = (0, core_1.pwsh$ /* ps1 */) `
|
|
473
|
+
if ($null -ne ${0}) {
|
|
474
|
+
try {
|
|
475
|
+
${0}.GetCurrentPattern([System.Windows.Automation.LegacyIAccessiblePattern]::Pattern).Current.DefaultAction
|
|
476
|
+
} catch {
|
|
477
|
+
try {
|
|
478
|
+
$hwnd = ${0}.Current.NativeWindowHandle
|
|
479
|
+
if ($hwnd -gt 0) {
|
|
480
|
+
[MSAAHelper]::GetLegacyProperty([IntPtr]$hwnd, "accDefaultAction")
|
|
481
|
+
} else { $null }
|
|
482
|
+
} catch { $null }
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
485
|
`;
|
|
486
486
|
const GET_ELEMENT_WINDOW_CAN_MAXIMIZE = (0, core_1.pwsh$ /* ps1 */) `if ($null -ne ${0}) { try { ${0}.GetCurrentPattern([WindowPattern]::Pattern).Current.CanMaximize } catch { $null } }`;
|
|
487
487
|
const GET_ELEMENT_WINDOW_CAN_MINIMIZE = (0, core_1.pwsh$ /* ps1 */) `if ($null -ne ${0}) { try { ${0}.GetCurrentPattern([WindowPattern]::Pattern).Current.CanMinimize } catch { $null } }`;
|
|
@@ -492,266 +492,266 @@ const GET_ELEMENT_WINDOW_VISUAL_STATE = (0, core_1.pwsh$ /* ps1 */) `if ($null -
|
|
|
492
492
|
const GET_ELEMENT_TRANSFORM_CAN_MOVE = (0, core_1.pwsh$ /* ps1 */) `if ($null -ne ${0}) { try { ${0}.GetCurrentPattern([TransformPattern]::Pattern).Current.CanMove } catch { $null } }`;
|
|
493
493
|
const GET_ELEMENT_TRANSFORM_CAN_RESIZE = (0, core_1.pwsh$ /* ps1 */) `if ($null -ne ${0}) { try { ${0}.GetCurrentPattern([TransformPattern]::Pattern).Current.CanResize } catch { $null } }`;
|
|
494
494
|
const GET_ELEMENT_TRANSFORM_CAN_ROTATE = (0, core_1.pwsh$ /* ps1 */) `if ($null -ne ${0}) { try { ${0}.GetCurrentPattern([TransformPattern]::Pattern).Current.CanRotate } catch { $null } }`;
|
|
495
|
-
const GET_ELEMENT_LEGACY_CHILD_ID = (0, core_1.pwsh$ /* ps1 */) `
|
|
496
|
-
if ($null -ne ${0}) {
|
|
497
|
-
try {
|
|
498
|
-
${0}.GetCurrentPattern([System.Windows.Automation.LegacyIAccessiblePattern]::Pattern).Current.ChildId
|
|
499
|
-
} catch {
|
|
500
|
-
# For HWND based elements, ChildId is usually 0
|
|
501
|
-
try {
|
|
502
|
-
$hwnd = ${0}.Current.NativeWindowHandle
|
|
503
|
-
if ($hwnd -gt 0) {
|
|
504
|
-
0
|
|
505
|
-
} else { $null }
|
|
506
|
-
} catch { $null }
|
|
507
|
-
}
|
|
508
|
-
}
|
|
495
|
+
const GET_ELEMENT_LEGACY_CHILD_ID = (0, core_1.pwsh$ /* ps1 */) `
|
|
496
|
+
if ($null -ne ${0}) {
|
|
497
|
+
try {
|
|
498
|
+
${0}.GetCurrentPattern([System.Windows.Automation.LegacyIAccessiblePattern]::Pattern).Current.ChildId
|
|
499
|
+
} catch {
|
|
500
|
+
# For HWND based elements, ChildId is usually 0
|
|
501
|
+
try {
|
|
502
|
+
$hwnd = ${0}.Current.NativeWindowHandle
|
|
503
|
+
if ($hwnd -gt 0) {
|
|
504
|
+
0
|
|
505
|
+
} else { $null }
|
|
506
|
+
} catch { $null }
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
509
|
`;
|
|
510
|
-
const IS_LEGACY_PATTERN_AVAILABLE = (0, core_1.pwsh$ /* ps1 */) `
|
|
511
|
-
if ($null -ne ${0}) {
|
|
512
|
-
try {
|
|
513
|
-
if ($null -ne ${0}.GetCurrentPattern([System.Windows.Automation.LegacyIAccessiblePattern]::Pattern)) {
|
|
514
|
-
$true
|
|
515
|
-
} else {
|
|
516
|
-
# Only check HWND if managed pattern retrieval explicitly failed/returned null, but we are inside try block
|
|
517
|
-
# Actually if GetCurrentPattern throws, we go to catch.
|
|
518
|
-
# If it returns null (not supported), we go to else.
|
|
519
|
-
$hwnd = ${0}.Current.NativeWindowHandle
|
|
520
|
-
$hwnd -gt 0
|
|
521
|
-
}
|
|
522
|
-
} catch {
|
|
523
|
-
# Fallback for TypeNotFound or other UIA errors
|
|
524
|
-
try {
|
|
525
|
-
$hwnd = ${0}.Current.NativeWindowHandle
|
|
526
|
-
$hwnd -gt 0
|
|
527
|
-
} catch { $false }
|
|
528
|
-
}
|
|
529
|
-
} else {
|
|
530
|
-
$false
|
|
531
|
-
}
|
|
510
|
+
const IS_LEGACY_PATTERN_AVAILABLE = (0, core_1.pwsh$ /* ps1 */) `
|
|
511
|
+
if ($null -ne ${0}) {
|
|
512
|
+
try {
|
|
513
|
+
if ($null -ne ${0}.GetCurrentPattern([System.Windows.Automation.LegacyIAccessiblePattern]::Pattern)) {
|
|
514
|
+
$true
|
|
515
|
+
} else {
|
|
516
|
+
# Only check HWND if managed pattern retrieval explicitly failed/returned null, but we are inside try block
|
|
517
|
+
# Actually if GetCurrentPattern throws, we go to catch.
|
|
518
|
+
# If it returns null (not supported), we go to else.
|
|
519
|
+
$hwnd = ${0}.Current.NativeWindowHandle
|
|
520
|
+
$hwnd -gt 0
|
|
521
|
+
}
|
|
522
|
+
} catch {
|
|
523
|
+
# Fallback for TypeNotFound or other UIA errors
|
|
524
|
+
try {
|
|
525
|
+
$hwnd = ${0}.Current.NativeWindowHandle
|
|
526
|
+
$hwnd -gt 0
|
|
527
|
+
} catch { $false }
|
|
528
|
+
}
|
|
529
|
+
} else {
|
|
530
|
+
$false
|
|
531
|
+
}
|
|
532
532
|
`;
|
|
533
|
-
const GET_ELEMENT_TAG_NAME = (0, core_1.pwsh$ /* ps1 */) `
|
|
534
|
-
if ($null -ne ${0}) {
|
|
535
|
-
try { $ct = ${0}.Cached.ControlType } catch { $ct = ${0}.Current.ControlType }
|
|
536
|
-
$ct.ProgrammaticName |
|
|
537
|
-
ForEach-Object {
|
|
538
|
-
$type = $_.Split('.')[-1]
|
|
539
|
-
if ($type -eq 'DataGrid') { 'List' }
|
|
540
|
-
elseif ($type -eq 'DataItem') { 'ListItem' }
|
|
541
|
-
else { $type }
|
|
542
|
-
}
|
|
543
|
-
}
|
|
533
|
+
const GET_ELEMENT_TAG_NAME = (0, core_1.pwsh$ /* ps1 */) `
|
|
534
|
+
if ($null -ne ${0}) {
|
|
535
|
+
try { $ct = ${0}.Cached.ControlType } catch { $ct = ${0}.Current.ControlType }
|
|
536
|
+
$ct.ProgrammaticName |
|
|
537
|
+
ForEach-Object {
|
|
538
|
+
$type = $_.Split('.')[-1]
|
|
539
|
+
if ($type -eq 'DataGrid') { 'List' }
|
|
540
|
+
elseif ($type -eq 'DataItem') { 'ListItem' }
|
|
541
|
+
else { $type }
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
544
|
`;
|
|
545
545
|
// ... (rest of file)
|
|
546
546
|
// Inside AutomationElement class (implicit connection via line numbers, I will target the class method efficiently)
|
|
547
547
|
// Actually I need to insert the constant before buildGetPropertyCommand or at the top with others.
|
|
548
548
|
// The replace tool works on line ranges. I will convert this to 2 separate edits or use multi_replace.
|
|
549
549
|
// Let's use multi_replace for cleaner insertion.
|
|
550
|
-
const GET_ALL_ELEMENT_PROPERTIES = (0, core_1.pwsh$ /* ps1 */) `
|
|
551
|
-
if ($null -ne ${0}) {
|
|
552
|
-
$result = @{}
|
|
553
|
-
|
|
554
|
-
# 1. Standard Properties from AutomationElement
|
|
555
|
-
$standardProps = @(
|
|
556
|
-
"Name", "AutomationId", "ClassName", "ControlType", "LocalizedControlType",
|
|
557
|
-
"BoundingRectangle", "IsEnabled", "IsOffscreen", "IsKeyboardFocusable",
|
|
558
|
-
"HasKeyboardFocus", "AccessKey", "ProcessId", "RuntimeId", "FrameworkId",
|
|
559
|
-
"NativeWindowHandle", "IsContentElement", "IsControlElement", "IsPassword",
|
|
560
|
-
"HelpText", "ItemStatus", "ItemType", "AcceleratorKey"
|
|
561
|
-
)
|
|
562
|
-
|
|
563
|
-
foreach ($pName in $standardProps) {
|
|
564
|
-
try {
|
|
565
|
-
$prop = [AutomationElement]::($pName + "Property")
|
|
566
|
-
$val = ${0}.GetCurrentPropertyValue($prop)
|
|
567
|
-
if ($null -ne $val) {
|
|
568
|
-
if ($pName -eq "RuntimeId") { $result[$pName] = $val -join "." }
|
|
569
|
-
else { $result[$pName] = $val.ToString() }
|
|
570
|
-
}
|
|
571
|
-
} catch {}
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
# UIA 3.0+ Compatibility (Safe Defaults for UIA 2.0)
|
|
575
|
-
$result["IsDialog"] = "False"
|
|
576
|
-
$result["ProviderDescription"] = ""
|
|
577
|
-
|
|
578
|
-
# 2. Pattern Availability check
|
|
579
|
-
$patterns = @(
|
|
580
|
-
"Annotation", "Dock", "Drag", "DropTarget", "ExpandCollapse", "GridItem",
|
|
581
|
-
"Grid", "Invoke", "ItemContainer", "LegacyIAccessible", "MultipleView",
|
|
582
|
-
"ObjectModel", "RangeValue", "ScrollItem", "Scroll", "SelectionItem",
|
|
583
|
-
"Selection", "SpreadsheetItem", "Spreadsheet", "Styles", "SynchronizedInput",
|
|
584
|
-
"TableItem", "Table", "TextChild", "TextEdit", "Text", "Toggle", "Transform",
|
|
585
|
-
"Value", "VirtualizedItem", "Window", "CustomNavigation"
|
|
586
|
-
)
|
|
587
|
-
|
|
588
|
-
foreach ($pName in $patterns) {
|
|
589
|
-
$propName = "Is" + $pName + "PatternAvailable"
|
|
590
|
-
try {
|
|
591
|
-
$prop = [AutomationElement]::($propName + "Property")
|
|
592
|
-
$val = ${0}.GetCurrentPropertyValue($prop)
|
|
593
|
-
$result[$propName] = $val.ToString()
|
|
594
|
-
} catch {
|
|
595
|
-
$result[$propName] = "False"
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
# Pattern2 Compatibility (UIA 3.0)
|
|
600
|
-
$result["IsTextPattern2Available"] = "False"
|
|
601
|
-
$result["IsTransform2PatternAvailable"] = "False"
|
|
602
|
-
$result["IsSelectionPattern2Available"] = "False"
|
|
603
|
-
|
|
604
|
-
# 3. Pattern Specific Properties (Force Retrieval)
|
|
605
|
-
$patternsToQuery = @{
|
|
606
|
-
"Value" = @("Value", "IsReadOnly");
|
|
607
|
-
"RangeValue" = @("Value", "IsReadOnly", "Minimum", "Maximum", "LargeChange", "SmallChange");
|
|
608
|
-
"ExpandCollapse" = @("ExpandCollapseState");
|
|
609
|
-
"Toggle" = @("ToggleState");
|
|
610
|
-
"Window" = @("CanMaximize", "CanMinimize", "IsModal", "IsTopmost", "WindowInteractionState", "WindowVisualState");
|
|
611
|
-
"Transform" = @("CanMove", "CanResize", "CanRotate");
|
|
612
|
-
"Scroll" = @("HorizontalScrollPercent", "HorizontalViewSize", "VerticalScrollPercent", "VerticalViewSize", "HorizontallyScrollable", "VerticallyScrollable");
|
|
613
|
-
"Selection" = @("CanSelectMultiple", "IsSelectionRequired");
|
|
614
|
-
"SelectionItem" = @("IsSelected");
|
|
615
|
-
"Grid" = @("ColumnCount", "RowCount");
|
|
616
|
-
"GridItem" = @("Column", "Row", "ColumnSpan", "RowSpan");
|
|
617
|
-
"Table" = @("RowOrColumnMajor");
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
foreach ($pKey in $patternsToQuery.Keys) {
|
|
621
|
-
try {
|
|
622
|
-
$pTypeName = "System.Windows.Automation.$($pKey)Pattern"
|
|
623
|
-
$pPropField = Invoke-Expression "[$pTypeName]::Pattern"
|
|
624
|
-
$pObj = ${0}.GetCurrentPattern($pPropField)
|
|
625
|
-
if ($null -ne $pObj) {
|
|
626
|
-
$result["Is" + $pKey + "PatternAvailable"] = "True"
|
|
627
|
-
foreach ($propName in $patternsToQuery[$pKey]) {
|
|
628
|
-
try {
|
|
629
|
-
# Key used for dotted names in Inspect.exe
|
|
630
|
-
$dottedKey = $pKey + "." + $propName
|
|
631
|
-
|
|
632
|
-
# Try to get value from pattern object
|
|
633
|
-
$val = $pObj.Current.$propName
|
|
634
|
-
if ($null -ne $val) {
|
|
635
|
-
$result[$dottedKey] = $val.ToString()
|
|
636
|
-
# Also provide short name if not already set
|
|
637
|
-
if (-not $result.ContainsKey($propName)) {
|
|
638
|
-
$result[$propName] = $val.ToString()
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
} catch {}
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
} catch {}
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
# 4. Legacy Properties (Force Retrieval)
|
|
648
|
-
try {
|
|
649
|
-
$legacy = ${0}.GetCurrentPattern([System.Windows.Automation.LegacyIAccessiblePattern]::Pattern).Current
|
|
650
|
-
if ($null -ne $legacy) {
|
|
651
|
-
$result["IsLegacyIAccessiblePatternAvailable"] = "True"
|
|
652
|
-
|
|
653
|
-
# Standard Aliases (Backward Compatibility)
|
|
654
|
-
$result['LegacyName'] = $legacy.Name
|
|
655
|
-
$result['LegacyDescription'] = $legacy.Description
|
|
656
|
-
$result['LegacyRole'] = $legacy.Role.ToString()
|
|
657
|
-
$result['LegacyState'] = $legacy.State.ToString()
|
|
658
|
-
$result['LegacyValue'] = $legacy.Value
|
|
659
|
-
$result['LegacyHelp'] = $legacy.Help
|
|
660
|
-
$result['LegacyKeyboardShortcut'] = $legacy.KeyboardShortcut
|
|
661
|
-
$result['LegacyDefaultAction'] = $legacy.DefaultAction
|
|
662
|
-
$result['LegacyChildId'] = $legacy.ChildId.ToString()
|
|
663
|
-
|
|
664
|
-
# Dotted Names (Inspect.exe matching)
|
|
665
|
-
$result['LegacyIAccessible.Name'] = $legacy.Name
|
|
666
|
-
$result['LegacyIAccessible.Description'] = $legacy.Description
|
|
667
|
-
$result['LegacyIAccessible.Role'] = $legacy.Role.ToString()
|
|
668
|
-
$result['LegacyIAccessible.State'] = $legacy.State.ToString()
|
|
669
|
-
$result['LegacyIAccessible.Value'] = $legacy.Value
|
|
670
|
-
$result['LegacyIAccessible.Help'] = $legacy.Help
|
|
671
|
-
$result['LegacyIAccessible.KeyboardShortcut'] = $legacy.KeyboardShortcut
|
|
672
|
-
$result['LegacyIAccessible.DefaultAction'] = $legacy.DefaultAction
|
|
673
|
-
$result['LegacyIAccessible.ChildId'] = $legacy.ChildId.ToString()
|
|
674
|
-
}
|
|
675
|
-
} catch {}
|
|
676
|
-
|
|
677
|
-
# 5. GetSupportedProperties (Final sweep)
|
|
678
|
-
try {
|
|
679
|
-
foreach ($prop in ${0}.GetSupportedProperties()) {
|
|
680
|
-
$name = $prop.ProgrammaticName.Split('.')[-1].Replace('Property', '')
|
|
681
|
-
if (-not $result.ContainsKey($name)) {
|
|
682
|
-
$val = ${0}.GetCurrentPropertyValue($prop)
|
|
683
|
-
if ($null -ne $val) { $result[$name] = $val.ToString() }
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
} catch {}
|
|
687
|
-
|
|
688
|
-
$result | ConvertTo-Json -Compress
|
|
689
|
-
}
|
|
550
|
+
const GET_ALL_ELEMENT_PROPERTIES = (0, core_1.pwsh$ /* ps1 */) `
|
|
551
|
+
if ($null -ne ${0}) {
|
|
552
|
+
$result = @{}
|
|
553
|
+
|
|
554
|
+
# 1. Standard Properties from AutomationElement
|
|
555
|
+
$standardProps = @(
|
|
556
|
+
"Name", "AutomationId", "ClassName", "ControlType", "LocalizedControlType",
|
|
557
|
+
"BoundingRectangle", "IsEnabled", "IsOffscreen", "IsKeyboardFocusable",
|
|
558
|
+
"HasKeyboardFocus", "AccessKey", "ProcessId", "RuntimeId", "FrameworkId",
|
|
559
|
+
"NativeWindowHandle", "IsContentElement", "IsControlElement", "IsPassword",
|
|
560
|
+
"HelpText", "ItemStatus", "ItemType", "AcceleratorKey"
|
|
561
|
+
)
|
|
562
|
+
|
|
563
|
+
foreach ($pName in $standardProps) {
|
|
564
|
+
try {
|
|
565
|
+
$prop = [AutomationElement]::($pName + "Property")
|
|
566
|
+
$val = ${0}.GetCurrentPropertyValue($prop)
|
|
567
|
+
if ($null -ne $val) {
|
|
568
|
+
if ($pName -eq "RuntimeId") { $result[$pName] = $val -join "." }
|
|
569
|
+
else { $result[$pName] = $val.ToString() }
|
|
570
|
+
}
|
|
571
|
+
} catch {}
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
# UIA 3.0+ Compatibility (Safe Defaults for UIA 2.0)
|
|
575
|
+
$result["IsDialog"] = "False"
|
|
576
|
+
$result["ProviderDescription"] = ""
|
|
577
|
+
|
|
578
|
+
# 2. Pattern Availability check
|
|
579
|
+
$patterns = @(
|
|
580
|
+
"Annotation", "Dock", "Drag", "DropTarget", "ExpandCollapse", "GridItem",
|
|
581
|
+
"Grid", "Invoke", "ItemContainer", "LegacyIAccessible", "MultipleView",
|
|
582
|
+
"ObjectModel", "RangeValue", "ScrollItem", "Scroll", "SelectionItem",
|
|
583
|
+
"Selection", "SpreadsheetItem", "Spreadsheet", "Styles", "SynchronizedInput",
|
|
584
|
+
"TableItem", "Table", "TextChild", "TextEdit", "Text", "Toggle", "Transform",
|
|
585
|
+
"Value", "VirtualizedItem", "Window", "CustomNavigation"
|
|
586
|
+
)
|
|
587
|
+
|
|
588
|
+
foreach ($pName in $patterns) {
|
|
589
|
+
$propName = "Is" + $pName + "PatternAvailable"
|
|
590
|
+
try {
|
|
591
|
+
$prop = [AutomationElement]::($propName + "Property")
|
|
592
|
+
$val = ${0}.GetCurrentPropertyValue($prop)
|
|
593
|
+
$result[$propName] = $val.ToString()
|
|
594
|
+
} catch {
|
|
595
|
+
$result[$propName] = "False"
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
# Pattern2 Compatibility (UIA 3.0)
|
|
600
|
+
$result["IsTextPattern2Available"] = "False"
|
|
601
|
+
$result["IsTransform2PatternAvailable"] = "False"
|
|
602
|
+
$result["IsSelectionPattern2Available"] = "False"
|
|
603
|
+
|
|
604
|
+
# 3. Pattern Specific Properties (Force Retrieval)
|
|
605
|
+
$patternsToQuery = @{
|
|
606
|
+
"Value" = @("Value", "IsReadOnly");
|
|
607
|
+
"RangeValue" = @("Value", "IsReadOnly", "Minimum", "Maximum", "LargeChange", "SmallChange");
|
|
608
|
+
"ExpandCollapse" = @("ExpandCollapseState");
|
|
609
|
+
"Toggle" = @("ToggleState");
|
|
610
|
+
"Window" = @("CanMaximize", "CanMinimize", "IsModal", "IsTopmost", "WindowInteractionState", "WindowVisualState");
|
|
611
|
+
"Transform" = @("CanMove", "CanResize", "CanRotate");
|
|
612
|
+
"Scroll" = @("HorizontalScrollPercent", "HorizontalViewSize", "VerticalScrollPercent", "VerticalViewSize", "HorizontallyScrollable", "VerticallyScrollable");
|
|
613
|
+
"Selection" = @("CanSelectMultiple", "IsSelectionRequired");
|
|
614
|
+
"SelectionItem" = @("IsSelected");
|
|
615
|
+
"Grid" = @("ColumnCount", "RowCount");
|
|
616
|
+
"GridItem" = @("Column", "Row", "ColumnSpan", "RowSpan");
|
|
617
|
+
"Table" = @("RowOrColumnMajor");
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
foreach ($pKey in $patternsToQuery.Keys) {
|
|
621
|
+
try {
|
|
622
|
+
$pTypeName = "System.Windows.Automation.$($pKey)Pattern"
|
|
623
|
+
$pPropField = Invoke-Expression "[$pTypeName]::Pattern"
|
|
624
|
+
$pObj = ${0}.GetCurrentPattern($pPropField)
|
|
625
|
+
if ($null -ne $pObj) {
|
|
626
|
+
$result["Is" + $pKey + "PatternAvailable"] = "True"
|
|
627
|
+
foreach ($propName in $patternsToQuery[$pKey]) {
|
|
628
|
+
try {
|
|
629
|
+
# Key used for dotted names in Inspect.exe
|
|
630
|
+
$dottedKey = $pKey + "." + $propName
|
|
631
|
+
|
|
632
|
+
# Try to get value from pattern object
|
|
633
|
+
$val = $pObj.Current.$propName
|
|
634
|
+
if ($null -ne $val) {
|
|
635
|
+
$result[$dottedKey] = $val.ToString()
|
|
636
|
+
# Also provide short name if not already set
|
|
637
|
+
if (-not $result.ContainsKey($propName)) {
|
|
638
|
+
$result[$propName] = $val.ToString()
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
} catch {}
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
} catch {}
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
# 4. Legacy Properties (Force Retrieval)
|
|
648
|
+
try {
|
|
649
|
+
$legacy = ${0}.GetCurrentPattern([System.Windows.Automation.LegacyIAccessiblePattern]::Pattern).Current
|
|
650
|
+
if ($null -ne $legacy) {
|
|
651
|
+
$result["IsLegacyIAccessiblePatternAvailable"] = "True"
|
|
652
|
+
|
|
653
|
+
# Standard Aliases (Backward Compatibility)
|
|
654
|
+
$result['LegacyName'] = $legacy.Name
|
|
655
|
+
$result['LegacyDescription'] = $legacy.Description
|
|
656
|
+
$result['LegacyRole'] = $legacy.Role.ToString()
|
|
657
|
+
$result['LegacyState'] = $legacy.State.ToString()
|
|
658
|
+
$result['LegacyValue'] = $legacy.Value
|
|
659
|
+
$result['LegacyHelp'] = $legacy.Help
|
|
660
|
+
$result['LegacyKeyboardShortcut'] = $legacy.KeyboardShortcut
|
|
661
|
+
$result['LegacyDefaultAction'] = $legacy.DefaultAction
|
|
662
|
+
$result['LegacyChildId'] = $legacy.ChildId.ToString()
|
|
663
|
+
|
|
664
|
+
# Dotted Names (Inspect.exe matching)
|
|
665
|
+
$result['LegacyIAccessible.Name'] = $legacy.Name
|
|
666
|
+
$result['LegacyIAccessible.Description'] = $legacy.Description
|
|
667
|
+
$result['LegacyIAccessible.Role'] = $legacy.Role.ToString()
|
|
668
|
+
$result['LegacyIAccessible.State'] = $legacy.State.ToString()
|
|
669
|
+
$result['LegacyIAccessible.Value'] = $legacy.Value
|
|
670
|
+
$result['LegacyIAccessible.Help'] = $legacy.Help
|
|
671
|
+
$result['LegacyIAccessible.KeyboardShortcut'] = $legacy.KeyboardShortcut
|
|
672
|
+
$result['LegacyIAccessible.DefaultAction'] = $legacy.DefaultAction
|
|
673
|
+
$result['LegacyIAccessible.ChildId'] = $legacy.ChildId.ToString()
|
|
674
|
+
}
|
|
675
|
+
} catch {}
|
|
676
|
+
|
|
677
|
+
# 5. GetSupportedProperties (Final sweep)
|
|
678
|
+
try {
|
|
679
|
+
foreach ($prop in ${0}.GetSupportedProperties()) {
|
|
680
|
+
$name = $prop.ProgrammaticName.Split('.')[-1].Replace('Property', '')
|
|
681
|
+
if (-not $result.ContainsKey($name)) {
|
|
682
|
+
$val = ${0}.GetCurrentPropertyValue($prop)
|
|
683
|
+
if ($null -ne $val) { $result[$name] = $val.ToString() }
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
} catch {}
|
|
687
|
+
|
|
688
|
+
$result | ConvertTo-Json -Compress
|
|
689
|
+
}
|
|
690
690
|
`;
|
|
691
691
|
const SET_FOCUS_TO_ELEMENT = (0, core_1.pwsh$ /* ps1 */) `if ($null -ne ${0}) { ${0}.SetFocus() }`;
|
|
692
|
-
const GET_ELEMENT_TEXT = (0, core_1.pwsh$ /* ps1 */) `
|
|
693
|
-
if ($null -ne ${0}) {
|
|
694
|
-
try {
|
|
695
|
-
${0}.GetCurrentPattern([TextPattern]::Pattern).DocumentRange.GetText(-1)
|
|
696
|
-
} catch {
|
|
697
|
-
try {
|
|
698
|
-
${0}.GetCurrentPattern([SelectionPattern]::Pattern).Current.GetSelection().Current.Name
|
|
699
|
-
} catch {
|
|
700
|
-
${0}.Current.Name
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
}
|
|
692
|
+
const GET_ELEMENT_TEXT = (0, core_1.pwsh$ /* ps1 */) `
|
|
693
|
+
if ($null -ne ${0}) {
|
|
694
|
+
try {
|
|
695
|
+
${0}.GetCurrentPattern([TextPattern]::Pattern).DocumentRange.GetText(-1)
|
|
696
|
+
} catch {
|
|
697
|
+
try {
|
|
698
|
+
${0}.GetCurrentPattern([SelectionPattern]::Pattern).Current.GetSelection().Current.Name
|
|
699
|
+
} catch {
|
|
700
|
+
${0}.Current.Name
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
704
|
`;
|
|
705
705
|
const INVOKE_ELEMENT = (0, core_1.pwsh$ /* ps1 */) `if ($null -ne ${0}) { ${0}.GetCurrentPattern([InvokePattern]::Pattern).Invoke() }`;
|
|
706
706
|
const EXPAND_ELEMENT = (0, core_1.pwsh$ /* ps1 */) `if ($null -ne ${0}) { ${0}.GetCurrentPattern([ExpandCollapsePattern]::Pattern).Expand() }`;
|
|
707
707
|
const COLLAPSE_ELEMENT = (0, core_1.pwsh$ /* ps1 */) `if ($null -ne ${0}) { ${0}.GetCurrentPattern([ExpandCollapsePattern]::Pattern).Collapse() }`;
|
|
708
|
-
const SCROLL_ELEMENT_INTO_VIEW = (0, core_1.pwsh$ /* ps1 */) `
|
|
709
|
-
if ($null -ne ${0}) {
|
|
710
|
-
$pattern = ${0}.GetCurrentPattern([ScrollItemPattern]::Pattern);
|
|
711
|
-
if ($null -ne $pattern) {
|
|
712
|
-
$pattern.ScrollIntoView()
|
|
713
|
-
} else {
|
|
714
|
-
$success = $false
|
|
715
|
-
try {
|
|
716
|
-
${0}.SetFocus()
|
|
717
|
-
$success = $true
|
|
718
|
-
} catch {}
|
|
719
|
-
|
|
720
|
-
if (-not $success) {
|
|
721
|
-
try {
|
|
722
|
-
$legacy = ${0}.GetCurrentPattern([System.Windows.Automation.LegacyIAccessiblePattern]::Pattern);
|
|
723
|
-
if ($null -ne $legacy) {
|
|
724
|
-
$legacy.Select(3);
|
|
725
|
-
$success = $true
|
|
726
|
-
}
|
|
727
|
-
} catch {}
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
if (-not $success) {
|
|
731
|
-
# Try ItemContainerPattern on parent
|
|
732
|
-
try {
|
|
733
|
-
$parent = [TreeWalker]::ControlViewWalker.GetParent(${0});
|
|
734
|
-
if ($null -ne $parent) {
|
|
735
|
-
$containerPattern = $parent.GetCurrentPattern([ItemContainerPattern]::Pattern);
|
|
736
|
-
if ($null -ne $containerPattern) {
|
|
737
|
-
# We have the element, so we pass it directly to be realized/scrolled to
|
|
738
|
-
$found = $containerPattern.FindItemByProperty($null, [AutomationElement]::RuntimeIdProperty, ${0}.GetRuntimeId());
|
|
739
|
-
if ($null -ne $found) {
|
|
740
|
-
# Accessing the found item usually brings it into view or realizes it?
|
|
741
|
-
# Actually FindItemByProperty returns the element. We might need to ScrollIntoView THAT element?
|
|
742
|
-
# But we already have the element. The docs say "retrieves an element... and scrolls it into view".
|
|
743
|
-
$success = $true
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
} catch {}
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
if (-not $success) {
|
|
751
|
-
throw "Failed to scroll into view: ScrollItemPattern not supported, and SetFocus/LegacySelect/ItemContainerPattern failed."
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
}
|
|
708
|
+
const SCROLL_ELEMENT_INTO_VIEW = (0, core_1.pwsh$ /* ps1 */) `
|
|
709
|
+
if ($null -ne ${0}) {
|
|
710
|
+
$pattern = ${0}.GetCurrentPattern([ScrollItemPattern]::Pattern);
|
|
711
|
+
if ($null -ne $pattern) {
|
|
712
|
+
$pattern.ScrollIntoView()
|
|
713
|
+
} else {
|
|
714
|
+
$success = $false
|
|
715
|
+
try {
|
|
716
|
+
${0}.SetFocus()
|
|
717
|
+
$success = $true
|
|
718
|
+
} catch {}
|
|
719
|
+
|
|
720
|
+
if (-not $success) {
|
|
721
|
+
try {
|
|
722
|
+
$legacy = ${0}.GetCurrentPattern([System.Windows.Automation.LegacyIAccessiblePattern]::Pattern);
|
|
723
|
+
if ($null -ne $legacy) {
|
|
724
|
+
$legacy.Select(3);
|
|
725
|
+
$success = $true
|
|
726
|
+
}
|
|
727
|
+
} catch {}
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
if (-not $success) {
|
|
731
|
+
# Try ItemContainerPattern on parent
|
|
732
|
+
try {
|
|
733
|
+
$parent = [TreeWalker]::ControlViewWalker.GetParent(${0});
|
|
734
|
+
if ($null -ne $parent) {
|
|
735
|
+
$containerPattern = $parent.GetCurrentPattern([ItemContainerPattern]::Pattern);
|
|
736
|
+
if ($null -ne $containerPattern) {
|
|
737
|
+
# We have the element, so we pass it directly to be realized/scrolled to
|
|
738
|
+
$found = $containerPattern.FindItemByProperty($null, [AutomationElement]::RuntimeIdProperty, ${0}.GetRuntimeId());
|
|
739
|
+
if ($null -ne $found) {
|
|
740
|
+
# Accessing the found item usually brings it into view or realizes it?
|
|
741
|
+
# Actually FindItemByProperty returns the element. We might need to ScrollIntoView THAT element?
|
|
742
|
+
# But we already have the element. The docs say "retrieves an element... and scrolls it into view".
|
|
743
|
+
$success = $true
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
} catch {}
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
if (-not $success) {
|
|
751
|
+
throw "Failed to scroll into view: ScrollItemPattern not supported, and SetFocus/LegacySelect/ItemContainerPattern failed."
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
755
|
`;
|
|
756
756
|
const IS_MULTIPLE_SELECT_ELEMENT = (0, core_1.pwsh$ /* ps1 */) `if ($null -ne ${0}) { ${0}.GetCurrentPattern([SelectionPattern]::Pattern).Current.CanSelectMultiple }`;
|
|
757
757
|
const GET_SELECTED_ELEMENT = (0, core_1.pwsh$ /* ps1 */) `if ($null -ne ${0}) { ${0}.GetCurrentPattern([SelectionPattern]::Pattern).Current.GetSelection() }`;
|
|
@@ -760,63 +760,63 @@ const ADD_ELEMENT_TO_SELECTION = (0, core_1.pwsh$ /* ps1 */) `if ($null -ne ${0}
|
|
|
760
760
|
const REMOVE_ELEMENT_FROM_SELECTION = (0, core_1.pwsh$ /* ps1 */) `if ($null -ne ${0}) { ${0}.GetCurrentPattern([SelectionItemPattern]::Pattern).RemoveFromSelection() }`;
|
|
761
761
|
const SELECT_ELEMENT = (0, core_1.pwsh$ /* ps1 */) `if ($null -ne ${0}) { ${0}.GetCurrentPattern([SelectionItemPattern]::Pattern).Select() }`;
|
|
762
762
|
const TOGGLE_ELEMENT = (0, core_1.pwsh$ /* ps1 */) `if ($null -ne ${0}) { ${0}.GetCurrentPattern([TogglePattern]::Pattern).Toggle() }`;
|
|
763
|
-
const SET_ELEMENT_VALUE = (0, core_1.pwsh$ /* ps1 */) `
|
|
764
|
-
if ($null -ne ${0}) {
|
|
765
|
-
try {
|
|
766
|
-
${0}.GetCurrentPattern([ValuePattern]::Pattern).SetValue(${1})
|
|
767
|
-
} catch {
|
|
768
|
-
try {
|
|
769
|
-
$hwnd = ${0}.Current.NativeWindowHandle
|
|
770
|
-
if ($hwnd -gt 0) {
|
|
771
|
-
[MSAAHelper]::SetLegacyValue([IntPtr]$hwnd, ${1})
|
|
772
|
-
}
|
|
773
|
-
} catch {}
|
|
774
|
-
}
|
|
775
|
-
}
|
|
763
|
+
const SET_ELEMENT_VALUE = (0, core_1.pwsh$ /* ps1 */) `
|
|
764
|
+
if ($null -ne ${0}) {
|
|
765
|
+
try {
|
|
766
|
+
${0}.GetCurrentPattern([ValuePattern]::Pattern).SetValue(${1})
|
|
767
|
+
} catch {
|
|
768
|
+
try {
|
|
769
|
+
$hwnd = ${0}.Current.NativeWindowHandle
|
|
770
|
+
if ($hwnd -gt 0) {
|
|
771
|
+
[MSAAHelper]::SetLegacyValue([IntPtr]$hwnd, ${1})
|
|
772
|
+
}
|
|
773
|
+
} catch {}
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
776
|
`;
|
|
777
|
-
const GET_ELEMENT_EXPAND_COLLAPSE_STATE = (0, core_1.pwsh$ /* ps1 */) `
|
|
778
|
-
if ($null -ne ${0}) {
|
|
779
|
-
try {
|
|
780
|
-
${0}.GetCurrentPattern([ExpandCollapsePattern]::Pattern).Current.ExpandCollapseState
|
|
781
|
-
} catch { $null }
|
|
782
|
-
}
|
|
777
|
+
const GET_ELEMENT_EXPAND_COLLAPSE_STATE = (0, core_1.pwsh$ /* ps1 */) `
|
|
778
|
+
if ($null -ne ${0}) {
|
|
779
|
+
try {
|
|
780
|
+
${0}.GetCurrentPattern([ExpandCollapsePattern]::Pattern).Current.ExpandCollapseState
|
|
781
|
+
} catch { $null }
|
|
782
|
+
}
|
|
783
783
|
`;
|
|
784
784
|
const SET_ELEMENT_RANGE_VALUE = (0, core_1.pwsh$ /* ps1 */) `if ($null -ne ${0}) { ${0}.GetCurrentPattern([RangeValuePattern]::Pattern).SetValue(${1}) }`;
|
|
785
|
-
const GET_ELEMENT_VALUE = (0, core_1.pwsh$ /* ps1 */) `
|
|
786
|
-
if ($null -ne ${0}) {
|
|
787
|
-
try {
|
|
788
|
-
${0}.GetCurrentPattern([ValuePattern]::Pattern).Current.Value
|
|
789
|
-
} catch {
|
|
790
|
-
try {
|
|
791
|
-
$hwnd = ${0}.Current.NativeWindowHandle
|
|
792
|
-
if ($hwnd -gt 0) {
|
|
793
|
-
[MSAAHelper]::GetLegacyProperty([IntPtr]$hwnd, "accValue")
|
|
794
|
-
} else { $null }
|
|
795
|
-
} catch { $null }
|
|
796
|
-
}
|
|
797
|
-
}
|
|
785
|
+
const GET_ELEMENT_VALUE = (0, core_1.pwsh$ /* ps1 */) `
|
|
786
|
+
if ($null -ne ${0}) {
|
|
787
|
+
try {
|
|
788
|
+
${0}.GetCurrentPattern([ValuePattern]::Pattern).Current.Value
|
|
789
|
+
} catch {
|
|
790
|
+
try {
|
|
791
|
+
$hwnd = ${0}.Current.NativeWindowHandle
|
|
792
|
+
if ($hwnd -gt 0) {
|
|
793
|
+
[MSAAHelper]::GetLegacyProperty([IntPtr]$hwnd, "accValue")
|
|
794
|
+
} else { $null }
|
|
795
|
+
} catch { $null }
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
798
|
`;
|
|
799
|
-
const GET_ELEMENT_VALUE_IS_READ_ONLY = (0, core_1.pwsh$ /* ps1 */) `
|
|
800
|
-
if ($null -ne ${0}) {
|
|
801
|
-
try {
|
|
802
|
-
${0}.GetCurrentPattern([ValuePattern]::Pattern).Current.IsReadOnly
|
|
803
|
-
} catch {
|
|
804
|
-
# Fallback for Value Pattern missing via MSAA?
|
|
805
|
-
# MSAA doesn't strictly have IsReadOnly, but if accValue is settable?
|
|
806
|
-
# accState includes generic STATE_SYSTEM_READONLY?
|
|
807
|
-
try {
|
|
808
|
-
$hwnd = ${0}.Current.NativeWindowHandle
|
|
809
|
-
if ($hwnd -gt 0) {
|
|
810
|
-
$props = [MSAAHelper]::GetLegacyProperty([IntPtr]$hwnd, "accState");
|
|
811
|
-
# Check bitwise unique? PowerShell casting might strictly return string or object.
|
|
812
|
-
# But GetLegacyProperty returns object (int usually for state, but MSAAHelper does implicit reflection).
|
|
813
|
-
# Wait, MSAAHelper uses InvokeMember. accState returns Int32? Or specific I4?
|
|
814
|
-
# Let's assume it returns something usable.
|
|
815
|
-
$null
|
|
816
|
-
} else { $null }
|
|
817
|
-
} catch { $null }
|
|
818
|
-
}
|
|
819
|
-
}
|
|
799
|
+
const GET_ELEMENT_VALUE_IS_READ_ONLY = (0, core_1.pwsh$ /* ps1 */) `
|
|
800
|
+
if ($null -ne ${0}) {
|
|
801
|
+
try {
|
|
802
|
+
${0}.GetCurrentPattern([ValuePattern]::Pattern).Current.IsReadOnly
|
|
803
|
+
} catch {
|
|
804
|
+
# Fallback for Value Pattern missing via MSAA?
|
|
805
|
+
# MSAA doesn't strictly have IsReadOnly, but if accValue is settable?
|
|
806
|
+
# accState includes generic STATE_SYSTEM_READONLY?
|
|
807
|
+
try {
|
|
808
|
+
$hwnd = ${0}.Current.NativeWindowHandle
|
|
809
|
+
if ($hwnd -gt 0) {
|
|
810
|
+
$props = [MSAAHelper]::GetLegacyProperty([IntPtr]$hwnd, "accState");
|
|
811
|
+
# Check bitwise unique? PowerShell casting might strictly return string or object.
|
|
812
|
+
# But GetLegacyProperty returns object (int usually for state, but MSAAHelper does implicit reflection).
|
|
813
|
+
# Wait, MSAAHelper uses InvokeMember. accState returns Int32? Or specific I4?
|
|
814
|
+
# Let's assume it returns something usable.
|
|
815
|
+
$null
|
|
816
|
+
} else { $null }
|
|
817
|
+
} catch { $null }
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
820
|
`;
|
|
821
821
|
const GET_ELEMENT_TOGGLE_STATE = (0, core_1.pwsh$ /* ps1 */) `if ($null -ne ${0}) { ${0}.GetCurrentPattern([TogglePattern]::Pattern).Current.ToggleState }`;
|
|
822
822
|
const MAXIMIZE_WINDOW = (0, core_1.pwsh$ /* ps1 */) `if ($null -ne ${0}) { ${0}.GetCurrentPattern([WindowPattern]::Pattern).SetWindowVisualState([WindowVisualState]::Maximized) }`;
|