-
Notifications
You must be signed in to change notification settings - Fork 1
/
UISimpleWrappers.au3
1440 lines (1241 loc) · 65.2 KB
/
UISimpleWrappers.au3
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
#include-once
; #INDEX# =======================================================================================================================
; Title .........: UI Simple Wrappers
; AutoIt Version : 3.3.14.5
; UDF Version ...: 0.0.0.1
; Language ......: English
; Description ...: A collection of functions for using UI Automation. Simply.
; Author(s) .....: Seadoggie01
; Modified.......: 20210120 (YYYYMMDD)
; Contributors ..: LarsJ (this is based almost entirely off of his examples)
; junkew (without his UDF, I never would've attempted this)
; Resources .....:
; ===============================================================================================================================
#include <CUIAutomation2.au3> ; This needs to be downloaded elsewhere. I've used the version available here --> https://www.autoitscript.com/forum/topic/201683-ui-automation-udfs/
; #include <UIAWrappers.au3> ; This was here for my reference (with TreeView scope(?). I still don't quite get them)
; Currently supported property values for text parsing: Bool, Type, Class, Name, ID, AccessKey, AcceleratorKey, LegacyIAccessibleState
; See __UIW_ParsePropertyCondition for more info
#CS
This has been a long journey. It all started with a program that default AutoIt functions couldn't handle. I started trying to use junkew's UDF,
but I was too new to AutoIt and too impatient. When I didn't get results fast enough, I switched to Mouse* functions. Later, I returned to find
LarsJ's examples. I was confused how his code was so different, but I gave it a shot. I got a couple things working, but I hated pointer variables.
This UDF stems from my hatred of pointers. Yeah. After I started getting things working, I noticed the repetitiveness of the code. Then I got
the idea to start combining some of the conditions into simpler terms. I realized the AutoIt methods made a lot of sense, so I modeled it after
them. Hopefully, you find this UDF helpful, enlighning, and/or hysterical.
-- Seadoggie01
P.S. Like with all my code, steal it, break it, warp it, just don't pretend it's yours... unless it's broken... then it's all yours!
Remarks:
* This looks like a TON of functions, I know. However, a lot of these are shortcuts for _UIW_PropertyCondition. They just specify the $UIA_PropertyId for you.
AND most of the functions accept a string instead of a control, skipping these functions entirely. Again, see examples!
* Because of the compound nature of some of these functions, I've implemented the function _UIW_ErrorStack. This contains the name and error from each function
The stack is only ever cleared by YOU! It returns an array of [[function, error]], which you can pass to _ArrayDisplay to track down errors. Hopefully, I can
ditch this in the future, as I hate it now.
* The global UI Automation object is used when a string is passed to a function instead of a condition. This allows me to build a condition from the string.
See Examples. The object is only set when _UIW_Create is called, so it's a good idea (mandatory?) to use this function first.
* I don't think I implemented nearly enough error handlers in these functions (I got bored), so a global error handler probably isn't a bad idea
#CE
Global $__g_oUIAutomation
#Region ### Global Consts ###
Global Const $UIW_IAccessible[2] = [$sIID_IAccessible, $dtagIAccessible]
Global Const $UIW_IRawElementProviderSimple[2] = [$sIID_IRawElementProviderSimple, $dtagIRawElementProviderSimple]
Global Const $UIW_Automation[2] = [$sIID_IUIAutomation, $dtagIUIAutomation]
Global Const $UIW_AndCondition[2] = [$sIID_IUIAutomationAndCondition, $dtagIUIAutomationAndCondition]
Global Const $UIW_BoolCondition[2] = [$sIID_IUIAutomationBoolCondition, $dtagIUIAutomationBoolCondition]
Global Const $UIW_CacheRequest[2] = [$sIID_IUIAutomationCacheRequest, $dtagIUIAutomationCacheRequest]
Global Const $UIW_Condition[2] = [$sIID_IUIAutomationCondition, $dtagIUIAutomationCondition]
Global Const $UIW_DockPattern[3] = [$sIID_IUIAutomationDockPattern, $dtagIUIAutomationDockPattern, $UIA_DockPatternId]
Global Const $UIW_Element[2] = [$sIID_IUIAutomationElement, $dtagIUIAutomationElement]
Global Const $UIW_ElementArray[2] = [$sIID_IUIAutomationElementArray, $dtagIUIAutomationElementArray]
Global Const $UIW_EventHandler[2] = [$sIID_IUIAutomationEventHandler, $dtagIUIAutomationEventHandler]
Global Const $UIW_ExpandCollapsePattern[3] = [$sIID_IUIAutomationExpandCollapsePattern, $dtagIUIAutomationExpandCollapsePattern, $UIA_ExpandCollapsePatternId]
Global Const $UIW_ExpandCollapseState[3] = [$sIID_IUIAutomationExpandCollapsePattern, $dtagIUIAutomationExpandCollapsePattern, $UIA_ExpandCollapsePatternId]
Global Const $UIW_FocusChangedEventHandler[2] = [$sIID_IUIAutomationFocusChangedEventHandler, $dtagIUIAutomationFocusChangedEventHandler]
Global Const $UIW_GridItemPattern[3] = [$sIID_IUIAutomationGridItemPattern, $dtagIUIAutomationGridItemPattern, $UIA_GridItemPatternId]
Global Const $UIW_GridPattern[3] = [$sIID_IUIAutomationGridPattern, $dtagIUIAutomationGridPattern, $UIA_GridPatternId]
Global Const $UIW_InvokePattern[3] = [$sIID_IUIAutomationInvokePattern, $dtagIUIAutomationInvokePattern, $UIA_InvokePatternId]
Global Const $UIW_ItemContainerPattern[3] = [$sIID_IUIAutomationItemContainerPattern, $dtagIUIAutomationItemContainerPattern, $UIA_ItemContainerPatternId]
Global Const $UIW_LegacyIAccessiblePattern[3] = [$sIID_IUIAutomationLegacyIAccessiblePattern, $dtagIUIAutomationLegacyIAccessiblePattern, $UIA_LegacyIAccessiblePatternId]
Global Const $UIW_MultipleViewPattern[3] = [$sIID_IUIAutomationMultipleViewPattern, $dtagIUIAutomationMultipleViewPattern, $UIA_MultipleViewPatternId]
Global Const $UIW_NotCondition[2] = [$sIID_IUIAutomationNotCondition, $dtagIUIAutomationNotCondition]
Global Const $UIW_OrCondition[2] = [$sIID_IUIAutomationOrCondition, $dtagIUIAutomationOrCondition]
Global Const $UIW_PropertyChangedEventHandler[2] = [$sIID_IUIAutomationPropertyChangedEventHandler, $dtagIUIAutomationPropertyChangedEventHandler]
Global Const $UIW_PropertyCondition[2] = [$sIID_IUIAutomationPropertyCondition, $dtagIUIAutomationPropertyCondition]
Global Const $UIW_ProxyFactory[2] = [$sIID_IUIAutomationProxyFactory, $dtagIUIAutomationProxyFactory]
Global Const $UIW_ProxyFactoryEntry[2] = [$sIID_IUIAutomationProxyFactoryEntry, $dtagIUIAutomationProxyFactoryEntry]
Global Const $UIW_ProxyFactoryMapping[2] = [$sIID_IUIAutomationProxyFactoryMapping, $dtagIUIAutomationProxyFactoryMapping]
Global Const $UIW_RangeValuePattern[3] = [$sIID_IUIAutomationRangeValuePattern, $dtagIUIAutomationRangeValuePattern, $UIA_RangeValuePatternId]
Global Const $UIW_ScrollItemPattern[3] = [$sIID_IUIAutomationScrollItemPattern, $dtagIUIAutomationScrollItemPattern, $UIA_ScrollItemPatternId]
Global Const $UIW_ScrollPattern[3] = [$sIID_IUIAutomationScrollPattern, $dtagIUIAutomationScrollPattern, $UIA_ScrollPatternId]
Global Const $UIW_SelectionItemPattern[3] = [$sIID_IUIAutomationSelectionItemPattern, $dtagIUIAutomationSelectionItemPattern, $UIA_SelectionItemPatternId]
Global Const $UIW_SelectionPattern[3] = [$sIID_IUIAutomationSelectionPattern, $dtagIUIAutomationSelectionPattern, $UIA_SelectionPatternId]
Global Const $UIW_StructureChangedEventHandler[2] = [$sIID_IUIAutomationStructureChangedEventHandler, $dtagIUIAutomationStructureChangedEventHandler]
Global Const $UIW_SynchronizedInputPattern[3] = [$sIID_IUIAutomationSynchronizedInputPattern, $dtagIUIAutomationSynchronizedInputPattern, $UIA_SynchronizedInputPatternId]
Global Const $UIW_TableItemPattern[3] = [$sIID_IUIAutomationTableItemPattern, $dtagIUIAutomationTableItemPattern, $UIA_TableItemPatternId]
Global Const $UIW_TablePattern[3] = [$sIID_IUIAutomationTablePattern, $dtagIUIAutomationTablePattern, $UIA_TablePatternId]
Global Const $UIW_TextPattern[3] = [$sIID_IUIAutomationTextPattern, $dtagIUIAutomationTextPattern, $UIA_TextPatternId]
Global Const $UIW_TextRange[2] = [$sIID_IUIAutomationTextRange, $dtagIUIAutomationTextRange]
Global Const $UIW_TextRangeArray[2] = [$sIID_IUIAutomationTextRangeArray, $dtagIUIAutomationTextRangeArray]
Global Const $UIW_TogglePattern[3] = [$sIID_IUIAutomationTogglePattern, $dtagIUIAutomationTogglePattern, $UIA_TogglePatternId]
Global Const $UIW_TransformPattern[3] = [$sIID_IUIAutomationTransformPattern, $dtagIUIAutomationTransformPattern, $UIA_TransformPatternId]
Global Const $UIW_TreeWalker[2] = [$sIID_IUIAutomationTreeWalker, $dtagIUIAutomationTreeWalker]
Global Const $UIW_ValuePattern[3] = [$sIID_IUIAutomationValuePattern, $dtagIUIAutomationValuePattern, $UIA_ValuePatternId]
Global Const $UIW_VirtualizedItemPattern[3] = [$sIID_IUIAutomationVirtualizedItemPattern, $dtagIUIAutomationVirtualizedItemPattern, $UIA_VirtualizedItemPatternId]
Global Const $UIW_WindowPattern[3] = [$sIID_IUIAutomationWindowPattern, $dtagIUIAutomationWindowPattern, $UIA_WindowPatternId]
#EndRegion ### Global Consts ###
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_AcceleratorKey
; Description ...:
; Syntax ........: _UIW_AcceleratorKey($oUIAutomation, $sCondition)
; Parameters ....: $oUIAutomation - an object.
; $sCondition - a string value.
; Return values .: None
; Author ........: Seadoggie01
; Modified ......: June 1, 2020 (@14:55:10)
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_AcceleratorKeyPropertyCondition($oUIAutomation, $sCondition)
Local $ret = _UIW_PropertyCondition($oUIAutomation, $UIA_AcceleratorKeyPropertyId, $sCondition)
Return SetError(@error, @extended, $ret)
EndFunc ;==>_UIW_AcceleratorKeyPropertyCondition
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_AccessKeyPropery
; Description ...:
; Syntax ........: _UIW_AccessKeyPropery($oUIAutomation, $sCondition)
; Parameters ....: $oUIAutomation - an object.
; $sCondition - a string value.
; Return values .: None
; Author ........: Seadoggie01
; Modified ......: October 14, 2020
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_AccessKeyProperyCondition($oUIAutomation, $sCondition)
Local $ret = _UIW_PropertyCondition($oUIAutomation, $UIA_AccessKeyPropertyId, $sCondition)
Return SetError(@error, @extended, $ret)
EndFunc ;==>_UIW_AccessKeyProperyCondition
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_AutomationIdProperty
; Description ...:
; Syntax ........: _UIW_AutomationIdProperty($oUIAutomation, $sCondition)
; Parameters ....: $oUIAutomation - an object.
; $sCondition - a string value.
; Return values .: None
; Author ........: Seadoggie01
; Modified ......: October 14, 2020
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_AutomationIdPropertyCondition($oUIAutomation, $sCondition)
Local $ret = _UIW_PropertyCondition($oUIAutomation, $UIA_AutomationIdPropertyId, $sCondition)
Return SetError(@error, @extended, $ret)
EndFunc ;==>_UIW_AutomationIdPropertyCondition
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_BoolCondition
; Description ...: Creates a boolean condition for matching all or no elements
; Syntax ........: _UIW_BoolCondition($oUIAutomation, $bValue)
; Parameters ....: $oUIAutomation - an object.
; $bValue - a boolean value.
; Return values .: Success - A pointer to the requested bool condition
; Failure - False and sets @error = 1
; Author ........: Seadoggie01
; Modified ......: October 14, 2020
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_BoolCondition($oUIAutomation, $bValue)
If Not IsBool($bValue) Then $bValue = StringLower($bValue) = "true"
Local $pCondition
If $bValue Then
$oUIAutomation.CreateTrueCondition($pCondition)
Else
$oUIAutomation.CreateFalseCondition($pCondition)
EndIf
; If it's not a pointer
If Not $pCondition Then Return SetError(_UIW_ErrorStack(1, "_UIW_BoolCondition"), 0, False)
Return $pCondition
EndFunc ;==>_UIW_BoolCondition
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_BoundingRectangle
; Description ...: Gets the edges of a control. Useful for clicking.
; Syntax ........: _UIW_BoundingRectangle($oControl)
; Parameters ....: $oControl - an object.
; Return values .: Success - a bounding array
; Failure - False and sets @error = 1
; Author ........: Seadoggie01
; Modified ......: October 14, 2020
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_BoundingRectangle($oControl)
Local $aRect
$oControl.GetCurrentPropertyValue($UIA_BoundingRectanglePropertyId, $aRect)
If Not IsArray($aRect) Then Return SetError(_UIW_ErrorStack(1, "_UIW_BoundingRectangle"), 0, False)
Return $aRect
EndFunc ;==>_UIW_BoundingRectangle
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_ClassNameProperty
; Description ...: Creates a class name property from the supplied string
; Syntax ........: _UIW_ClassNameProperty($oUIAutomation, $sCondition)
; Parameters ....: $oUIAutomation - an object.
; $sCondition - a string value.
; Return values .: Success - A pointer to a class name property
; Failure -
; Author ........: Seadoggie01
; Modified ......: October 14, 2020
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_ClassNamePropertyCondition($oUIAutomation, $sCondition)
Local $ret = _UIW_PropertyCondition($oUIAutomation, $UIA_ClassNamePropertyId, $sCondition)
Return SetError(@error, @extended, $ret)
EndFunc ;==>_UIW_ClassNamePropertyCondition
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_ControlPattern
; Description ...: Gets the value of the specified Control pattern for the control
; Syntax ........: _UIW_ControlPattern($oControl, $iProperty)
; Parameters ....: $oControl - an object.
; $iProperty - an integer value.
; Return values .: Success - the value of the Control pattern
; Failure - False and sets @error:
; |1 - $oControl isn't an object
; |2 - COM Error: @extended is set to error
; Author ........: Seadoggie01 - December 4, 2019
; Modified ......: October 14, 2020
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_ControlPattern($oControl, $iProperty)
If Not __UIW_Param($oControl, "Object", "InterfaceDispatch") Then Return SetError(1, 0, False)
Local $iRet
$oControl.GetCurrentPropertyValue($iProperty, $iRet)
If @error Then Return SetError(2, @error, False)
Return $iRet
EndFunc ;==>_UIW_ControlPattern
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_ControlTypeProperty
; Description ...:
; Syntax ........: _UIW_ControlTypeProperty($oUIAutomation, $ControlTypeId)
; Parameters ....: $oUIAutomation - an object.
; $ControlTypeId - an unknown value.
; Return values .: None
; Author ........: Seadoggie01
; Modified ......: October 14, 2020
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_ControlTypePropertyCondition($oUIAutomation, $ControlTypeId)
Local $ret = _UIW_PropertyCondition($oUIAutomation, $UIA_ControlTypePropertyId, $ControlTypeId)
Return SetError(@error, @extended, $ret)
EndFunc ;==>_UIW_ControlTypePropertyCondition
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_Create
; Description ...: Gets a UIAutomation object
; Syntax ........: _UIW_Create()
; Parameters ....: None
; Return values .: Success - A UI Automation object
; Failure - False and sets @error to 1
; Author ........: Seadoggie01
; Modified ......: October 14, 2020
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_Create()
Local $oUIAutomation = ObjCreateInterface($sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation)
If Not IsObj($oUIAutomation) Then
_UIW_ErrorStack("_UIW_Create", 1)
Return SetError(1, 0, False)
EndIf
$__g_oUIAutomation = $oUIAutomation
Return $oUIAutomation
EndFunc ;==>_UIW_Create
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_CreateAndCondition
; Description ...:
; Syntax ........: _UIW_CreateAndCondition($oUIAutomation, $pCondition1, $pCondition2)
; Parameters ....: $oUIAutomation - an object.
; $pCondition1 - a pointer value.
; $pCondition2 - a pointer value.
; Return values .: Success - an AndCondtion
; Failure - False and Sets @error = 1
; Author ........: Seadoggie01
; Modified ......: October 14, 2020
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_CreateAndCondition($oUIAutomation, $pCondition1, $pCondition2)
Local $pRetCondition
$oUIAutomation.CreateAndCondition($pCondition1, $pCondition2, $pRetCondition)
If Not $pRetCondition Then
_UIW_ErrorStack(1, "_UIW_CreateAndCondition")
Return SetError(1, 0, False)
EndIf
Return $pRetCondition
EndFunc ;==>_UIW_CreateAndCondition
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_CreateAndConditionFromArray
; Description ...: Creates a single condition from an array of conditions
; Syntax ........: _UIW_CreateAndConditionFromArray($oUIAutomation, $aConditions)
; Parameters ....: $oUIAutomation - an object.
; $aConditions - an 0-based 1D array of conditions.
; Return values .: a condition that includes all conditions
; Author ........: Seadoggie01
; Modified ......: January 21, 2021
; Remarks .......: This is a cheap trick because I couldn't get it to work. It works though.
; This is useful when you need many conditions to find an object.
; Related .......: _UIW_CreateAndCondition
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_CreateAndConditionFromArray($oUIAutomation, $aConditions)
;#ToDo: Works, but check if performance benefit from using CreateAndConditionFromArray? @LarsJ
Local $pAndCondition = $aConditions[0]
For $i = 1 To UBound($aConditions) - 1
$pAndCondition = _UIW_CreateAndCondition($oUIAutomation, $pAndCondition, $aConditions[$i])
Next
Return $pAndCondition
EndFunc ;==>_UIW_CreateAndConditionFromArray
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_CreateOrCondition
; Description ...:
; Syntax ........: _UIW_CreateOrCondition($oUIAutomation, $pCondition1, $pCondition2)
; Parameters ....: $oUIAutomation - an object.
; $pCondition1 - a pointer value.
; $pCondition2 - a pointer value.
; Return values .: Success - an AndCondtion
; Failure - False and Sets @error = 1
; Author ........: Seadoggie01
; Modified ......: October 14, 2020
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_CreateOrCondition($oUIAutomation, $pCondition1, $pCondition2)
Local $pRetCondition
$oUIAutomation.CreateOrCondition($pCondition1, $pCondition2, $pRetCondition)
If Not $pRetCondition Then
_UIW_ErrorStack(1, "_UIW_CreateAndCondition")
Return SetError(1, 0, False)
EndIf
Return $pRetCondition
EndFunc ;==>_UIW_CreateOrCondition
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_ElementFromPoint
; Description ...: Gets the element underneath a point on the screen
; Syntax ........: _UIW_ElementFromPoint($oUIAutomation, $iX, $iY)
; Parameters ....: $oUIAutomation - an object.
; $iX - an integer value.
; $iY - an integer value.
; Return values .: Success - the element underneath the point
; Failure - False and sets @error:
; |3 - Unable to create element from point
; Author ........: Seadoggie01
; Modified ......: January 21, 2021
; Remarks .......: Not well tested... if at all. Use caution?
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_ElementFromPoint($oUIAutomation, $iX, $iY)
Local $tStructPoint = DllStructCreate("int x; int y")
DllStructSetData($tStructPoint, "x", $iX)
DllStructSetData($tStructPoint, "y", $iY)
Local $pElement
$oUIAutomation.GetElementFromPoint($tStructPoint, $pElement)
Local $oElement = ObjCreateInterface($pElement, $sIID_IUIAutomationElement, $dtagIUIAutomationElement)
If Not IsObj($oElement) Then Return SetError(3, 0, False)
Return $oElement
EndFunc
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_ElementProperty
; Description ...: Gets the property of an element
; Syntax ........: _UIW_ElementProperty($oElement, $sProperty)
; Parameters ....: $oElement - an object.
; $sProperty - the property name to get.
; Return values .: Success - The requested property value
; Failure - False and sets @error:
; |1 - $oElement isn't an Object
; |2 - Unsupported Property name
; |3 - COM Error and sets @extended = COM error
; Author ........: Seadoggie01
; Modified ......: January 21, 2021
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_ElementProperty($oElement, $sProperty)
If Not __UIW_Param($oElement, "Object", "InterfaceDispatch") Then
_UIW_ErrorStack(1, "_UIW_ElementProperty")
Return SetError(1, 0, False)
EndIf
Local $vRet = ""
Local $hErr = __UIW_ErrHnd()
#forceref $hErr
Switch StringLower($sProperty)
Case "acceleratorkey"
$oElement.CurrentAcceleratorKey($vRet)
Case "accesskey"
$oElement.CurrentAccessKey($vRet)
Case "ariaproperties"
$oElement.CurrentAriaProperties($vRet)
Case "ariarole"
$oElement.CurrentAriaRole($vRet)
Case "automationid"
$oElement.CurrentAutomationId($vRet)
Case "boundingrectangle"
$oElement.CurrentBoundingRectangle($vRet)
Case "classname"
$oElement.CurrentClassName($vRet)
Case "controllerfor"
$oElement.CurrentControllerFor($vRet)
Case "controltype"
$oElement.CurrentControlType($vRet)
Case "culture"
$oElement.CurrentCulture($vRet)
Case "describedby"
$oElement.CurrentDescribedBy($vRet)
Case "flowsto"
$oElement.CurrentFlowsTo($vRet)
Case "frameworkid"
$oElement.CurrentFrameworkId($vRet)
Case "haskeyboardfocus"
$oElement.CurrentHasKeyboardFocus($vRet)
Case "helptext"
$oElement.CurrentHelpText($vRet)
Case "iscontentelement"
$oElement.CurrentIsContentElement($vRet)
Case "iscontrolelement"
$oElement.CurrentIsControlElement($vRet)
Case "isdatavalidforform"
$oElement.CurrentIsDataValidForForm($vRet)
Case "isenabled"
$oElement.CurrentIsEnabled($vRet)
Case "iskeyboardfocusable"
$oElement.CurrentIsKeyboardFocusable($vRet)
Case "isoffscreen"
$oElement.CurrentIsOffscreen($vRet)
Case "ispassword"
$oElement.CurrentIsPassword($vRet)
Case "isrequiredforform"
$oElement.CurrentIsRequiredForForm($vRet)
Case "itemstatus"
$oElement.CurrentItemStatus($vRet)
Case "itemtype"
$oElement.CurrentItemType($vRet)
Case "labeledby"
$oElement.CurrentLabeledBy($vRet)
Case "localizedcontroltype"
$oElement.CurrentLocalizedControlType($vRet)
Case "name"
$oElement.CurrentName($vRet)
Case "nativewindowhandle"
$oElement.CurrentNativeWindowHandle($vRet)
Case "orientation"
$oElement.CurrentOrientation($vRet)
Case "processid"
$oElement.CurrentProcessId($vRet)
Case "providerdescription"
$oElement.CurrentProviderDescription($vRet)
Case "getcurrentpattern"
$oElement.GetCurrentPattern($vRet)
Case "getcurrentpatternas"
$oElement.GetCurrentPatternAs($vRet)
Case "getcurrentpropertyvalue"
$oElement.GetCurrentPropertyValue($vRet)
Case "getcurrentpropertyvalueex"
$oElement.GetCurrentPropertyValueEx($vRet)
Case "runtimeid"
$oElement.GetRuntimeId($vRet)
Case Else
Return SetError(2, 0, False)
EndSwitch
If @error Then Return SetError(3, @error, False)
Return $vRet
EndFunc ;==>_UIW_ElementProperty
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_ErrorStack
; Description ...: Call this to get the stack of errors. Don't pass params to get the stack.
; Syntax ........: _UIW_ErrorStack([$iError = 0[, $sFunction = ""]])
; Parameters ....: $iError - [optional] an integer value. Default is 0.
; $sFunction - [optional] a string value. Default is "".
; Return values .: 0-Based 2D array of [Function Name, Error] in the order of occurance
; Author ........: Seadoggie01
; Modified ......: October 14, 2020
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_ErrorStack($iError = 0, $sFunction = "")
Static $aErrors[0]
If $iError = 0 Then
; Copy the errors
Local $aRet = $aErrors
; Clear the error stack
ReDim $aErrors[0]
; Return the error stack
Return $aRet
Else
ReDim $aErrors[UBound($aErrors) + 1]
$aErrors[UBound($aErrors) - 1] = $sFunction & ":" & $iError
Return $iError
EndIf
EndFunc ;==>_UIW_ErrorStack
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_ExpandCollapse
; Description ...: Expands or collapses a control
; Syntax ........: _UIW_ExpandCollapse($oControl[, $bExpand = True])
; Parameters ....: $oControl - an object.
; $bExpand - [optional] a boolean value. Default is True.
; Return values .: None
; Author ........: Seadoggie01
; Modified ......: October 14, 2020
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_ExpandCollapse($oControl, $bExpand = Default)
If $bExpand = Default Then $bExpand = True
Local $oExpand = _UIW_GetCurrentPattern($oControl, $UIW_ExpandCollapsePattern)
If @error Then Return SetError(1, 0, False)
If $bExpand Then
$oExpand.Expand()
Else
$oExpand.Collapse()
EndIf
If @error Then
SetError(2, @error)
_UIW_ErrorStack(2, "_UIW_ExpandCollapse")
Return False
EndIf
Return True
EndFunc ;==>_UIW_ExpandCollapse
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_FindAll
; Description ...: Finds all elements matching the condition
; Syntax ........: _UIW_FindAll($oParent, $vCondition[, $TreeScope = $TreeScope_Children])
; Parameters ....: $oParent - an object.
; $vCondition - a pointer value or a string to create a condtion with.
; $TreeScope - [optional] the scope of the search, a value of TreeScope. Default is $TreeScope_Children.
; Return values .: Success - an array of matching elements.
; Failue - False and sets @error:
; | 1 - $vCondtion isn't a pointer and couldn't be parsed
; | 2 - $oParent.FindAll returned no matches
; | 3 - $oParent isn't an object
; Author ........: Seadoggie01
; Modified ......: January 21, 2021
; Remarks .......:
; Related .......: _UIW_FindFirst
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_FindAll($oParent, $vCondition, $TreeScope = $TreeScope_Children)
If Not __UIW_Param($oParent, "Object", "InterfaceDispatch") Then
_UIW_ErrorStack(3, "_UIW_FindAll")
Return SetError(3, 0, False)
EndIf
$vCondition = __UIW_ParseCondition($__g_oUIAutomation, $vCondition)
If @error Then
_UIW_ErrorStack(1, "_UIW_FindAll")
Return SetError(1, 0, False)
EndIf
Local $pCollection
$oParent.FindAll($TreeScope, $vCondition, $pCollection)
Local $oCollection = ObjCreateInterface($pCollection, $sIID_IUIAutomationElementArray, $dtagIUIAutomationElementArray)
If Not IsObj($oCollection) Then Return SetError(_UIW_ErrorStack(2, "_UIW_FindAll"), 0, False)
Return __UIW_ElementArrayToArray($oCollection)
EndFunc ;==>_UIW_FindAll
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_FindFirst
; Description ...: Finds the first child matching the condition
; Syntax ........: _UIW_FindFirst($oParent, $vCondition[, $TreeScope = $TreeScope_Children])
; Parameters ....: $oParent - an object.
; $vCondition - a condition pointer or a string to be parsed.
; $TreeScope - [optional] the scope of the search, a value of TreeScope. Default is $TreeScope_Children.
; Return values .: Success - the first object matching the condition
; Failure - False and sets @error:
; | 1 - $oParent isn't an object
; | 2 - Can't parse string condition
; | 3 - No children found matching
; | 4 - Can't create object from child pointer
; | 5 - COM error. @extended = COM Error
; Author ........: Seadoggie01
; Modified ......: January 21, 2021
; Remarks .......:
; Related .......: _UIW_FindAll
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_FindFirst($oParent, $vCondition, $TreeScope = Default)
If Not IsObj($oParent) Then Return SetError(_UIW_ErrorStack(1, "_UIW_FindFirst"), @error, False)
If IsKeyword($TreeScope) Then $TreeScope = $TreeScope_Children
$vCondition = __UIW_ParseCondition($__g_oUIAutomation, $vCondition)
If @error Then Return SetError(2, @extended, _UIW_ErrorStack(2, "_UIW_FindFirst"))
Local $hErr = __UIW_ErrHnd()
#forceref $hErr
Local $pResult
$oParent.FindFirst($TreeScope, $vCondition, $pResult)
If @error Then Return SetError(_UIW_ErrorStack(5, "_UIW_FindFirst"), @error, False)
If Not $pResult Then Return SetError(_UIW_ErrorStack(3, "_UIW_FindFirst"), @error, False)
Local $oResult = ObjCreateInterface($pResult, $sIID_IUIAutomationElement, $dtagIUIAutomationElement)
If Not IsObj($oResult) Then Return SetError(_UIW_ErrorStack(4, "_UIW_FindFirst"), @error, False)
Return $oResult
EndFunc ;==>_UIW_FindFirst
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_GetCurrentPattern
; Description ...: Gets the pattern from an element
; Syntax ........: _UIW_GetCurrentPattern($oParent, $aPatternId)
; Parameters ....: $oParent - an object.
; $aPatternId - an array of unknowns.
; Return values .: Success - the pattern object
; Failure - False and sets @error:
; | 1 - $aPatternId isn't an array
; | 2 - $oParent isn't an object
; | 3 - $aPatternId is invalid for this $oParent
; Author ........: Seadoggie01
; Modified ......: October 14, 2020
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_GetCurrentPattern($oParent, $aPatternId)
Local $pValue, $oValue
If Not IsArray($aPatternId) Then
_UIW_ErrorStack(1, "_UIW_GetCurrentPattern")
Return SetError(1, 2, False)
EndIf
If Not IsObj($oParent) Then
_UIW_ErrorStack(2, "_UIW_GetCurrentPattern")
Return SetError(2, 0, False)
EndIf
$oParent.GetCurrentPattern($aPatternId[2], $pValue)
$oValue = ObjCreateInterface($pValue, $aPatternId[0], $aPatternId[1])
If Not IsObj($oValue) Then
_UIW_ErrorStack(3, "_UIW_GetCurrentPattern")
Return SetError(3, 0, False)
EndIf
Return $oValue
EndFunc ;==>_UIW_GetCurrentPattern
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_Invoke
; Description ...: Invokes a control
; Syntax ........: _UIW_Invoke($oControl)
; Parameters ....: $oControl - an object.
; Return values .: Success - True
; Failure - False and sets @error = 1
; Author ........: Seadoggie01
; Modified ......: October 14, 2020
; Remarks .......: Like clicking without the mouse
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_Invoke($oControl)
Local $oInvoke = _UIW_GetCurrentPattern($oControl, $UIW_InvokePattern)
If @error Then Return SetError(_UIW_ErrorStack(1, "_UIW_SetValue"), 0, False)
$oInvoke.Invoke()
EndFunc ;==>_UIW_Invoke
Func _UIW_LegacyIAccessibleStatePropertyCondition($oUIAutomation, $sCondition)
Local $ret = _UIW_PropertyCondition($oUIAutomation, $UIA_LegacyIAccessibleStatePropertyId, $sCondition)
Return SetError(@error, @extended, $ret)
EndFunc ;==>_UIW_LegacyIAccessibleStatePropertyCondition
Func _UIW_LegacyIAccessibleSelect($oControl)
Local $oSelect = _UIW_GetCurrentPattern($oControl, $UIW_LegacyIAccessiblePattern)
If @error Then Return SetError(1, 0, False)
$oSelect.Select(0x8)
EndFunc
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_MouseClick
; Description ...: Clicks on a control using the bounding rectange with $sButton
; Syntax ........: _UIW_MouseClick($oControl[, $sButton = Default[, $bBounce = Default]])
; Parameters ....: $oControl - an object.
; $sButton - [optional] button to click with. Default is "left".
; $bBounce - [optional] True to move mouse and return when finished. Default is True.
; Return values .: Success - True
; Failure - False and sets @error
; | 1 - Unable to get bounding rectange
; Author ........: LarsJ, Seadoggie01
; Modified ......: January 21, 2021
; Remarks .......: I created a mouse click bounce function which had an option for which button to use... I copied
; + LarJ's idea for hidding the mouse. This is a modification of both of our functions.
; It seems to not work in some locations on a multi-monitor setup (mine uses two differently sized screens)
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_MouseClick($oControl, $sButton = Default, $bBounce = Default)
If IsKeyword($sButton) Then $sButton = "left"
If IsKeyword($bBounce) Then $bBounce = True
; Get the edges of the control
Local $aBounds = _UIW_BoundingRectangle($oControl)
If @error Then Return SetError(_UIW_ErrorStack("_UIW_MouseClick", 1), 0, False)
; get the mouse's current position
Local $aMousePos = MouseGetPos()
; Hide the mouse
DllCall("user32.dll", "int", "ShowCursor", "bool", False)
; Trap the mouse at the specified location
__UIW_MouseTrap($aBounds[0] + $aBounds[2] / 2, $aBounds[1] + $aBounds[3] / 2, $aBounds[0] + $aBounds[2] / 2, $aBounds[1] + $aBounds[3] / 2)
; Perform the click
MouseClick($sButton, $aBounds[0] + $aBounds[2] / 2, $aBounds[1] + $aBounds[3] / 2, 1, 0)
; Release the trap
__UIW_MouseTrap()
; Move the mouse back
If $bBounce Then MouseMove($aMousePos[0], $aMousePos[1], 0)
; Show the mouse
DllCall("user32.dll", "int", "ShowCursor", "bool", True)
Return True
EndFunc ;==>_UIW_MouseClick
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_NameProperty
; Description ...:
; Syntax ........: _UIW_NameProperty($oUIAutomation, $sCondition)
; Parameters ....: $oUIAutomation - an object.
; $sCondition - a string value.
; Return values .: None
; Author ........: Seadoggie01
; Modified ......: October 14, 2020
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_NamePropertyCondition($oUIAutomation, $sCondition)
Local $ret = _UIW_PropertyCondition($oUIAutomation, $UIA_NamePropertyId, $sCondition)
Return SetError(@error, @extended, $ret)
EndFunc ;==>_UIW_NamePropertyCondition
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_ParseCondition
; Description ...: Depreciated
; Syntax ........:
; Parameters ....:
; Return values .:
; Author ........: Seadoggie01
; Modified ......: November 16, 2020
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_ParseCondition($oUIAutomation, $sProperties)
#forceref $oUIAutomation
__UIW_Debug("_UIW_ParseCondition: Depreciated Function! Pass properties string directly from now on.", "---> ")
Return $sProperties
EndFunc ;==>_UIW_ParseCondition
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_ParseObject
; Description ...: Depreciated
; Syntax ........:
; Parameters ....:
; Return values .:
; Author ........: Seadoggie01
; Modified ......: November 16, 2020
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_ParseObject($oUIAutomation, $oParent, $sProperties)
#forceref $oUIAutomation, $oParent
__UIW_Debug("_UIW_ParseObject: Depreciated function! Replace with _UIW_FindFirst()", "---> ")
Return $sProperties
EndFunc ;==>_UIW_ParseObject
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_PropertyCondition
; Description ...: Creates a property condition
; Syntax ........: _UIW_PropertyCondition($oUIAutomation, $UIA_PropertyId, $vCondition)
; Parameters ....: $oUIAutomation - an object.
; $UIA_PropertyId - a Property ID, see module UIA_PropertyIds in CUIAutomation2.
; $vCondition - a variant value.
; Return values .: Success - a pointer to the condition requested
; Failure - False and sets @error:
; |1 - Unable to create property condition, @extended set to COM error.
; Author ........: Seadoggie01
; Modified ......: October 14, 2020
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_PropertyCondition($oUIAutomation, $UIA_PropertyId, $vCondition)
Local $pCondition
$oUIAutomation.CreatePropertyCondition($UIA_PropertyId, $vCondition, $pCondition)
If $pCondition Then Return $pCondition
Return SetError(_UIW_ErrorStack(1, "_UIW_PropertyCondition - UIA Property: " & $UIA_PropertyId), @extended, False)
EndFunc ;==>_UIW_PropertyCondition
Func _UIW_RawViewWalker($oUIAutomation)
Local $pRawViewWalker
$oUIAutomation.RawViewWalker($pRawViewWalker)
Local $oTreeView = ObjCreateInterface($pRawViewWalker, $sIID_IUIAutomationTreeWalker, $dtagIUIAutomationTreeWalker)
If Not IsObj($oTreeView) Then Return SetError(_UIW_ErrorStack(1, "_UIW_RawViewWalker"), 0, False)
Return $oTreeView
EndFunc ;==>_UIW_RawViewWalker
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_RootObject
; Description ...: Gets the UI Automation desktop object
; Syntax ........: _UIW_RootObject($oUIAutomation)
; Parameters ....: $oUIAutomation - an object.
; Return values .: Success - the desktop object
; Failure - False and sets @error:
; | 1 - $oUIAutomation isn't an object
; | 2 - Unable to create $oDesktop
; Author ........: Seadoggie01
; Modified ......: October 14, 2020
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_RootObject($oUIAutomation)
If Not __UIW_Param($oUIAutomation, "Object", "InterfaceDispatch") Then Return SetError(_UIW_ErrorStack(1, "_UIW_RootObject"), 0, False)
Local $pDesktop, $oDesktop
; Get the root object, a pointer to the desktop
$oUIAutomation.GetRootElement($pDesktop)
$oDesktop = ObjCreateInterface($pDesktop, $sIID_IUIAutomationElement, $dtagIUIAutomationElement)
If Not IsObj($oDesktop) Then
_UIW_ErrorStack(2, "_UIW_RootObject")
Return SetError(2, 0, False)
EndIf
Return $oDesktop
EndFunc ;==>_UIW_RootObject
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_Select
; Description ...: Selects a control
; Syntax ........: _UIW_Select($oControl)
; Parameters ....: $oControl - an object.
; Return values .: None
; Author ........: Seadoggie01
; Modified ......: October 14, 2020
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_Select($oControl)
Local $oSelect = _UIW_GetCurrentPattern($oControl, $UIW_SelectionItemPattern)
If @error Then
_UIW_ErrorStack(1, "_UIW_Select")
Return SetError(1, 0, False)
EndIf
$oSelect.Select()
EndFunc ;==>_UIW_Select
; #FUNCTION# ====================================================================================================================
; Name ..........: _UIW_SetFocus
; Description ...: Sets the current focus to an element
; Syntax ........: _UIW_SetFocus($oElement)
; Parameters ....: $oElement - the element to use.
; Return values .: Success - True
; Failure - False and sets @error = 1
; Author ........: Seadoggie01
; Modified ......: October 14, 2020
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _UIW_SetFocus($oElement)
$oElement.SetFocus()
If @error Then
_UIW_ErrorStack(1, "_UIW_SetFocus")
Return SetError(1, 0, False)
EndIf
Return True
EndFunc ;==>_UIW_SetFocus
; #FUNCTION# ====================================================================================================================