-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathuia.ahk
3547 lines (3180 loc) · 144 KB
/
uia.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;;;;;;;;;;;;;;;;;
;;IUIAutomation;;
;;;;;;;;;;;;;;;;;
class IUIAutomation extends IUnknown
{
__new(){
this.__:=ComObjCreate("{ff48dba4-60ef-4201-aa87-54103eef594e}","{30cbe57d-d9d0-452a-ab13-7ac5ac4825ee}"),this._v:=NumGet(this.__+0)
}
; Compares two UI Automation elements to determine whether they represent the same underlying UI element.
CompareElements(el1,el2){
UIA_hr(DllCall(this.vt(3),"ptr",this.__
,"ptr",IsObject(el1)?el1.__:el1
,"ptr",IsObject(el2)?el2.__:el2
,"int*",areSame
,"uint"),"CompareElements")
return areSame
}
; Compares two integer arrays containing run-time identifiers (IDs) to determine whether their content is the same and they belong to the same UI element.
CompareRuntimeIds(runtimeId1,runtimeId2){
UIA_hr(DllCall(this.vt(4),"ptr",this.__
,"ptr",runtimeId1
,"ptr",runtimeId2
,"int*",areSame
,"uint"),"CompareRuntimeIds")
return areSame
}
; Retrieves the UI Automation element that represents the desktop.
GetRootElement(){
UIA_hr(DllCall(this.vt(5),"ptr",this.__
,"ptr*",root
,"uint"),"GetRootElement")
return new IUIAutomationElement(root)
}
; Retrieves a UI Automation element for the specified window.
ElementFromHandle(hwnd){
UIA_hr(DllCall(this.vt(6),"ptr",this.__
,"ptr",hwnd
,"ptr*",element
,"uint"),"ElementFromHandle")
return new IUIAutomationElement(element)
}
; Retrieves the UI Automation element at the specified point on the desktop.
ElementFromPoint(pt){ ; pt := x|y<<32
UIA_hr(DllCall(this.vt(7),"ptr",this.__
,"int64",pt
,"ptr*",element
,"uint"),"ElementFromPoint")
return new IUIAutomationElement(element)
}
; Retrieves the UI Automation element that has the input focus.
GetFocusedElement(){
UIA_hr(DllCall(this.vt(8),"ptr",this.__
,"ptr*",element
,"uint"),"GetFocusedElement")
return new IUIAutomationElement(element)
}
; Retrieves the UI Automation element that has the input focus, prefetches the requested properties and control patterns, and stores the prefetched items in the cache.
GetRootElementBuildCache(cacheRequest){
UIA_hr(DllCall(this.vt(9),"ptr",this.__
,"ptr",IsObject(cacheRequest)?cacheRequest.__:cacheRequest
,"ptr*",root
,"uint"),"GetRootElementBuildCache")
return new IUIAutomationElement(root)
}
; Retrieves a UI Automation element for the specified window, prefetches the requested properties and control patterns, and stores the prefetched items in the cache.
ElementFromHandleBuildCache(hwnd,cacheRequest){
UIA_hr(DllCall(this.vt(10),"ptr",this.__
,"ptr",hwnd
,"ptr",IsObject(cacheRequest)?cacheRequest.__:cacheRequest
,"ptr*",element
,"uint"),"ElementFromHandleBuildCache")
return new IUIAutomationElement(element)
}
; Retrieves the UI Automation element at the specified point on the desktop, prefetches the requested properties and control patterns, and stores the prefetched items in the cache.
ElementFromPointBuildCache(pt,cacheRequest){
UIA_hr(DllCall(this.vt(11),"ptr",this.__
,"int64",pt
,"ptr",IsObject(cacheRequest)?cacheRequest.__:cacheRequest
,"ptr*",element
,"uint"),"ElementFromPointBuildCache")
return new IUIAutomationElement(element)
}
; Retrieves the UI Automation element that has the input focus, prefetches the requested properties and control patterns, and stores the prefetched items in the cache.
GetFocusedElementBuildCache(cacheRequest){
UIA_hr(DllCall(this.vt(12),"ptr",this.__
,"ptr",IsObject(cacheRequest)?cacheRequest.__:cacheRequest
,"ptr*",element
,"uint"),"GetFocusedElementBuildCache")
return new IUIAutomationElement(element)
}
; Retrieves a tree walker object that can be used to traverse the Microsoft UI Automation tree.
CreateTreeWalker(pCondition){
UIA_hr(DllCall(this.vt(13),"ptr",this.__
,"ptr",IsObject(pCondition)?pCondition.__:pCondition
,"ptr*",walker
,"uint"),"CreateTreeWalker")
return new IUIAutomationTreeWalker(walker)
}
; Retrieves an IUIAutomationTreeWalker interface used to discover control elements.
ControlViewWalker(){
UIA_hr(DllCall(this.vt(14),"ptr",this.__
,"ptr*",walker
,"uint"),"ControlViewWalker")
return new IUIAutomationTreeWalker(walker)
}
; Retrieves an IUIAutomationTreeWalker interface used to discover content elements.
ContentViewWalker(){
UIA_hr(DllCall(this.vt(15),"ptr",this.__
,"ptr*",walker
,"uint"),"ContentViewWalker")
return new IUIAutomationTreeWalker(walker)
}
; Retrieves a tree walker object used to traverse an unfiltered view of the UI Automation tree.
RawViewWalker(){
UIA_hr(DllCall(this.vt(16),"ptr",this.__
,"ptr*",walker
,"uint"),"RawViewWalker")
return new IUIAutomationTreeWalker(walker)
}
; Retrieves a predefined IUIAutomationCondition interface that selects all UI elements in an unfiltered view.
RawViewCondition(){
UIA_hr(DllCall(this.vt(17),"ptr",this.__
,"ptr*",condition
,"uint"),"RawViewCondition")
return new IUIAutomationCondition(condition)
}
; Retrieves a predefined IUIAutomationCondition interface that selects control elements.
ControlViewCondition(){
UIA_hr(DllCall(this.vt(18),"ptr",this.__
,"ptr*",condition
,"uint"),"ControlViewCondition")
return new IUIAutomationCondition(condition)
}
; Retrieves a predefined IUIAutomationCondition interface that selects content elements.
ContentViewCondition(){
UIA_hr(DllCall(this.vt(19),"ptr",this.__
,"ptr*",condition
,"uint"),"ContentViewCondition")
return new IUIAutomationCondition(condition)
}
; Creates a cache request.
; After obtaining the IUIAutomationCacheRequest interface, use its methods to specify properties and control patterns to be cached when a UI Automation element is obtained.
CreateCacheRequest(){
UIA_hr(DllCall(this.vt(20),"ptr",this.__
,"ptr*",cacheRequest
,"uint"),"CreateCacheRequest")
return new IUIAutomationCacheRequest(cacheRequest)
}
; Retrieves a predefined condition that selects all elements.
CreateTrueCondition(){
UIA_hr(DllCall(this.vt(21),"ptr",this.__
,"ptr*",newCondition
,"uint"),"CreateTrueCondition")
return new IUIAutomationBoolCondition(newCondition)
}
; Creates a condition that is always false.
; This method exists only for symmetry with IUIAutomation::CreateTrueCondition. A false condition will never enable a match with UI Automation elements, and it cannot usefully be combined with any other condition.
CreateFalseCondition(){
UIA_hr(DllCall(this.vt(22),"ptr",this.__
,"ptr*",newCondition
,"uint"),"CreateFalseCondition")
return new IUIAutomationBoolCondition(newCondition)
}
; Creates a condition that selects elements that have a property with the specified value.
CreatePropertyCondition(propertyId,value){ ; not test
UIA_hr(DllCall(this.vt(23),"ptr",this.__
,"int",propertyId
,"ptr",variant(ptr,UIA_PropertyVariantType(propertyId),value)
,"ptr*",newCondition
,"uint"),"CreatePropertyCondition")
return new IUIAutomationPropertyCondition(newCondition)
}
; Creates a condition that selects elements that have a property with the specified value, using optional flags.
CreatePropertyConditionEx(propertyId,value,flags){
UIA_hr(DllCall(this.vt(24),"ptr",this.__
,"int",propertyId
,"ptr",variant(ptr,UIA_PropertyVariantType(propertyId),value)
,"int",flags
,"ptr*",newCondition
,"uint"),"CreatePropertyConditionEx")
return new IUIAutomationPropertyCondition(newCondition)
}
; The Create**Condition** method calls AddRef on each pointers. This means you can call Release on those pointers after the call to Create**Condition** returns without invalidating the pointer returned from Create**Condition**. When you call Release on the pointer returned from Create**Condition**, UI Automation calls Release on those pointers.
; Creates a condition that selects elements that match both of two conditions.
CreateAndCondition(condition1,condition2){
UIA_hr(DllCall(this.vt(25),"ptr",this.__
,"ptr",IsObject(condition1)?condition1.__:condition1
,"ptr",IsObject(condition2)?condition2.__:condition2
,"ptr*",newCondition
,"uint"),"CreateAndCondition")
return new IUIAutomationAndCondition(newCondition)
}
; Creates a condition that selects elements based on multiple conditions, all of which must be true.
CreateAndConditionFromArray(conditions){
UIA_hr(DllCall(this.vt(26),"ptr",this.__
,"ptr",IsObject(conditions)?ComObjValue(conditions):conditions
,"ptr*",newCondition
,"uint"),"CreateAndConditionFromArray")
return new IUIAutomationAndCondition(newCondition)
}
; Creates a condition that selects elements based on multiple conditions, all of which must be true.
CreateAndConditionFromNativeArray(conditions,conditionCount){
UIA_hr(DllCall(this.vt(27),"ptr",this.__
,"ptr",IsObject(conditions)?conditions[]:conditions
,"int",conditionCount
,"ptr*",newCondition
,"uint"),"CreateAndConditionFromNativeArray")
return new IUIAutomationAndCondition(newCondition)
}
; Creates a combination of two conditions where a match exists if either of the conditions is true.
CreateOrCondition(condition1,condition2){
UIA_hr(DllCall(this.vt(28),"ptr",this.__
,"ptr",IsObject(condition1)?condition1.__:condition1
,"ptr",IsObject(condition2)?condition2.__:condition2
,"ptr*",newCondition
,"uint"),"CreateOrCondition")
return new IUIAutomationOrCondition(newCondition)
}
; Creates a combination of two or more conditions where a match exists if any of the conditions is true.
CreateOrConditionFromArray(conditions){
UIA_hr(DllCall(this.vt(29),"ptr",this.__
,"ptr",IsObject(conditions)?ComObjValue(conditions):conditions
,"ptr*",newCondition
,"uint"),"CreateOrConditionFromArray")
return new IUIAutomationOrCondition(newCondition)
}
; Creates a combination of two or more conditions where a match exists if any one of the conditions is true.
CreateOrConditionFromNativeArray(conditions,conditionCount){
UIA_hr(DllCall(this.vt(30),"ptr",this.__
,"ptr",IsObject(conditions)?conditions[]:conditions
,"ptr",conditionCount
,"ptr*",newCondition
,"uint"),"CreateOrConditionFromNativeArray")
return new IUIAutomationOrCondition(newCondition)
}
; Creates a condition that is the negative of a specified condition.
CreateNotCondition(condition){
UIA_hr(DllCall(this.vt(31),"ptr",this.__
,"ptr",IsObject(condition)?condition.__:condition
,"ptr*",newCondition
,"uint"),"CreateNotCondition")
return new IUIAutomationNotCondition(newCondition)
}
; Note: Before implementing an event handler, you should be familiar with the threading issues described in Understanding Threading Issues. http://msdn.microsoft.com/en-us/library/ee671692(v=vs.85).aspx
; A UI Automation client should not use multiple threads to add or remove event handlers. Unexpected behavior can result if one event handler is being added or removed while another is being added or removed in the same client process.
; It is possible for an event to be delivered to an event handler after the handler has been unsubscribed, if the event is received simultaneously with the request to unsubscribe the event. The best practice is to follow the Component Object Model (COM) standard and avoid destroying the event handler object until its reference count has reached zero. Destroying an event handler immediately after unsubscribing for events may result in an access violation if an event is delivered late.
; Registers a method that handles Microsoft UI Automation events.
AddAutomationEventHandler(eventId,element,scope,cacheRequest,handler){
return UIA_hr(DllCall(this.vt(32),"ptr",this.__
,"int",eventId
,"ptr",IsObject(element)?element.__:element
,"int",scope
,"ptr",cacheRequest?cacheRequest.__:0
,"ptr",handler
,"uint"),"AddAutomationEventHandler")
}
; Removes the specified UI Automation event handler.
RemoveAutomationEventHandler(eventId,element,handler){
return UIA_hr(DllCall(this.vt(33),"ptr",this.__
,"int",eventId
,"ptr",IsObject(element)?element.__:element
,"ptr",IsObject(handler)?handler[]:handler
,"uint"),"RemoveAutomationEventHandler")
}
; Registers a method that handles property-changed events.
; The UI item specified by element might not support the properties specified by the propertyArray parameter.
; This method serves the same purpose as IUIAutomation::AddPropertyChangedEventHandler, but takes a normal array of property identifiers instead of a SAFEARRAY.
AddPropertyChangedEventHandlerNativeArray(element,scope,cacheRequest,handler,propertyArray,propertyCount){
return UIA_hr(DllCall(this.vt(34),"ptr",this.__
,"ptr",IsObject(element)?element.__:element
,"int",scope
,"ptr",cacheRequest?cacheRequest.__:cacheRequest
,"ptr",IsObject(handler)?handler[]:handler
,"ptr",IsObject(propertyArray)?propertyArray[]:propertyArray
,"int",propertyCount
,"uint"),"AddPropertyChangedEventHandlerNativeArray")
}
; Registers a method that handles property-changed events.
; The UI item specified by element might not support the properties specified by the propertyArray parameter.
AddPropertyChangedEventHandler(element,scope,cacheRequest,handler,propertyArray){
return UIA_hr(DllCall(this.vt(35),"ptr",this.__
,"ptr",IsObject(element)?element.__:element
,"int",scope
,"ptr",cacheRequest?cacheRequest.__:cacheRequest
,"ptr",IsObject(handler)?handler[]:handler
,"ptr",propertyArray ; safearray
,"uint"),"AddPropertyChangedEventHandler")
}
; Removes a property-changed event handler.
RemovePropertyChangedEventHandler(element,handler){
return UIA_hr(DllCall(this.vt(36),"ptr",this.__
,"ptr",IsObject(element)?element.__:element
,"ptr",IsObject(handler)?handler[]:handler
,"uint"),"RemovePropertyChangedEventHandler")
}
; Registers a method that handles structure-changed events.
AddStructureChangedEventHandler(element,scope,cacheRequest,handler){
return UIA_hr(DllCall(this.vt(37),"ptr",this.__
,"ptr",IsObject(element)?element.__:element
,"int",scope
,"ptr",cacheRequest?cacheRequest.__:cacheRequest
,"ptr",handler
,"uint"),"AddStructureChangedEventHandler")
}
; Removes a structure-changed event handler.
RemoveStructureChangedEventHandler(element,handler){
return UIA_hr(DllCall(this.vt(38),"ptr",this.__
,"ptr",IsObject(element)?element.__:element
,"ptr",IsObject(handler)?handler[]:handler
,"uint"),"RemoveStructureChangedEventHandler")
}
; Registers a method that handles focus-changed events.
; Focus-changed events are system-wide; you cannot set a narrower scope.
AddFocusChangedEventHandler(cacheRequest,handler){
return UIA_hr(DllCall(this.vt(39),"ptr",this.__
,"ptr",cacheRequest?cacheRequest.__:cacheRequest
,"ptr",handler
,"uint"),"AddFocusChangedEventHandler")
}
; Removes a focus-changed event handler.
RemoveFocusChangedEventHandler(handler){
return UIA_hr(DllCall(this.vt(40),"ptr",this.__
,"ptr",IsObject(handler)?handler[]:handler
,"uint"),"RemoveFocusChangedEventHandler")
}
; Removes all registered Microsoft UI Automation event handlers.
RemoveAllEventHandlers(){
return UIA_hr(DllCall(this.vt(41),"ptr",this.__
,"uint"),"RemoveAllEventHandlers")
}
; Converts an array of integers to a SAFEARRAY.
IntNativeArrayToSafeArray(array,arrayCount){
UIA_hr(DllCall(this.vt(42),"ptr",this.__
,"ptr",IsObject(array)?array[]:array
,"int",arrayCount
,"ptr*",safeArray ; safearray
,"uint"),"IntNativeArrayToSafeArray")
return safeArray
}
; Converts a SAFEARRAY of integers to an array.
IntSafeArrayToNativeArray(intArray){
UIA_hr(DllCall(this.vt(43),"ptr",this.__
,"ptr",intArray ; safearray
,"ptr*",array
,"int*",arrayCount
,"uint"),"IntSafeArrayToNativeArray")
return [array,arrayCount]
}
; Creates a VARIANT that contains the coordinates of a rectangle.
; The returned VARIANT has a data type of VT_ARRAY | VT_R8.
RectToVariant(rc){
UIA_hr(DllCall(this.vt(44),"ptr",this.__
,"ptr",IsObject(rc)?rc[]:rc
,"ptr*",var
,"uint"),"RectToVariant")
return var ; not completed
}
; Converts a VARIANT containing rectangle coordinates to a RECT.
VariantToRect(var){
UIA_hr(DllCall(this.vt(45),"ptr",this.__
,"ptr",var
,"ptr*",rc
,"uint"),"VariantToRect")
return rc ; not completed
}
; Converts a SAFEARRAY containing rectangle coordinates to an array of type RECT.
SafeArrayToRectNativeArray(rects){
UIA_hr(DllCall(this.vt(46),"ptr",this.__
,"ptr",rects ; safearray
,"ptr*",rectArray
,"int*",rectArrayCount
,"uint"),"SafeArrayToRectNativeArray")
return [rectArray,rectArrayCount] ; not completed
}
; Creates a new instance of a proxy factory object.
; Use the IUIAutomationProxyFactoryMapping interface to enter the proxy factory into the table of available proxies.
CreateProxyFactoryEntry(factory){
UIA_hr(DllCall(this.vt(47),"ptr",this.__
,"ptr",IsObject(factory)?factory.__:factory
,"ptr*",factoryEntry
,"uint"),"CreateProxyFactoryEntry")
return new IUIAutomationProxyFactoryEntry(factoryEntry)
}
; Retrieves an object that represents the mapping of Window classnames and associated data to individual proxy factories. This property is read-only.
ProxyFactoryMapping(){
UIA_hr(DllCall(this.vt(48),"ptr",this.__
,"ptr*",factoryMapping
,"uint"),"ProxyFactoryMapping")
return new IUIAutomationProxyFactoryMapping(factoryMapping)
}
; The programmatic name is intended for debugging and diagnostic purposes only. The string is not localized.
; This property should not be used in string comparisons. To determine whether two properties are the same, compare the property identifiers directly.
; Retrieves the registered programmatic name of a property.
GetPropertyProgrammaticName(property){
UIA_hr(DllCall(this.vt(49),"ptr",this.__
,"int",property
,"ptr*",name
,"uint"),"GetPropertyProgrammaticName")
return StrGet(name,"utf-16")
}
; Retrieves the registered programmatic name of a control pattern.
GetPatternProgrammaticName(pattern){
UIA_hr(DllCall(this.vt(50),"ptr",this.__
,"int",pattern
,"ptr*",name
,"uint"),"GetPatternProgrammaticName")
return StrGet(name,"utf-16")
}
; This method is intended only for use by Microsoft UI Automation tools that need to scan for properties. It is not intended to be used by UI Automation clients.
; There is no guarantee that the element will support any particular control pattern when asked for it later.
; Retrieves the control patterns that might be supported on a UI Automation element.
PollForPotentialSupportedPatterns(pElement){
UIA_hr(DllCall(this.vt(51),"ptr",this.__
,"ptr",IsObject(pElement)?pElement.__:pElement
,"ptr*",patternIds
,"ptr*",patternNames
,"uint"),"PollForPotentialSupportedPatterns")
return [patternIds,patternNames] ; SafeArray
}
; Retrieves the properties that might be supported on a UI Automation element.
PollForPotentialSupportedProperties(pElement){
UIA_hr(DllCall(this.vt(52),"ptr",this.__
,"ptr",IsObject(pElement)?pElement.__:pElement
,"ptr*",propertyIds
,"ptr*",propertyNames
,"uint"),"PollForPotentialSupportedProperties")
return [propertyIds,propertyNames] ; SafeArray
}
; Checks a provided VARIANT to see if it contains the Not Supported identifier.
; After retrieving a property for a UI Automation element, call this method to determine whether the element supports the retrieved property. CheckNotSupported is typically called after calling a property retrieving method such as GetCurrentPropertyValue.
CheckNotSupported(value){ ; not completed
UIA_hr(DllCall(this.vt(53),"ptr",this.__
,"ptr",value ; variant
,"int*",isNotSupported
,"uint"),"CheckNotSupported")
return isNotSupported
}
; Retrieves a static token object representing a property or text attribute that is not supported. This property is read-only.
; This object can be used for comparison with the results from IUIAutomationElement::GetCurrentPropertyValue or IUIAutomationTextRange::GetAttributeValue.
ReservedNotSupportedValue(){
UIA_hr(DllCall(this.vt(54),"ptr",this.__
,"ptr*",notSupportedValue
,"uint"),"ReservedNotSupportedValue")
return notSupportedValue ; Iunknown
}
; Retrieves a static token object representing a text attribute that is a mixed attribute. This property is read-only.
; The object retrieved by IUIAutomation::ReservedMixedAttributeValue can be used for comparison with the results from IUIAutomationTextRange::GetAttributeValue to determine if a text range contains more than one value for a particular text attribute.
ReservedMixedAttributeValue(){
UIA_hr(DllCall(this.vt(55),"ptr",this.__
,"ptr*",mixedAttributeValue
,"uint"),"ReservedMixedAttributeValue")
return mixedAttributeValue ; Iunknown
}
; This method enables UI Automation clients to get IUIAutomationElement interfaces for accessible objects implemented by a Microsoft Active Accessiblity server.
; This method may fail if the server implements UI Automation provider interfaces alongside Microsoft Active Accessibility support.
; The method returns E_INVALIDARG if the underlying implementation of the Microsoft UI Automation element is not a native Microsoft Active Accessibility server; that is, if a client attempts to retrieve the IAccessible interface for an element originally supported by a proxy object from Oleacc.dll, or by the UIA-to-MSAA Bridge.
; Retrieves a UI Automation element for the specified accessible object from a Microsoft Active Accessibility server.
ElementFromIAccessible(accessible,childId){
UIA_hr(DllCall(this.vt(56),"ptr",this.__
,"ptr",IsObject(accessible)?accessible[]:accessible
,"int",childId
,"ptr*",element
,"uint"),"ElementFromIAccessible")
return new IUIAutomationElement(element)
}
; Retrieves a UI Automation element for the specified accessible object from a Microsoft Active Accessibility server, prefetches the requested properties and control patterns, and stores the prefetched items in the cache.
ElementFromIAccessibleBuildCache(accessible,childId,cacheRequest){
UIA_hr(DllCall(this.vt(57),"ptr",this.__
,"ptr",IsObject(accessible)?accessible[]:accessible
,"int",childId
,"ptr",IsObject(cacheRequest)?cacheRequest.__:cacheRequest
,"ptr*",element
,"uint"),"ElementFromIAccessibleBuildCache")
return new IUIAutomationElement(element)
}
}
;;;;;;;;;;;;;;;;;;;;;;;;
;;IUIAutomationElement;;
;;;;;;;;;;;;;;;;;;;;;;;;
class IUIAutomationElement extends IUnknown
{
; Sets the keyboard focus to this UI Automation element.
SetFocus(){
return UIA_hr(DllCall(this.vt(3),"ptr",this.__
,"uint"),"SetFocus")
}
; Retrieves the unique identifier assigned to the UI element.
; The identifier is only guaranteed to be unique to the UI of the desktop on which it was generated. Identifiers can be reused over time.
; The format of run-time identifiers might change in the future. The returned identifier should be treated as an opaque value and used only for comparison; for example, to determine whether a Microsoft UI Automation element is in the cache.
GetRuntimeId(){
UIA_hr(DllCall(this.vt(4),"ptr",this.__
,"ptr*",runtimeId
,"uint"),"GetRuntimeId")
return runtimeId ; safearray not completed
}
; The scope of the search is relative to the element on which the method is called. Elements are returned in the order in which they are encountered in the tree.
; This function cannot search for ancestor elements in the Microsoft UI Automation tree; that is, TreeScope_Ancestors is not a valid value for the scope parameter.
; When searching for top-level windows on the desktop, be sure to specify TreeScope_Children in the scope parameter, not TreeScope_Descendants. A search through the entire subtree of the desktop could iterate through thousands of items and lead to a stack overflow.
; If your client application might try to find elements in its own user interface, you must make all UI Automation calls on a separate thread.
; Retrieves the first child or descendant element that matches the specified condition.
FindFirst(scope,condition){
UIA_hr(DllCall(this.vt(5),"ptr",this.__
,"int",scope
,"ptr",IsObject(condition)?condition.__:condition
,"ptr*",found
,"uint"),"FindFirst")
return new IUIAutomationElement(found)
}
; Returns all UI Automation elements that satisfy the specified condition.
FindAll(scope,condition){
UIA_hr(DllCall(this.vt(6),"ptr",this.__
,"int",scope
,"ptr",IsObject(condition)?condition.__:condition
,"ptr*",found
,"uint"),"FindAll")
return new IUIAutomationElementArray(found)
}
; Retrieves the first child or descendant element that matches the specified condition, prefetches the requested properties and control patterns, and stores the prefetched items in the cache.
FindFirstBuildCache(scope,condition,cacheRequest){
UIA_hr(DllCall(this.vt(7),"ptr",this.__
,"int",scope
,"ptr",IsObject(condition)?condition.__:condition
,"ptr",IsObject(cacheRequest)?cacheRequest.__:cacheRequest
,"ptr*",found
,"uint"),"FindFirstBuildCache")
return new IUIAutomationElement(found)
}
; Returns all UI Automation elements that satisfy the specified condition, prefetches the requested properties and control patterns, and stores the prefetched items in the cache.
FindAllBuildCache(scope,condition,cacheRequest){
UIA_hr(DllCall(this.vt(8),"ptr",this.__
,"int",scope
,"ptr",IsObject(condition)?condition.__:condition
,"ptr",IsObject(cacheRequest)?cacheRequest.__:cacheRequest
,"ptr*",found
,"uint"),"FindAllBuildCache")
return new IUIAutomationElementArray(found)
}
; Retrieves a new UI Automation element with an updated cache.
; The original UI Automation element is unchanged. The new IUIAutomationElement interface refers to the same element and has the same runtime identifier.
BuildUpdatedCache(cacheRequest){
UIA_hr(DllCall(this.vt(9),"ptr",this.__
,"ptr",IsObject(cacheRequest)?cacheRequest.__:cacheRequest
,"ptr*",updatedElement
,"uint"),"BuildUpdatedCache")
return new IUIAutomationElement(updatedElement)
}
; Microsoft UI Automation properties of the double type support Not a Number (NaN) values. When retrieving a property of the double type, a client can use the _isnan function to determine whether the property is a NaN value.
; Retrieves the current value of a property for this UI Automation element.
GetCurrentPropertyValue(propertyId){ ; not completed
static _,_v:=variant(_)
UIA_hr(DllCall(this.vt(10),"ptr",this.__
,"int",propertyId
,"ptr",_v
,"uint"),"GetCurrentPropertyValue")
return GetVariantValue(_v)
}
; Retrieves a property value for this UI Automation element, optionally ignoring any default value.
; Passing FALSE in the ignoreDefaultValue parameter is equivalent to calling IUIAutomationElement::GetCurrentPropertyValue.
; If the Microsoft UI Automation provider for the element itself supports the property, the value of the property is returned. Otherwise, if ignoreDefaultValue is FALSE, a default value specified by UI Automation is returned.
; This method returns a failure code if the requested property was not previously cached.
GetCurrentPropertyValueEx(propertyId,ignoreDefaultValue){
static _,_v:=variant(_)
UIA_hr(DllCall(this.vt(11),"ptr",this.__
,"int",propertyId
,"int",ignoreDefaultValue
,"ptr",_v
,"uint"),"GetCurrentPropertyValueEx")
return GetVariantValue(_v)
}
; Retrieves a property value from the cache for this UI Automation element.
GetCachedPropertyValue(propertyId){
static _,_v:=variant(_)
UIA_hr(DllCall(this.vt(12),"ptr",this.__
,"int",propertyId
,"ptr",_v
,"uint"),"GetCachedPropertyValue")
return GetVariantValue(_v)
}
; Retrieves a property value from the cache for this UI Automation element, optionally ignoring any default value.
GetCachedPropertyValueEx(propertyId,ignoreDefaultValue,retVal){
static _,_v:=variant(_)
UIA_hr(DllCall(this.vt(13),"ptr",this.__
,"int",propertyId
,"int",ignoreDefaultValue
,"ptr",_v
,"uint"),"GetCachedPropertyValueEx")
return GetVariantValue(_v)
}
; Retrieves the control pattern interface of the specified pattern on this UI Automation element.
GetCurrentPatternAs(patternId,riid){ ; not completed
UIA_hr(DllCall(this.vt(14),"ptr",this.__
,"int",patternId
,"ptr",riid
,"ptr*",patternObject
,"uint"),"GetCurrentPatternAs")
return patternObject
}
; Retrieves the control pattern interface of the specified pattern from the cache of this UI Automation element.
GetCachedPatternAs(patternId,riid){ ; not completed
UIA_hr(DllCall(this.vt(15),"ptr",this.__
,"int",patternId
,"ptr",riid
,"ptr*",patternObject
,"uint"),"GetCachedPatternAs")
return patternObject
}
; Retrieves the IUnknown interface of the specified control pattern on this UI Automation element.
; This method gets the specified control pattern based on its availability at the time of the call.
; For some forms of UI, this method will incur cross-process performance overhead. Applications can reduce overhead by caching control patterns and then retrieving them by using IUIAutomationElement::GetCachedPattern.
GetCurrentPattern(patternId){
UIA_hr(DllCall(this.vt(16),"ptr",this.__
,"int",patternId
,"ptr*",patternObject
,"uint"),"GetCurrentPattern")
return (name:=UIA_Pattern(patternID))?new IUIAutomation%name%Pattern(patternObject):patternObject
}
; Retrieves from the cache the IUnknown interface of the specified control pattern of this UI Automation element.
GetCachedPattern(patternId){
UIA_hr(DllCall(this.vt(17),"ptr",this.__
,"int",patternId
,"ptr*",patternObject
,"uint"),"GetCachedPattern")
return (name:=UIA_Pattern(patternID))?new IUIAutomation%name%Pattern(patternObject):patternObject
}
; Retrieves from the cache the parent of this UI Automation element.
GetCachedParent(){
UIA_hr(DllCall(this.vt(18),"ptr",this.__
,"ptr*",parent
,"uint"),"GetCachedParent")
return new IUIAutomationElement(parent)
}
; Retrieves the cached child elements of this UI Automation element.
; The view of the returned collection is determined by the TreeFilter property of the IUIAutomationCacheRequest that was active when this element was obtained.
; Children are cached only if the scope of the cache request included TreeScope_Subtree, TreeScope_Children, or TreeScope_Descendants.
; If the cache request specified that children were to be cached at this level, but there are no children, the value of this property is 0. However, if no request was made to cache children at this level, an attempt to retrieve the property returns an error.
GetCachedChildren(){
UIA_hr(DllCall(this.vt(19),"ptr",this.__
,"ptr*",children
,"uint"),"GetCachedChildren")
return new IUIAutomationElementArray(children)
}
; Retrieves the identifier of the process that hosts the element.
CurrentProcessId(){
UIA_hr(DllCall(this.vt(20),"ptr",this.__
,"int*",retVal
,"uint"),"get_CurrentProcessId")
return retVal
}
; Retrieves the control type of the element.
; Control types describe a known interaction model for UI Automation elements without relying on a localized control type or combination of complex logic rules. This property cannot change at run time unless the control supports the IUIAutomationMultipleViewPattern interface. An example is the Win32 ListView control, which can change from a data grid to a list, depending on the current view.
CurrentControlType(){
UIA_hr(DllCall(this.vt(21),"ptr",this.__
,"int*",retVal
,"uint"),"get_CurrentControlType")
return retVal
}
; Retrieves a localized description of the control type of the element.
CurrentLocalizedControlType(){
UIA_hr(DllCall(this.vt(22),"ptr",this.__
,"ptr*",retVal
,"uint"),"get_CurrentLocalizedControlType")
return StrGet(retVal,"utf-16")
}
; Retrieves the name of the element.
CurrentName(){
UIA_hr(DllCall(this.vt(23),"ptr",this.__
,"ptr*",retVal
,"uint"),"get_CurrentName")
return StrGet(retVal,"utf-16")
}
; Retrieves the accelerator key for the element.
CurrentAcceleratorKey(){
UIA_hr(DllCall(this.vt(24),"ptr",this.__
,"ptr*",retVal
,"uint"),"get_CurrentAcceleratorKey")
return StrGet(retVal,"utf-16")
}
; Retrieves the access key character for the element.
; An access key is a character in the text of a menu, menu item, or label of a control such as a button that activates the attached menu function. For example, the letter "O" is often used to invoke the Open file common dialog box from a File menu. Microsoft UI Automation elements that have the access key property set always implement the Invoke control pattern.
CurrentAccessKey(){
UIA_hr(DllCall(this.vt(25),"ptr",this.__
,"ptr*",retVal
,"uint"),"get_CurrentAccessKey")
return StrGet(retVal,"utf-16")
}
; Indicates whether the element has keyboard focus.
CurrentHasKeyboardFocus(){
UIA_hr(DllCall(this.vt(26),"ptr",this.__
,"int*",retVal
,"uint"),"get_CurrentHasKeyboardFocus")
return retVal
}
; Indicates whether the element can accept keyboard focus.
CurrentIsKeyboardFocusable(){
UIA_hr(DllCall(this.vt(27),"ptr",this.__
,"int*",retVal
,"uint"),"get_CurrentIsKeyboardFocusable")
return retVal
}
; Retrieves a cached value that indicates whether the element is enabled.
CurrentIsEnabled(){
UIA_hr(DllCall(this.vt(28),"ptr",this.__
,"int*",retVal
,"uint"),"get_CurrentIsEnabled")
return retVal
}
; Retrieves the Microsoft UI Automation identifier of the element.
; The identifier is unique among sibling elements in a container, and is the same in all instances of the application.
CurrentAutomationId(){
UIA_hr(DllCall(this.vt(29),"ptr",this.__
,"ptr*",retVal
,"uint"),"get_CurrentAutomationId")
return retVal
}
; Retrieves the class name of the element.
; The value of this property is implementation-defined. The property is useful in testing environments.
CurrentClassName(){
UIA_hr(DllCall(this.vt(30),"ptr",this.__
,"ptr*",retVal
,"uint"),"get_CurrentClassName")
return StrGet(retVal,"utf-16")
}
; Retrieves the help text for the element. This information is typically obtained from tooltips.
; Caution Do not retrieve the CachedHelpText property from a control that is based on the SysListview32 class. Doing so could cause the system to become unstable and data to be lost. A client application can discover whether a control is based on SysListview32 by retrieving the CachedClassName or CurrentClassName property from the control.
CurrentHelpText(){
UIA_hr(DllCall(this.vt(31),"ptr",this.__
,"ptr*",retVal
,"uint"),"get_CurrentHelpText")
return StrGet(retVal,"utf-16")
}
; Retrieves the culture identifier for the element.
CurrentCulture(){
UIA_hr(DllCall(this.vt(32),"ptr",this.__
,"int*",retVal
,"uint"),"get_CurrentCulture")
return retVal
}
; Indicates whether the element is a control element.
CurrentIsControlElement(){
UIA_hr(DllCall(this.vt(33),"ptr",this.__
,"int*",retVal
,"uint"),"get_CurrentIsControlElement")
return retVal
}
; Indicates whether the element is a content element.
; A content element contains data that is presented to the user. Examples of content elements are the items in a list box or a button in a dialog box. Non-content elements, also called peripheral elements, are typically used to manipulate the content in a composite control; for example, the button on a drop-down control.
CurrentIsContentElement(){
UIA_hr(DllCall(this.vt(34),"ptr",this.__
,"int*",retVal
,"uint"),"get_CurrentIsContentElement")
return retVal
}
; Indicates whether the element contains a disguised password.
; This property enables applications such as screen-readers to determine whether the text content of a control should be read aloud.
CurrentIsPassword(){
UIA_hr(DllCall(this.vt(35),"ptr",this.__
,"int*",retVal
,"uint"),"get_CurrentIsPassword")
return retVal
}
; Retrieves the window handle of the element.
CurrentNativeWindowHandle(){
UIA_hr(DllCall(this.vt(36),"ptr",this.__
,"ptr*",retVal
,"uint"),"get_CurrentNativeWindowHandle")
return retVal
}
; Retrieves a description of the type of UI item represented by the element.
; This property is used to obtain information about items in a list, tree view, or data grid. For example, an item in a file directory view might be a "Document File" or a "Folder".
CurrentItemType(){
UIA_hr(DllCall(this.vt(37),"ptr",this.__
,"ptr*",retVal
,"uint"),"get_CurrentItemType")
return StrGet(retVal,"utf-16")
}
; Indicates whether the element is off-screen.
CurrentIsOffscreen(){
UIA_hr(DllCall(this.vt(38),"ptr",this.__
,"int*",retVal
,"uint"),"get_CurrentIsOffscreen")
return retVal
}
; Retrieves a value that indicates the orientation of the element.
; This property is supported by controls such as scroll bars and sliders that can have either a vertical or a horizontal orientation.
CurrentOrientation(){
UIA_hr(DllCall(this.vt(39),"ptr",this.__
,"int*",retVal
,"uint"),"get_CurrentOrientation")
return retVal ; OrientationType
}
; Retrieves the name of the underlying UI framework. The name of the UI framework, such as "Win32", "WinForm", or "DirectUI".
CurrentFrameworkId(){
UIA_hr(DllCall(this.vt(40),"ptr",this.__
,"ptr*",retVal
,"uint"),"get_CurrentFrameworkId")
return StrGet(retVal,"utf-16")
}
; Indicates whether the element is required to be filled out on a form.
CurrentIsRequiredForForm(){
UIA_hr(DllCall(this.vt(41),"ptr",this.__
,"int*",retVal
,"uint"),"get_CurrentIsRequiredForForm")
return retVal
}
; Retrieves the description of the status of an item in an element.
; This property enables a client to ascertain whether an element is conveying status about an item. For example, an item associated with a contact in a messaging application might be "Busy" or "Connected".
CurrentItemStatus(){
UIA_hr(DllCall(this.vt(42),"ptr",this.__
,"ptr*",retVal
,"uint"),"get_CurrentItemStatus")
return StrGet(retVal,"utf-16")
}
; Retrieves the coordinates of the rectangle that completely encloses the element, in screen coordinates.
CurrentBoundingRectangle(){
UIA_hr(DllCall(this.vt(43),"ptr",this.__
,"int64*",retVal
,"uint"),"get_CurrentBoundingRectangle")
return [retVal&0xFF,(retVal>>16)&0xFF,(retVal>>32)&0xFF,retVal>>48]
}
; This property maps to the Accessible Rich Internet Applications (ARIA) property.
; Retrieves the element that contains the text label for this element.
; This property could be used to retrieve, for example, the static text label for a combo box.
CurrentLabeledBy(){
UIA_hr(DllCall(this.vt(44),"ptr",this.__
,"ptr*",retVal
,"uint"),"get_CurrentLabeledBy")
return retVal ; IUIAutomationElement
}
; Retrieves the Accessible Rich Internet Applications (ARIA) role of the element.
CurrentAriaRole(){
UIA_hr(DllCall(this.vt(45),"ptr",this.__
,"ptr*",retVal
,"uint"),"get_CurrentAriaRole")
return StrGet(retVal,"utf-16")
}
; Retrieves the ARIA properties of the element.
CurrentAriaProperties(){
UIA_hr(DllCall(this.vt(46),"ptr",this.__
,"ptr",retVal
,"uint"),"get_CurrentAriaProperties")
return StrGet(retVal,"utf-16")
}
; Indicates whether the element contains valid data for a form.
CurrentIsDataValidForForm(){
UIA_hr(DllCall(this.vt(47),"ptr",this.__
,"int*",retVal
,"uint"),"get_CurrentIsDataValidForForm")
return retVal
}
; Retrieves an array of elements for which this element serves as the controller.
CurrentControllerFor(){
UIA_hr(DllCall(this.vt(48),"ptr",this.__
,"ptr*",retVal
,"uint"),"get_CurrentControllerFor")
return retVal ; IUIAutomationElementArray
}
; Retrieves an array of elements that describe this element.
CurrentDescribedBy(){
UIA_hr(DllCall(this.vt(49),"ptr",this.__
,"ptr*",retVal
,"uint"),"get_CurrentDescribedBy")
return retVal ; IUIAutomationElementArray
}
; Retrieves an array of elements that indicates the reading order after the current element.
CurrentFlowsTo(){
UIA_hr(DllCall(this.vt(50),"ptr",this.__
,"ptr*",retVal
,"uint"),"get_CurrentFlowsTo")
return retVal ; IUIAutomationElementArray
}
; Retrieves a description of the provider for this element.
CurrentProviderDescription(){
UIA_hr(DllCall(this.vt(51),"ptr",this.__
,"ptr*",retVal
,"uint"),"get_CurrentProviderDescription")
return StrGet(retVal,"utf-16")
}
; Retrieves the cached ID of the process that hosts the element.
CachedProcessId(){
UIA_hr(DllCall(this.vt(52),"ptr",this.__
,"int*",retVal
,"uint"),"get_CachedProcessId")
return retVal
}