-
Notifications
You must be signed in to change notification settings - Fork 0
/
uiautomation.py
8593 lines (7605 loc) · 378 KB
/
uiautomation.py
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
#!python3
# -*- coding: utf-8 -*-
"""
uiautomation for Python 3.
Author: [email protected]
Source: https://github.com/yinkaisheng/Python-UIAutomation-for-Windows
This module is for UIAutomation on Windows(Windows XP with SP3, Windows Vista and Windows 7/8/8.1/10).
It supports UIAutomation for the applications which implmented IUIAutomation, such as MFC, Windows Form, WPF, Modern UI(Metro UI), Qt, Firefox and Chrome.
Run 'automation.py -h' for help.
uiautomation is shared under the Apache Licene 2.0.
This means that the code can be freely copied and distributed, and costs nothing to use.
"""
import os
import sys
import time
import datetime
import re
import threading
import ctypes
import ctypes.wintypes
import comtypes # need 'pip install comtypes'
import comtypes.client
from typing import (Any, Callable, Dict, List, Iterable, Tuple) # need 'pip install typing' for Python3.4 or lower
TreeNode = Any
AUTHOR_MAIL = '[email protected]'
METRO_WINDOW_CLASS_NAME = 'Windows.UI.Core.CoreWindow' # for Windows 8 and 8.1
SEARCH_INTERVAL = 0.5 # search control interval seconds
MAX_MOVE_SECOND = 1 # simulate mouse move or drag max seconds
TIME_OUT_SECOND = 10
OPERATION_WAIT_TIME = 0.5
MAX_PATH = 260
DEBUG_SEARCH_TIME = False
DEBUG_EXIST_DISAPPEAR = False
S_OK = 0
IsPy38OrHigher = sys.version_info[:2] >= (3, 8)
IsNT6orHigher = os.sys.getwindowsversion().major >= 6
ProcessTime = time.perf_counter # this returns nearly 0 when first call it if python version <= 3.6
ProcessTime() # need to call it once if python version <= 3.6
class _AutomationClient:
_instance = None
@classmethod
def instance(cls) -> '_AutomationClient':
"""Singleton instance (this prevents com creation on import)."""
if cls._instance is None:
cls._instance = cls()
return cls._instance
def __init__(self):
tryCount = 3
for retry in range(tryCount):
try:
self.UIAutomationCore = comtypes.client.GetModule("UIAutomationCore.dll")
self.IUIAutomation = comtypes.client.CreateObject("{ff48dba4-60ef-4201-aa87-54103eef594e}", interface=self.UIAutomationCore.IUIAutomation)
self.ViewWalker = self.IUIAutomation.RawViewWalker
#self.ViewWalker = self.IUIAutomation.ControlViewWalker
break
except Exception as ex:
if retry + 1 == tryCount:
Logger.WriteLine('''
{}
Can not load UIAutomationCore.dll.
1, You may need to install Windows Update KB971513 if your OS is Windows XP, see https://github.com/yinkaisheng/WindowsUpdateKB971513ForIUIAutomation
2, You need to use an UIAutomationInitializerInThread object if use uiautomation in a thread, see demos/uiautomation_in_thread.py'''.format(ex), ConsoleColor.Yellow)
raise ex
class _DllClient:
_instance = None
@classmethod
def instance(cls) -> '_DllClient':
"""Singleton instance (this prevents com creation on import)."""
if cls._instance is None:
cls._instance = cls()
return cls._instance
def __init__(self):
binPath = os.path.join(os.path.dirname(os.path.abspath(__file__)), "bin")
os.environ["PATH"] = binPath + os.pathsep + os.environ["PATH"]
load = False
if IsPy38OrHigher:
os.add_dll_directory(binPath)
if sys.maxsize > 0xFFFFFFFF:
try:
self.dll = ctypes.cdll.UIAutomationClient_VC140_X64
load = True
except Exception as ex:
print(ex)
else:
try:
self.dll = ctypes.cdll.UIAutomationClient_VC140_X86
load = True
except Exception as ex:
print(ex)
if load:
self.dll.BitmapCreate.restype = ctypes.c_size_t
self.dll.BitmapFromWindow.restype = ctypes.c_size_t
self.dll.BitmapFromHBITMAP.restype = ctypes.c_size_t
self.dll.BitmapToHBITMAP.restype = ctypes.c_size_t
self.dll.BitmapFromFile.restype = ctypes.c_size_t
self.dll.BitmapResizedFrom.restype = ctypes.c_size_t
self.dll.BitmapRotatedFrom.restype = ctypes.c_size_t
self.dll.BitmapGetPixel.restype = ctypes.c_uint32
self.dll.Initialize()
else:
self.dll = None
Logger.WriteLine('Can not load dll.\nFunctionalities related to Bitmap are not available.\nYou may need to install Microsoft Visual C++ 2015 Redistributable Package.', ConsoleColor.Yellow)
def __del__(self):
if self.dll:
self.dll.Uninitialize()
# set Windows dll restype
ctypes.windll.user32.GetAncestor.restype = ctypes.c_void_p
ctypes.windll.user32.GetClipboardData.restype = ctypes.c_void_p
ctypes.windll.user32.GetDC.restype = ctypes.c_void_p
ctypes.windll.user32.GetForegroundWindow.restype = ctypes.c_void_p
ctypes.windll.user32.GetWindowDC.restype = ctypes.c_void_p
ctypes.windll.user32.GetWindowLongW.restype = ctypes.wintypes.LONG
ctypes.windll.user32.OpenDesktopW.restype = ctypes.c_void_p
ctypes.windll.user32.SendMessageW.restype = ctypes.wintypes.LONG
ctypes.windll.user32.WindowFromPoint.restype = ctypes.c_void_p
ctypes.windll.gdi32.CreateBitmap.restype = ctypes.c_void_p
ctypes.windll.gdi32.CreateCompatibleDC.restype = ctypes.c_void_p
ctypes.windll.gdi32.SelectObject.restype = ctypes.c_void_p
ctypes.windll.kernel32.GetConsoleWindow.restype = ctypes.c_void_p
ctypes.windll.kernel32.GetStdHandle.restype = ctypes.c_void_p
ctypes.windll.kernel32.GlobalAlloc.restype = ctypes.c_void_p
ctypes.windll.kernel32.GlobalLock.restype = ctypes.c_void_p
ctypes.windll.kernel32.OpenProcess.restype = ctypes.c_void_p
class ControlType:
"""
ControlType from IUIAutomation.
Refer https://docs.microsoft.com/en-us/windows/win32/winauto/uiauto-controltype-ids
"""
AppBarControl = 50040
ButtonControl = 50000
CalendarControl = 50001
CheckBoxControl = 50002
ComboBoxControl = 50003
CustomControl = 50025
DataGridControl = 50028
DataItemControl = 50029
DocumentControl = 50030
EditControl = 50004
GroupControl = 50026
HeaderControl = 50034
HeaderItemControl = 50035
HyperlinkControl = 50005
ImageControl = 50006
ListControl = 50008
ListItemControl = 50007
MenuBarControl = 50010
MenuControl = 50009
MenuItemControl = 50011
PaneControl = 50033
ProgressBarControl = 50012
RadioButtonControl = 50013
ScrollBarControl = 50014
SemanticZoomControl = 50039
SeparatorControl = 50038
SliderControl = 50015
SpinnerControl = 50016
SplitButtonControl = 50031
StatusBarControl = 50017
TabControl = 50018
TabItemControl = 50019
TableControl = 50036
TextControl = 50020
ThumbControl = 50027
TitleBarControl = 50037
ToolBarControl = 50021
ToolTipControl = 50022
TreeControl = 50023
TreeItemControl = 50024
WindowControl = 50032
ControlTypeNames = {
ControlType.AppBarControl: 'AppBarControl',
ControlType.ButtonControl: 'ButtonControl',
ControlType.CalendarControl: 'CalendarControl',
ControlType.CheckBoxControl: 'CheckBoxControl',
ControlType.ComboBoxControl: 'ComboBoxControl',
ControlType.CustomControl: 'CustomControl',
ControlType.DataGridControl: 'DataGridControl',
ControlType.DataItemControl: 'DataItemControl',
ControlType.DocumentControl: 'DocumentControl',
ControlType.EditControl: 'EditControl',
ControlType.GroupControl: 'GroupControl',
ControlType.HeaderControl: 'HeaderControl',
ControlType.HeaderItemControl: 'HeaderItemControl',
ControlType.HyperlinkControl: 'HyperlinkControl',
ControlType.ImageControl: 'ImageControl',
ControlType.ListControl: 'ListControl',
ControlType.ListItemControl: 'ListItemControl',
ControlType.MenuBarControl: 'MenuBarControl',
ControlType.MenuControl: 'MenuControl',
ControlType.MenuItemControl: 'MenuItemControl',
ControlType.PaneControl: 'PaneControl',
ControlType.ProgressBarControl: 'ProgressBarControl',
ControlType.RadioButtonControl: 'RadioButtonControl',
ControlType.ScrollBarControl: 'ScrollBarControl',
ControlType.SemanticZoomControl: 'SemanticZoomControl',
ControlType.SeparatorControl: 'SeparatorControl',
ControlType.SliderControl: 'SliderControl',
ControlType.SpinnerControl: 'SpinnerControl',
ControlType.SplitButtonControl: 'SplitButtonControl',
ControlType.StatusBarControl: 'StatusBarControl',
ControlType.TabControl: 'TabControl',
ControlType.TabItemControl: 'TabItemControl',
ControlType.TableControl: 'TableControl',
ControlType.TextControl: 'TextControl',
ControlType.ThumbControl: 'ThumbControl',
ControlType.TitleBarControl: 'TitleBarControl',
ControlType.ToolBarControl: 'ToolBarControl',
ControlType.ToolTipControl: 'ToolTipControl',
ControlType.TreeControl: 'TreeControl',
ControlType.TreeItemControl: 'TreeItemControl',
ControlType.WindowControl: 'WindowControl',
}
class PatternId:
"""
PatternId from IUIAutomation.
Refer https://docs.microsoft.com/en-us/windows/win32/winauto/uiauto-controlpattern-ids
"""
AnnotationPattern = 10023
CustomNavigationPattern = 10033
DockPattern = 10011
DragPattern = 10030
DropTargetPattern = 10031
ExpandCollapsePattern = 10005
GridItemPattern = 10007
GridPattern = 10006
InvokePattern = 10000
ItemContainerPattern = 10019
LegacyIAccessiblePattern = 10018
MultipleViewPattern = 10008
ObjectModelPattern = 10022
RangeValuePattern = 10003
ScrollItemPattern = 10017
ScrollPattern = 10004
SelectionItemPattern = 10010
SelectionPattern = 10001
SpreadsheetItemPattern = 10027
SpreadsheetPattern = 10026
StylesPattern = 10025
SynchronizedInputPattern = 10021
TableItemPattern = 10013
TablePattern = 10012
TextChildPattern = 10029
TextEditPattern = 10032
TextPattern = 10014
TextPattern2 = 10024
TogglePattern = 10015
TransformPattern = 10016
TransformPattern2 = 10028
ValuePattern = 10002
VirtualizedItemPattern = 10020
WindowPattern = 10009
PatternIdNames = {
PatternId.AnnotationPattern: 'AnnotationPattern',
PatternId.CustomNavigationPattern: 'CustomNavigationPattern',
PatternId.DockPattern: 'DockPattern',
PatternId.DragPattern: 'DragPattern',
PatternId.DropTargetPattern: 'DropTargetPattern',
PatternId.ExpandCollapsePattern: 'ExpandCollapsePattern',
PatternId.GridItemPattern: 'GridItemPattern',
PatternId.GridPattern: 'GridPattern',
PatternId.InvokePattern: 'InvokePattern',
PatternId.ItemContainerPattern: 'ItemContainerPattern',
PatternId.LegacyIAccessiblePattern: 'LegacyIAccessiblePattern',
PatternId.MultipleViewPattern: 'MultipleViewPattern',
PatternId.ObjectModelPattern: 'ObjectModelPattern',
PatternId.RangeValuePattern: 'RangeValuePattern',
PatternId.ScrollItemPattern: 'ScrollItemPattern',
PatternId.ScrollPattern: 'ScrollPattern',
PatternId.SelectionItemPattern: 'SelectionItemPattern',
PatternId.SelectionPattern: 'SelectionPattern',
PatternId.SpreadsheetItemPattern: 'SpreadsheetItemPattern',
PatternId.SpreadsheetPattern: 'SpreadsheetPattern',
PatternId.StylesPattern: 'StylesPattern',
PatternId.SynchronizedInputPattern: 'SynchronizedInputPattern',
PatternId.TableItemPattern: 'TableItemPattern',
PatternId.TablePattern: 'TablePattern',
PatternId.TextChildPattern: 'TextChildPattern',
PatternId.TextEditPattern: 'TextEditPattern',
PatternId.TextPattern: 'TextPattern',
PatternId.TextPattern2: 'TextPattern2',
PatternId.TogglePattern: 'TogglePattern',
PatternId.TransformPattern: 'TransformPattern',
PatternId.TransformPattern2: 'TransformPattern2',
PatternId.ValuePattern: 'ValuePattern',
PatternId.VirtualizedItemPattern: 'VirtualizedItemPattern',
PatternId.WindowPattern: 'WindowPattern',
}
class PropertyId:
"""
PropertyId from IUIAutomation.
Refer https://docs.microsoft.com/en-us/windows/win32/winauto/uiauto-automation-element-propids
Refer https://docs.microsoft.com/en-us/windows/win32/winauto/uiauto-control-pattern-propids
"""
AcceleratorKeyProperty = 30006
AccessKeyProperty = 30007
AnnotationAnnotationTypeIdProperty = 30113
AnnotationAnnotationTypeNameProperty = 30114
AnnotationAuthorProperty = 30115
AnnotationDateTimeProperty = 30116
AnnotationObjectsProperty = 30156
AnnotationTargetProperty = 30117
AnnotationTypesProperty = 30155
AriaPropertiesProperty = 30102
AriaRoleProperty = 30101
AutomationIdProperty = 30011
BoundingRectangleProperty = 30001
CenterPointProperty = 30165
ClassNameProperty = 30012
ClickablePointProperty = 30014
ControlTypeProperty = 30003
ControllerForProperty = 30104
CultureProperty = 30015
DescribedByProperty = 30105
DockDockPositionProperty = 30069
DragDropEffectProperty = 30139
DragDropEffectsProperty = 30140
DragGrabbedItemsProperty = 30144
DragIsGrabbedProperty = 30138
DropTargetDropTargetEffectProperty = 30142
DropTargetDropTargetEffectsProperty = 30143
ExpandCollapseExpandCollapseStateProperty = 30070
FillColorProperty = 30160
FillTypeProperty = 30162
FlowsFromProperty = 30148
FlowsToProperty = 30106
FrameworkIdProperty = 30024
FullDescriptionProperty = 30159
GridColumnCountProperty = 30063
GridItemColumnProperty = 30065
GridItemColumnSpanProperty = 30067
GridItemContainingGridProperty = 30068
GridItemRowProperty = 30064
GridItemRowSpanProperty = 30066
GridRowCountProperty = 30062
HasKeyboardFocusProperty = 30008
HelpTextProperty = 30013
IsAnnotationPatternAvailableProperty = 30118
IsContentElementProperty = 30017
IsControlElementProperty = 30016
IsCustomNavigationPatternAvailableProperty = 30151
IsDataValidForFormProperty = 30103
IsDockPatternAvailableProperty = 30027
IsDragPatternAvailableProperty = 30137
IsDropTargetPatternAvailableProperty = 30141
IsEnabledProperty = 30010
IsExpandCollapsePatternAvailableProperty = 30028
IsGridItemPatternAvailableProperty = 30029
IsGridPatternAvailableProperty = 30030
IsInvokePatternAvailableProperty = 30031
IsItemContainerPatternAvailableProperty = 30108
IsKeyboardFocusableProperty = 30009
IsLegacyIAccessiblePatternAvailableProperty = 30090
IsMultipleViewPatternAvailableProperty = 30032
IsObjectModelPatternAvailableProperty = 30112
IsOffscreenProperty = 30022
IsPasswordProperty = 30019
IsPeripheralProperty = 30150
IsRangeValuePatternAvailableProperty = 30033
IsRequiredForFormProperty = 30025
IsScrollItemPatternAvailableProperty = 30035
IsScrollPatternAvailableProperty = 30034
IsSelectionItemPatternAvailableProperty = 30036
IsSelectionPattern2AvailableProperty = 30168
IsSelectionPatternAvailableProperty = 30037
IsSpreadsheetItemPatternAvailableProperty = 30132
IsSpreadsheetPatternAvailableProperty = 30128
IsStylesPatternAvailableProperty = 30127
IsSynchronizedInputPatternAvailableProperty = 30110
IsTableItemPatternAvailableProperty = 30039
IsTablePatternAvailableProperty = 30038
IsTextChildPatternAvailableProperty = 30136
IsTextEditPatternAvailableProperty = 30149
IsTextPattern2AvailableProperty = 30119
IsTextPatternAvailableProperty = 30040
IsTogglePatternAvailableProperty = 30041
IsTransformPattern2AvailableProperty = 30134
IsTransformPatternAvailableProperty = 30042
IsValuePatternAvailableProperty = 30043
IsVirtualizedItemPatternAvailableProperty = 30109
IsWindowPatternAvailableProperty = 30044
ItemStatusProperty = 30026
ItemTypeProperty = 30021
LabeledByProperty = 30018
LandmarkTypeProperty = 30157
LegacyIAccessibleChildIdProperty = 30091
LegacyIAccessibleDefaultActionProperty = 30100
LegacyIAccessibleDescriptionProperty = 30094
LegacyIAccessibleHelpProperty = 30097
LegacyIAccessibleKeyboardShortcutProperty = 30098
LegacyIAccessibleNameProperty = 30092
LegacyIAccessibleRoleProperty = 30095
LegacyIAccessibleSelectionProperty = 30099
LegacyIAccessibleStateProperty = 30096
LegacyIAccessibleValueProperty = 30093
LevelProperty = 30154
LiveSettingProperty = 30135
LocalizedControlTypeProperty = 30004
LocalizedLandmarkTypeProperty = 30158
MultipleViewCurrentViewProperty = 30071
MultipleViewSupportedViewsProperty = 30072
NameProperty = 30005
NativeWindowHandleProperty = 30020
OptimizeForVisualContentProperty = 30111
OrientationProperty = 30023
OutlineColorProperty = 30161
OutlineThicknessProperty = 30164
PositionInSetProperty = 30152
ProcessIdProperty = 30002
ProviderDescriptionProperty = 30107
RangeValueIsReadOnlyProperty = 30048
RangeValueLargeChangeProperty = 30051
RangeValueMaximumProperty = 30050
RangeValueMinimumProperty = 30049
RangeValueSmallChangeProperty = 30052
RangeValueValueProperty = 30047
RotationProperty = 30166
RuntimeIdProperty = 30000
ScrollHorizontalScrollPercentProperty = 30053
ScrollHorizontalViewSizeProperty = 30054
ScrollHorizontallyScrollableProperty = 30057
ScrollVerticalScrollPercentProperty = 30055
ScrollVerticalViewSizeProperty = 30056
ScrollVerticallyScrollableProperty = 30058
Selection2CurrentSelectedItemProperty = 30171
Selection2FirstSelectedItemProperty = 30169
Selection2ItemCountProperty = 30172
Selection2LastSelectedItemProperty = 30170
SelectionCanSelectMultipleProperty = 30060
SelectionIsSelectionRequiredProperty = 30061
SelectionItemIsSelectedProperty = 30079
SelectionItemSelectionContainerProperty = 30080
SelectionSelectionProperty = 30059
SizeOfSetProperty = 30153
SizeProperty = 30167
SpreadsheetItemAnnotationObjectsProperty = 30130
SpreadsheetItemAnnotationTypesProperty = 30131
SpreadsheetItemFormulaProperty = 30129
StylesExtendedPropertiesProperty = 30126
StylesFillColorProperty = 30122
StylesFillPatternColorProperty = 30125
StylesFillPatternStyleProperty = 30123
StylesShapeProperty = 30124
StylesStyleIdProperty = 30120
StylesStyleNameProperty = 30121
TableColumnHeadersProperty = 30082
TableItemColumnHeaderItemsProperty = 30085
TableItemRowHeaderItemsProperty = 30084
TableRowHeadersProperty = 30081
TableRowOrColumnMajorProperty = 30083
ToggleToggleStateProperty = 30086
Transform2CanZoomProperty = 30133
Transform2ZoomLevelProperty = 30145
Transform2ZoomMaximumProperty = 30147
Transform2ZoomMinimumProperty = 30146
TransformCanMoveProperty = 30087
TransformCanResizeProperty = 30088
TransformCanRotateProperty = 30089
ValueIsReadOnlyProperty = 30046
ValueValueProperty = 30045
VisualEffectsProperty = 30163
WindowCanMaximizeProperty = 30073
WindowCanMinimizeProperty = 30074
WindowIsModalProperty = 30077
WindowIsTopmostProperty = 30078
WindowWindowInteractionStateProperty = 30076
WindowWindowVisualStateProperty = 30075
PropertyIdNames = {
PropertyId.AcceleratorKeyProperty: 'AcceleratorKeyProperty',
PropertyId.AccessKeyProperty: 'AccessKeyProperty',
PropertyId.AnnotationAnnotationTypeIdProperty: 'AnnotationAnnotationTypeIdProperty',
PropertyId.AnnotationAnnotationTypeNameProperty: 'AnnotationAnnotationTypeNameProperty',
PropertyId.AnnotationAuthorProperty: 'AnnotationAuthorProperty',
PropertyId.AnnotationDateTimeProperty: 'AnnotationDateTimeProperty',
PropertyId.AnnotationObjectsProperty: 'AnnotationObjectsProperty',
PropertyId.AnnotationTargetProperty: 'AnnotationTargetProperty',
PropertyId.AnnotationTypesProperty: 'AnnotationTypesProperty',
PropertyId.AriaPropertiesProperty: 'AriaPropertiesProperty',
PropertyId.AriaRoleProperty: 'AriaRoleProperty',
PropertyId.AutomationIdProperty: 'AutomationIdProperty',
PropertyId.BoundingRectangleProperty: 'BoundingRectangleProperty',
PropertyId.CenterPointProperty: 'CenterPointProperty',
PropertyId.ClassNameProperty: 'ClassNameProperty',
PropertyId.ClickablePointProperty: 'ClickablePointProperty',
PropertyId.ControlTypeProperty: 'ControlTypeProperty',
PropertyId.ControllerForProperty: 'ControllerForProperty',
PropertyId.CultureProperty: 'CultureProperty',
PropertyId.DescribedByProperty: 'DescribedByProperty',
PropertyId.DockDockPositionProperty: 'DockDockPositionProperty',
PropertyId.DragDropEffectProperty: 'DragDropEffectProperty',
PropertyId.DragDropEffectsProperty: 'DragDropEffectsProperty',
PropertyId.DragGrabbedItemsProperty: 'DragGrabbedItemsProperty',
PropertyId.DragIsGrabbedProperty: 'DragIsGrabbedProperty',
PropertyId.DropTargetDropTargetEffectProperty: 'DropTargetDropTargetEffectProperty',
PropertyId.DropTargetDropTargetEffectsProperty: 'DropTargetDropTargetEffectsProperty',
PropertyId.ExpandCollapseExpandCollapseStateProperty: 'ExpandCollapseExpandCollapseStateProperty',
PropertyId.FillColorProperty: 'FillColorProperty',
PropertyId.FillTypeProperty: 'FillTypeProperty',
PropertyId.FlowsFromProperty: 'FlowsFromProperty',
PropertyId.FlowsToProperty: 'FlowsToProperty',
PropertyId.FrameworkIdProperty: 'FrameworkIdProperty',
PropertyId.FullDescriptionProperty: 'FullDescriptionProperty',
PropertyId.GridColumnCountProperty: 'GridColumnCountProperty',
PropertyId.GridItemColumnProperty: 'GridItemColumnProperty',
PropertyId.GridItemColumnSpanProperty: 'GridItemColumnSpanProperty',
PropertyId.GridItemContainingGridProperty: 'GridItemContainingGridProperty',
PropertyId.GridItemRowProperty: 'GridItemRowProperty',
PropertyId.GridItemRowSpanProperty: 'GridItemRowSpanProperty',
PropertyId.GridRowCountProperty: 'GridRowCountProperty',
PropertyId.HasKeyboardFocusProperty: 'HasKeyboardFocusProperty',
PropertyId.HelpTextProperty: 'HelpTextProperty',
PropertyId.IsAnnotationPatternAvailableProperty: 'IsAnnotationPatternAvailableProperty',
PropertyId.IsContentElementProperty: 'IsContentElementProperty',
PropertyId.IsControlElementProperty: 'IsControlElementProperty',
PropertyId.IsCustomNavigationPatternAvailableProperty: 'IsCustomNavigationPatternAvailableProperty',
PropertyId.IsDataValidForFormProperty: 'IsDataValidForFormProperty',
PropertyId.IsDockPatternAvailableProperty: 'IsDockPatternAvailableProperty',
PropertyId.IsDragPatternAvailableProperty: 'IsDragPatternAvailableProperty',
PropertyId.IsDropTargetPatternAvailableProperty: 'IsDropTargetPatternAvailableProperty',
PropertyId.IsEnabledProperty: 'IsEnabledProperty',
PropertyId.IsExpandCollapsePatternAvailableProperty: 'IsExpandCollapsePatternAvailableProperty',
PropertyId.IsGridItemPatternAvailableProperty: 'IsGridItemPatternAvailableProperty',
PropertyId.IsGridPatternAvailableProperty: 'IsGridPatternAvailableProperty',
PropertyId.IsInvokePatternAvailableProperty: 'IsInvokePatternAvailableProperty',
PropertyId.IsItemContainerPatternAvailableProperty: 'IsItemContainerPatternAvailableProperty',
PropertyId.IsKeyboardFocusableProperty: 'IsKeyboardFocusableProperty',
PropertyId.IsLegacyIAccessiblePatternAvailableProperty: 'IsLegacyIAccessiblePatternAvailableProperty',
PropertyId.IsMultipleViewPatternAvailableProperty: 'IsMultipleViewPatternAvailableProperty',
PropertyId.IsObjectModelPatternAvailableProperty: 'IsObjectModelPatternAvailableProperty',
PropertyId.IsOffscreenProperty: 'IsOffscreenProperty',
PropertyId.IsPasswordProperty: 'IsPasswordProperty',
PropertyId.IsPeripheralProperty: 'IsPeripheralProperty',
PropertyId.IsRangeValuePatternAvailableProperty: 'IsRangeValuePatternAvailableProperty',
PropertyId.IsRequiredForFormProperty: 'IsRequiredForFormProperty',
PropertyId.IsScrollItemPatternAvailableProperty: 'IsScrollItemPatternAvailableProperty',
PropertyId.IsScrollPatternAvailableProperty: 'IsScrollPatternAvailableProperty',
PropertyId.IsSelectionItemPatternAvailableProperty: 'IsSelectionItemPatternAvailableProperty',
PropertyId.IsSelectionPattern2AvailableProperty: 'IsSelectionPattern2AvailableProperty',
PropertyId.IsSelectionPatternAvailableProperty: 'IsSelectionPatternAvailableProperty',
PropertyId.IsSpreadsheetItemPatternAvailableProperty: 'IsSpreadsheetItemPatternAvailableProperty',
PropertyId.IsSpreadsheetPatternAvailableProperty: 'IsSpreadsheetPatternAvailableProperty',
PropertyId.IsStylesPatternAvailableProperty: 'IsStylesPatternAvailableProperty',
PropertyId.IsSynchronizedInputPatternAvailableProperty: 'IsSynchronizedInputPatternAvailableProperty',
PropertyId.IsTableItemPatternAvailableProperty: 'IsTableItemPatternAvailableProperty',
PropertyId.IsTablePatternAvailableProperty: 'IsTablePatternAvailableProperty',
PropertyId.IsTextChildPatternAvailableProperty: 'IsTextChildPatternAvailableProperty',
PropertyId.IsTextEditPatternAvailableProperty: 'IsTextEditPatternAvailableProperty',
PropertyId.IsTextPattern2AvailableProperty: 'IsTextPattern2AvailableProperty',
PropertyId.IsTextPatternAvailableProperty: 'IsTextPatternAvailableProperty',
PropertyId.IsTogglePatternAvailableProperty: 'IsTogglePatternAvailableProperty',
PropertyId.IsTransformPattern2AvailableProperty: 'IsTransformPattern2AvailableProperty',
PropertyId.IsTransformPatternAvailableProperty: 'IsTransformPatternAvailableProperty',
PropertyId.IsValuePatternAvailableProperty: 'IsValuePatternAvailableProperty',
PropertyId.IsVirtualizedItemPatternAvailableProperty: 'IsVirtualizedItemPatternAvailableProperty',
PropertyId.IsWindowPatternAvailableProperty: 'IsWindowPatternAvailableProperty',
PropertyId.ItemStatusProperty: 'ItemStatusProperty',
PropertyId.ItemTypeProperty: 'ItemTypeProperty',
PropertyId.LabeledByProperty: 'LabeledByProperty',
PropertyId.LandmarkTypeProperty: 'LandmarkTypeProperty',
PropertyId.LegacyIAccessibleChildIdProperty: 'LegacyIAccessibleChildIdProperty',
PropertyId.LegacyIAccessibleDefaultActionProperty: 'LegacyIAccessibleDefaultActionProperty',
PropertyId.LegacyIAccessibleDescriptionProperty: 'LegacyIAccessibleDescriptionProperty',
PropertyId.LegacyIAccessibleHelpProperty: 'LegacyIAccessibleHelpProperty',
PropertyId.LegacyIAccessibleKeyboardShortcutProperty: 'LegacyIAccessibleKeyboardShortcutProperty',
PropertyId.LegacyIAccessibleNameProperty: 'LegacyIAccessibleNameProperty',
PropertyId.LegacyIAccessibleRoleProperty: 'LegacyIAccessibleRoleProperty',
PropertyId.LegacyIAccessibleSelectionProperty: 'LegacyIAccessibleSelectionProperty',
PropertyId.LegacyIAccessibleStateProperty: 'LegacyIAccessibleStateProperty',
PropertyId.LegacyIAccessibleValueProperty: 'LegacyIAccessibleValueProperty',
PropertyId.LevelProperty: 'LevelProperty',
PropertyId.LiveSettingProperty: 'LiveSettingProperty',
PropertyId.LocalizedControlTypeProperty: 'LocalizedControlTypeProperty',
PropertyId.LocalizedLandmarkTypeProperty: 'LocalizedLandmarkTypeProperty',
PropertyId.MultipleViewCurrentViewProperty: 'MultipleViewCurrentViewProperty',
PropertyId.MultipleViewSupportedViewsProperty: 'MultipleViewSupportedViewsProperty',
PropertyId.NameProperty: 'NameProperty',
PropertyId.NativeWindowHandleProperty: 'NativeWindowHandleProperty',
PropertyId.OptimizeForVisualContentProperty: 'OptimizeForVisualContentProperty',
PropertyId.OrientationProperty: 'OrientationProperty',
PropertyId.OutlineColorProperty: 'OutlineColorProperty',
PropertyId.OutlineThicknessProperty: 'OutlineThicknessProperty',
PropertyId.PositionInSetProperty: 'PositionInSetProperty',
PropertyId.ProcessIdProperty: 'ProcessIdProperty',
PropertyId.ProviderDescriptionProperty: 'ProviderDescriptionProperty',
PropertyId.RangeValueIsReadOnlyProperty: 'RangeValueIsReadOnlyProperty',
PropertyId.RangeValueLargeChangeProperty: 'RangeValueLargeChangeProperty',
PropertyId.RangeValueMaximumProperty: 'RangeValueMaximumProperty',
PropertyId.RangeValueMinimumProperty: 'RangeValueMinimumProperty',
PropertyId.RangeValueSmallChangeProperty: 'RangeValueSmallChangeProperty',
PropertyId.RangeValueValueProperty: 'RangeValueValueProperty',
PropertyId.RotationProperty: 'RotationProperty',
PropertyId.RuntimeIdProperty: 'RuntimeIdProperty',
PropertyId.ScrollHorizontalScrollPercentProperty: 'ScrollHorizontalScrollPercentProperty',
PropertyId.ScrollHorizontalViewSizeProperty: 'ScrollHorizontalViewSizeProperty',
PropertyId.ScrollHorizontallyScrollableProperty: 'ScrollHorizontallyScrollableProperty',
PropertyId.ScrollVerticalScrollPercentProperty: 'ScrollVerticalScrollPercentProperty',
PropertyId.ScrollVerticalViewSizeProperty: 'ScrollVerticalViewSizeProperty',
PropertyId.ScrollVerticallyScrollableProperty: 'ScrollVerticallyScrollableProperty',
PropertyId.Selection2CurrentSelectedItemProperty: 'Selection2CurrentSelectedItemProperty',
PropertyId.Selection2FirstSelectedItemProperty: 'Selection2FirstSelectedItemProperty',
PropertyId.Selection2ItemCountProperty: 'Selection2ItemCountProperty',
PropertyId.Selection2LastSelectedItemProperty: 'Selection2LastSelectedItemProperty',
PropertyId.SelectionCanSelectMultipleProperty: 'SelectionCanSelectMultipleProperty',
PropertyId.SelectionIsSelectionRequiredProperty: 'SelectionIsSelectionRequiredProperty',
PropertyId.SelectionItemIsSelectedProperty: 'SelectionItemIsSelectedProperty',
PropertyId.SelectionItemSelectionContainerProperty: 'SelectionItemSelectionContainerProperty',
PropertyId.SelectionSelectionProperty: 'SelectionSelectionProperty',
PropertyId.SizeOfSetProperty: 'SizeOfSetProperty',
PropertyId.SizeProperty: 'SizeProperty',
PropertyId.SpreadsheetItemAnnotationObjectsProperty: 'SpreadsheetItemAnnotationObjectsProperty',
PropertyId.SpreadsheetItemAnnotationTypesProperty: 'SpreadsheetItemAnnotationTypesProperty',
PropertyId.SpreadsheetItemFormulaProperty: 'SpreadsheetItemFormulaProperty',
PropertyId.StylesExtendedPropertiesProperty: 'StylesExtendedPropertiesProperty',
PropertyId.StylesFillColorProperty: 'StylesFillColorProperty',
PropertyId.StylesFillPatternColorProperty: 'StylesFillPatternColorProperty',
PropertyId.StylesFillPatternStyleProperty: 'StylesFillPatternStyleProperty',
PropertyId.StylesShapeProperty: 'StylesShapeProperty',
PropertyId.StylesStyleIdProperty: 'StylesStyleIdProperty',
PropertyId.StylesStyleNameProperty: 'StylesStyleNameProperty',
PropertyId.TableColumnHeadersProperty: 'TableColumnHeadersProperty',
PropertyId.TableItemColumnHeaderItemsProperty: 'TableItemColumnHeaderItemsProperty',
PropertyId.TableItemRowHeaderItemsProperty: 'TableItemRowHeaderItemsProperty',
PropertyId.TableRowHeadersProperty: 'TableRowHeadersProperty',
PropertyId.TableRowOrColumnMajorProperty: 'TableRowOrColumnMajorProperty',
PropertyId.ToggleToggleStateProperty: 'ToggleToggleStateProperty',
PropertyId.Transform2CanZoomProperty: 'Transform2CanZoomProperty',
PropertyId.Transform2ZoomLevelProperty: 'Transform2ZoomLevelProperty',
PropertyId.Transform2ZoomMaximumProperty: 'Transform2ZoomMaximumProperty',
PropertyId.Transform2ZoomMinimumProperty: 'Transform2ZoomMinimumProperty',
PropertyId.TransformCanMoveProperty: 'TransformCanMoveProperty',
PropertyId.TransformCanResizeProperty: 'TransformCanResizeProperty',
PropertyId.TransformCanRotateProperty: 'TransformCanRotateProperty',
PropertyId.ValueIsReadOnlyProperty: 'ValueIsReadOnlyProperty',
PropertyId.ValueValueProperty: 'ValueValueProperty',
PropertyId.VisualEffectsProperty: 'VisualEffectsProperty',
PropertyId.WindowCanMaximizeProperty: 'WindowCanMaximizeProperty',
PropertyId.WindowCanMinimizeProperty: 'WindowCanMinimizeProperty',
PropertyId.WindowIsModalProperty: 'WindowIsModalProperty',
PropertyId.WindowIsTopmostProperty: 'WindowIsTopmostProperty',
PropertyId.WindowWindowInteractionStateProperty: 'WindowWindowInteractionStateProperty',
PropertyId.WindowWindowVisualStateProperty: 'WindowWindowVisualStateProperty',
}
class AccessibleRole:
"""
AccessibleRole from IUIAutomation.
Refer https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.accessiblerole?view=netframework-4.8
"""
TitleBar = 0x1
MenuBar = 0x2
ScrollBar = 0x3
Grip = 0x4
Sound = 0x5
Cursor = 0x6
Caret = 0x7
Alert = 0x8
Window = 0x9
Client = 0xa
MenuPopup = 0xb
MenuItem = 0xc
ToolTip = 0xd
Application = 0xe
Document = 0xf
Pane = 0x10
Chart = 0x11
Dialog = 0x12
Border = 0x13
Grouping = 0x14
Separator = 0x15
Toolbar = 0x16
StatusBar = 0x17
Table = 0x18
ColumnHeader = 0x19
RowHeader = 0x1a
Column = 0x1b
Row = 0x1c
Cell = 0x1d
Link = 0x1e
HelpBalloon = 0x1f
Character = 0x20
List = 0x21
ListItem = 0x22
Outline = 0x23
OutlineItem = 0x24
PageTab = 0x25
PropertyPage = 0x26
Indicator = 0x27
Graphic = 0x28
StaticText = 0x29
Text = 0x2a
PushButton = 0x2b
CheckButton = 0x2c
RadioButton = 0x2d
ComboBox = 0x2e
DropList = 0x2f
ProgressBar = 0x30
Dial = 0x31
HotkeyField = 0x32
Slider = 0x33
SpinButton = 0x34
Diagram = 0x35
Animation = 0x36
Equation = 0x37
ButtonDropDown = 0x38
ButtonMenu = 0x39
ButtonDropDownGrid = 0x3a
WhiteSpace = 0x3b
PageTabList = 0x3c
Clock = 0x3d
SplitButton = 0x3e
IpAddress = 0x3f
OutlineButton = 0x40
class AccessibleState():
"""
AccessibleState from IUIAutomation.
Refer https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.accessiblestates?view=netframework-4.8
"""
Normal = 0
Unavailable = 0x1
Selected = 0x2
Focused = 0x4
Pressed = 0x8
Checked = 0x10
Mixed = 0x20
Indeterminate = 0x20
ReadOnly = 0x40
HotTracked = 0x80
Default = 0x100
Expanded = 0x200
Collapsed = 0x400
Busy = 0x800
Floating = 0x1000
Marqueed = 0x2000
Animated = 0x4000
Invisible = 0x8000
Offscreen = 0x10000
Sizeable = 0x20000
Moveable = 0x40000
SelfVoicing = 0x80000
Focusable = 0x100000
Selectable = 0x200000
Linked = 0x400000
Traversed = 0x800000
MultiSelectable = 0x1000000
ExtSelectable = 0x2000000
AlertLow = 0x4000000
AlertMedium = 0x8000000
AlertHigh = 0x10000000
Protected = 0x20000000
Valid = 0x7fffffff
HasPopup = 0x40000000
class AccessibleSelection:
"""
AccessibleSelection from IUIAutomation.
Refer https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.accessibleselection?view=netframework-4.8
"""
None_ = 0
TakeFocus = 0x1
TakeSelection = 0x2
ExtendSelection = 0x4
AddSelection = 0x8
RemoveSelection = 0x10
class AnnotationType:
"""
AnnotationType from IUIAutomation.
Refer https://docs.microsoft.com/en-us/windows/win32/winauto/uiauto-annotation-type-identifiers
"""
AdvancedProofingIssue = 60020
Author = 60019
CircularReferenceError = 60022
Comment = 60003
ConflictingChange = 60018
DataValidationError = 60021
DeletionChange = 60012
EditingLockedChange = 60016
Endnote = 60009
ExternalChange = 60017
Footer = 60007
Footnote = 60010
FormatChange = 60014
FormulaError = 60004
GrammarError = 60002
Header = 60006
Highlighted = 60008
InsertionChange = 60011
Mathematics = 60023
MoveChange = 60013
SpellingError = 60001
TrackChanges = 60005
Unknown = 60000
UnsyncedChange = 60015
class NavigateDirection:
"""
NavigateDirection from IUIAutomation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-navigatedirection
"""
Parent = 0
NextSibling = 1
PreviousSibling = 2
FirstChild = 3
LastChild = 4
class DockPosition:
"""
DockPosition from IUIAutomation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-dockposition
"""
Top = 0
Left = 1
Bottom = 2
Right = 3
Fill = 4
None_ = 5
class ScrollAmount:
"""
ScrollAmount from IUIAutomation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-scrollamount
"""
LargeDecrement = 0
SmallDecrement = 1
NoAmount = 2
LargeIncrement = 3
SmallIncrement = 4
class StyleId:
"""
StyleId from IUIAutomation.
Refer https://docs.microsoft.com/en-us/windows/win32/winauto/uiauto-style-identifiers
"""
Custom = 70000
Heading1 = 70001
Heading2 = 70002
Heading3 = 70003
Heading4 = 70004
Heading5 = 70005
Heading6 = 70006
Heading7 = 70007
Heading8 = 70008
Heading9 = 70009
Title = 70010
Subtitle = 70011
Normal = 70012
Emphasis = 70013
Quote = 70014
BulletedList = 70015
NumberedList = 70016
class RowOrColumnMajor:
"""
RowOrColumnMajor from IUIAutomation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-roworcolumnmajor
"""
RowMajor = 0
ColumnMajor = 1
Indeterminate = 2
class ExpandCollapseState:
"""
ExpandCollapseState from IUIAutomation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-expandcollapsestate
"""
Collapsed = 0
Expanded = 1
PartiallyExpanded = 2
LeafNode = 3
class OrientationType:
"""
OrientationType from IUIAutomation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-orientationtype
"""
None_ = 0
Horizontal = 1
Vertical = 2
class ToggleState:
"""
ToggleState from IUIAutomation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-togglestate
"""
Off = 0
On = 1
Indeterminate = 2
class TextPatternRangeEndpoint:
"""
TextPatternRangeEndpoint from IUIAutomation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-textpatternrangeendpoint
"""
Start = 0
End = 1
class TextAttributeId:
"""
TextAttributeId from IUIAutomation.
Refer https://docs.microsoft.com/en-us/windows/win32/winauto/uiauto-textattribute-ids
"""
AfterParagraphSpacingAttribute = 40042
AnimationStyleAttribute = 40000
AnnotationObjectsAttribute = 40032
AnnotationTypesAttribute = 40031
BackgroundColorAttribute = 40001
BeforeParagraphSpacingAttribute = 40041
BulletStyleAttribute = 40002
CapStyleAttribute = 40003
CaretBidiModeAttribute = 40039
CaretPositionAttribute = 40038
CultureAttribute = 40004
FontNameAttribute = 40005
FontSizeAttribute = 40006
FontWeightAttribute = 40007
ForegroundColorAttribute = 40008
HorizontalTextAlignmentAttribute = 40009
IndentationFirstLineAttribute = 40010
IndentationLeadingAttribute = 40011
IndentationTrailingAttribute = 40012
IsActiveAttribute = 40036
IsHiddenAttribute = 40013
IsItalicAttribute = 40014
IsReadOnlyAttribute = 40015
IsSubscriptAttribute = 40016
IsSuperscriptAttribute = 40017
LineSpacingAttribute = 40040
LinkAttribute = 40035
MarginBottomAttribute = 40018
MarginLeadingAttribute = 40019
MarginTopAttribute = 40020
MarginTrailingAttribute = 40021
OutlineStylesAttribute = 40022
OverlineColorAttribute = 40023
OverlineStyleAttribute = 40024
SayAsInterpretAsAttribute = 40043
SelectionActiveEndAttribute = 40037
StrikethroughColorAttribute = 40025
StrikethroughStyleAttribute = 40026
StyleIdAttribute = 40034
StyleNameAttribute = 40033
TabsAttribute = 40027
TextFlowDirectionsAttribute = 40028
UnderlineColorAttribute = 40029
UnderlineStyleAttribute = 40030
class TextUnit:
"""
TextUnit from IUIAutomation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationcore/ne-uiautomationcore-textunit
"""
Character = 0
Format = 1
Word = 2
Line = 3
Paragraph = 4
Page = 5