├── CloneGui.ahk ├── README.md ├── Sample4.ahk ├── UIA.ahk ├── UIA2.ahk └── sample3.ahk /CloneGui.ahk: -------------------------------------------------------------------------------- 1 | #SingleInstance,force 2 | #Persistent 3 | #Include uia.ahk 4 | CoordMode,mouse,screen 5 | global $n:={} ; store tree node 6 | ,$u:=new IUIAutomation 7 | ,$e:=new IUIAutomationElement 8 | ,$c:=new IUIAutomationCondition 9 | ,$r:=new IUIAutomationCacheRequest 10 | ,$t:=new IUIAutomationTreeWalker 11 | 12 | global $x:=ComObjCreate("MSXML2.DOMDocument") 13 | $x.setProperty("SelectionLanguage","XPath") 14 | gui,1:add,TreeView,w300 h600 gtvevent 15 | gui,1:add,tab2,X+5 yp w500 +0x100,% " Info | Pool | Tree2Xml | Xml2AHK | Settings | Help " 16 | gui,1:tab,1 17 | gui,1:add,edit,w500 h580 X+0 Y+0 vedit1 ReadOnly -wrap HScroll 18 | return 19 | 20 | F8:: 21 | MouseGetPos,x,y,hwnd 22 | BuildElementTree(hwnd) 23 | gui,1:show 24 | return 25 | 26 | tvevent: 27 | if A_GuiEvent = S 28 | ShowSelection(TV_GetSelection()) 29 | return 30 | 31 | BuildElementTree(hwnd){ 32 | static init:=1,root,_r 33 | if init{ 34 | init:=0, root:=$u.5, $r.(_r:=$u.20).TreeScope:=7, t:={} 35 | loop 111 36 | t.Insert(29999+A_Index) 37 | $r.3(t) 38 | } 39 | for k,v in $n 40 | ObjRelease(v) 41 | $n:={}, TV_Delete() 42 | if $u.3(_e:=$u.10(hwnd,_r),root) 43 | return 44 | $n[id:=TV_Add($e.(_e).55)]:=_e 45 | ,((type:=$e.12(30003))=50009)||(type=50021)?AddNode(_e,id,1):AddNode(_e,id) 46 | ; AddChildren(_e,id) 47 | } 48 | AddNode(element,id,mode=0){ 49 | static init:=1,_r,_t 50 | if init{ 51 | init:=0,$t.(_t:=$u.16),$r.(_r:=$u.20).TreeScope:=1, t:={} 52 | loop 111 53 | t.Insert(29999+A_Index) 54 | $r.3(t) 55 | } 56 | if mode{ 57 | if (newElement:=$t.10(element,_r)){ 58 | $n[newId:=TV_Add("""" $e.(newElement).55 """ " $e.54,id)]:=newElement 59 | ,((type:=$e.12(30003))=50009)||(type=50021)?AddNode(newElement,newId,1):AddNode(newElement,newId) 60 | loop 61 | if (newElement:=$t.12(newElement,_r)) 62 | $n[newId:=TV_Add("""" $e.(newElement).55 """ " $e.54,id)]:=newElement 63 | ,((type:=$e.12(30003))=50009)||(type=50021)?AddNode(newElement,newId,1):AddNode(newElement,newId) 64 | else break 65 | } 66 | }else{ 67 | if !array:=$e.(element).19 68 | return 69 | loop % $e.(array).length() 70 | $n[newId:=TV_Add("""" $e.(newElement:=$e.(array).element(A_Index-1)).55 """ " $e.54,id)]:=newElement 71 | ,((type:=$e.12(30003))=50009)||(type=50021)?AddNode(newElement,newId,1):AddNode(newElement,newId) 72 | ObjRelease(array) 73 | } 74 | } 75 | AddChildren(element,id){ 76 | if !array:=$e.(element).19 77 | return 78 | loop % $e.(array).length() 79 | $n[newId:=TV_Add("""" $e.(newElement:=$e.(array).element(A_Index-1)).55 """ " $e.54,id)]:=newElement 80 | ,AddChildren(newElement,newId) 81 | ObjRelease(array) 82 | } 83 | AddRawNode(e,id,pid){ ; RawTreeWalker, slow speed 84 | static init:=1,_r,_t 85 | if init{ 86 | init:=0,$t.(_t:=$u.16),$r.(_r:=$u.20).TreeScope:=1, t:={} 87 | loop 111 88 | t.Insert(29999+A_Index) 89 | $r.3(t) 90 | } 91 | if ne:=$t.10(e,_r){ 92 | $n[nid:=TV_Add("""" $e.(ne).55 """ " $e.54,id)]:=ne 93 | AddRawNode(ne,nid,id) 94 | } 95 | if (pid!=0) && (ne:=$t.12(e,_r)){ 96 | $n[nid:=TV_Add("""" $e.(ne).55 """ " $e.54,pid)]:=ne 97 | AddRawNode(ne,nid,pid) 98 | } 99 | } 100 | ShowSelection(id){ 101 | global edit1 102 | $e.($n[id]) 103 | cont:="Name: " $e.12(30005) "`n" 104 | . "ControlType: " UIA_ControlType($e.12(30003)) "`n" ; 105 | . "LocalizedControlType: " $e.12(30004) "`n" ; 106 | . "BoundingRectangle: " BoundingRectangle($e.12(30001)) "`n" ; 107 | . "IsEnabled: " Bool($e.12(30010)) "`n" ; 108 | . "IsOffscreen: " Bool($e.12(30022)) "`n" ; 109 | . "IsKeyboardFocusable: " Bool($e.12(30009)) "`n" ; 110 | . "HasKeyboardFocus: " Bool($e.12(30008)) "`n" ; 111 | . "AccessKey: " $e.12(30007) "`n" ; 112 | . "ProcessId: " $e.12(30002) "`n" ; 113 | . "RuntimeId: " RuntimeId($e.12(30000)) "`n" ; 114 | . "AutomationId: " $e.12(30011) "`n" ; 115 | . "FrameworkId: " $e.12(30024) "`n" ; 116 | . "ClassName: " $e.12(30012) "`n" ; 117 | . "NativeWindowHandle: " $e.12(30020) "`n" ; 118 | . "IsContentElement: " Bool($e.12(30017)) "`n" ; 119 | . "ProviderDescription: " $e.12(30107) "`n" ; 120 | . "IsPassword: " Bool($e.12(30019)) "`n" ; 121 | . "HelpText: " $e.12(30013) "`n" ; 122 | cont.="IsDockPatternAvailable: " $e.12(30027) "`n" ; 123 | . "IsExpandCollapsePatternAvailable: " $e.12(30028) "`n" ; 124 | . "IsGridItemPatternAvailable: " $e.12(30029) "`n" ; 125 | . "IsGridPatternAvailable: " $e.12(30030) "`n" ; 126 | . "IsInvokePatternAvailable: " $e.12(30031) "`n" ; 127 | . "IsItemContainerPatternAvailable: " $e.12(30108) "`n" ; 128 | . "IsLegacyIAccessiblePatternAvailable:" $e.12(30090) "`n" ; 129 | . "IsMultipleViewPatternAvailable: " $e.12(30032) "`n" ; 130 | . "IsRangeValuePatternAvailable: " $e.12(30033) "`n" ; 131 | . "IsScrollItemPatternAvailable: " $e.12(30035) "`n" ; 132 | . "IsScrollPatternAvailable: " $e.12(30034) "`n" ; 133 | . "IsSelectionItemPatternAvailable: " $e.12(30036) "`n" ; 134 | . "IsSelectionPatternAvailable: " $e.12(30037) "`n" ; 135 | . "IsSynchronizedInputPatternAvailable:" $e.12(30110) "`n" ; 136 | . "IsTableItemPatternAvailable: " $e.12(30039) "`n" ; 137 | . "IsTablePatternAvailable: " $e.12(30038) "`n" ; 138 | . "IsTextPatternAvailable: " $e.12(30040) "`n" ; 139 | . "IsTogglePatternAvailable: " $e.12(30041) "`n" ; 140 | . "IsTransformPatternAvailable: " $e.12(30042) "`n" ; 141 | . "IsValuePatternAvailable: " $e.12(30043) "`n" ; 142 | . "IsVirtualizedItemPatternAvailable: " $e.12(30109) "`n" ; 143 | . "IsWindowPatternAvailable: " $e.12(30044) "`n" ; 144 | GuiControl,1:,edit1,% cont 145 | } 146 | ;; 147 | ;;Output Function 148 | ;; 149 | RuntimeId(p){ 150 | SetFormat,integer,hex 151 | VarSetCapacity(a,4) 152 | for k,v in p 153 | NumPut(v,a,"int") 154 | ,s.=SubStr(NumGet(a,"uint"),3) "." 155 | StringTrimRight,s,s,1 156 | SetFormat,integer,d 157 | return s 158 | } 159 | BoundingRectangle(t){ 160 | return (IsObject(t)?"l:" SubStr(t.1,1,InStr(t.1,".")-1) " t:" SubStr(t.2,1,InStr(t.2,".")-1) " w:" SubStr(t.3,1,InStr(t.3,".")-1) " h:" SubStr(t.4,1,InStr(t.4,".")-1):) 161 | } 162 | Bool(b){ 163 | return b?"True":"False" 164 | } 165 | ;; 166 | ;;Tree Functions 167 | ;; 168 | AnalysisTree(id){ 169 | $x.loadxml("") 170 | AnalysisNode(id) 171 | } 172 | AnalysisNode(id){ 173 | ; check Control Type 174 | if !newId:=TV_GetChild(id) 175 | return 176 | loop { 177 | ct:=$e.($n[newId]).12(30003) 178 | if (ct=50000){ ;Button 179 | 180 | }else if (ct=50001){ ;Calendar 181 | 182 | }else if (ct=50002){ ;CheckBox 183 | 184 | }else if (ct=50003){ ;ComboBox 185 | 186 | }else if (ct=50004){ ;Edit 187 | 188 | }else if (ct=50005){ ;link 189 | 190 | }else if (ct=50006){ ;Image 191 | 192 | }else if (ct=50007){ ;ListItem 193 | 194 | }else if (ct=50008){ ;ListView 195 | 196 | }else if (ct=50009){ ;Menu 197 | 198 | }else if (ct=50010){ ;MenuBar 199 | GetMenuBar(newId) 200 | }else if (ct=50011){ ;MenuItem 201 | 202 | }else if (ct=50012){ ;ProgressBar 203 | 204 | }else if (ct=50013){ ;Radio 205 | 206 | }else if (ct=50017){ ;StatusBar 207 | 208 | }else if (ct=50018){ ;Tab 209 | 210 | }else if (ct=50019){ ;Tab Item 211 | 212 | }else if (ct=50020){ ;Text 213 | 214 | }else if (ct=50021){ ;ToolBar 215 | 216 | }else if (ct=50023){ ;TreeView 217 | 218 | }else if (ct=50032){ ;Window 219 | 220 | }else if (ct=50033){ ;pane 221 | 222 | }else if (ct=50034){ ;Header 223 | 224 | }else if (ct=50035){ ;HeaderItem 225 | 226 | }else if (ct=50037){ ;TitleBar 227 | 228 | }else{ 229 | 230 | } 231 | 232 | if !newId:=TV_GetNext(newId) 233 | break 234 | } 235 | } 236 | 237 | Winget(id){ 238 | if !hwnd:=$e.($n[id]).12(30020) 239 | return 240 | SetFormat,integer,hex 241 | WinGet,style,style,ahk_id %hwnd% 242 | WinGet,exstyle,exstyle,ahk_id %hwnd% 243 | WinGetClass,class,ahk_id %hwnd% 244 | SetFormat,integer,d 245 | return {hwnd:hwnd,class:class,style:style,exstyle:exstyle} 246 | } 247 | 248 | GetMenuBar(id){ 249 | 250 | } 251 | ;; 252 | ;;xml to AHK code 253 | ;; 254 | xml2ahk(){ 255 | 256 | } 257 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | UIAutomation 2 | ============ 3 | 4 | Class-Wrapped UI Automation 5 | -------------------------------------------------------------------------------- /Sample4.ahk: -------------------------------------------------------------------------------- 1 | #SingleInstance,force 2 | #Persistent 3 | #Include uia.ahk 4 | CoordMode,mouse,screen 5 | global event 6 | ,$u:=new IUIAutomation 7 | ,$e:=new IUIAutomationElement 8 | ,$c:=new IUIAutomationCondition 9 | ,$r:=new IUIAutomationCacheRequest 10 | gui,add,TreeView,w300 h400 11 | gui,show 12 | return 13 | F8:: 14 | MouseGetPos,x,y,hwnd 15 | BuildElementTree(hwnd) 16 | return 17 | BuildElementTree(hwnd){ 18 | TV_Delete() 19 | $r.(_r:=$u.20).TreeScope:=7 20 | $r.3(30005),$r.3(30004) 21 | if $u.3(_e:=$u.10(hwnd,_r),desktop:=$u.5),ObjRelease(desktop) 22 | return 23 | id:=TV_Add($e.(_e).55) 24 | AddChildren(_e,id) 25 | } 26 | AddChildren(element,id){ 27 | array:=$e.(element).19 28 | loop % $e.(array).length() 29 | i:=TV_Add("""" $e.(newElement:=$e.(array).element(A_Index-1)).55 """ " $e.54,id) 30 | ,AddChildren(newElement,i) 31 | ,ObjRelease(newElement) 32 | ObjRelease(array) 33 | } 34 | -------------------------------------------------------------------------------- /UIA2.ahk: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;; 2 | ;;Base Interface;; 3 | ;;;;;;;;;;;;;;;;;; 4 | 5 | class IBase 6 | { 7 | __new(p=0){ 8 | if (this.__:=p) 9 | this._v:=NumGet(p+0) 10 | else return 11 | } 12 | __delete(){ 13 | ObjRelease(this.__) 14 | } 15 | vt(n){ 16 | return NumGet(this._v+n*A_PtrSize) 17 | } 18 | } 19 | 20 | ;;;;;;;;;;;;;;;;; 21 | ;;IUIAutomation;; 22 | ;;;;;;;;;;;;;;;;; 23 | 24 | class IUIAutomation extends IBase 25 | { 26 | __new(){ 27 | this.__:=ComObjCreate("{ff48dba4-60ef-4201-aa87-54103eef594e}","{30cbe57d-d9d0-452a-ab13-7ac5ac4825ee}"),this._v:=NumGet(this.__+0) 28 | } 29 | 30 | ; Compares two UI Automation elements to determine whether they represent the same underlying UI element. 31 | CompareElements(el1,el2){ 32 | UIA_Error(DllCall(this.vt(3),"ptr",this.__,"ptr",el1.__,"ptr",el2.__,"int*",areSame),"CompareElements") 33 | return areSame 34 | } 35 | 36 | ; 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. 37 | CompareRuntimeIds(runtimeId1,runtimeId2){ 38 | UIA_Error(DllCall(this.vt(4),"ptr",this.__,"ptr",runtimeId1,"ptr",runtimeId2,"int*",areSame),"CompareRuntimeIds") 39 | return areSame 40 | } 41 | 42 | ; Retrieves the UI Automation element that represents the desktop. 43 | GetRootElement(){ 44 | UIA_Error(DllCall(this.vt(5),"ptr",this.__,"ptr*",root),"GetRootElement") 45 | return new IUIAutomationElement(root) 46 | } 47 | 48 | ; Retrieves a UI Automation element for the specified window. 49 | ElementFromHandle(hwnd){ 50 | UIA_Error(DllCall(this.vt(6),"ptr",this.__,"ptr",hwnd,"ptr*",element),"ElementFromHandle") 51 | return new IUIAutomationElement(element) 52 | } 53 | 54 | ; Retrieves the UI Automation element at the specified point on the desktop. 55 | ElementFromPoint(pt){ 56 | UIA_Error(DllCall(this.vt(7),"ptr",this.__,"int64",pt,"ptr*",element),"ElementFromPoint") ; pt := x|y<<32 57 | return new IUIAutomationElement(element) 58 | } 59 | 60 | ; Retrieves the UI Automation element that has the input focus. 61 | GetFocusedElement(){ 62 | UIA_Error(DllCall(this.vt(8),"ptr",this.__,"ptr*",element),"GetFocusedElement") 63 | return new IUIAutomationElement(element) 64 | } 65 | 66 | ; 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. 67 | GetRootElementBuildCache(cacheRequest){ 68 | UIA_Error(DllCall(this.vt(9),"ptr",this.__,"ptr",cacheRequest.__,"ptr*",root),"GetRootElementBuildCache") 69 | return new IUIAutomationElement(root) 70 | } 71 | 72 | ; Retrieves a UI Automation element for the specified window, prefetches the requested properties and control patterns, and stores the prefetched items in the cache. 73 | ElementFromHandleBuildCache(hwnd,cacheRequest){ 74 | UIA_Error(DllCall(this.vt(10),"ptr",this.__,"ptr",hwnd,"ptr",cacheRequest.__,"ptr*",element),"ElementFromHandleBuildCache") 75 | return new IUIAutomationElement(element) 76 | } 77 | 78 | ; 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. 79 | ElementFromPointBuildCache(pt,cacheRequest){ 80 | UIA_Error(DllCall(this.vt(11),"ptr",this.__,"int64",pt,"ptr",cacheRequest.__,"ptr*",element),"ElementFromPointBuildCache") 81 | return new IUIAutomationElement(element) 82 | } 83 | 84 | ; 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. 85 | GetFocusedElementBuildCache(cacheRequest){ 86 | UIA_Error(DllCall(this.vt(12),"ptr",this.__,"ptr",cacheRequest.__,"ptr*",element),"GetFocusedElementBuildCache") 87 | return new IUIAutomationElement(element) 88 | } 89 | 90 | ; Retrieves a tree walker object that can be used to traverse the Microsoft UI Automation tree. 91 | CreateTreeWalker(pCondition){ 92 | UIA_Error(DllCall(this.vt(13),"ptr",this.__,"ptr",pCondition.__,"ptr*",walker),"CreateTreeWalker") 93 | return new IUIAutomationTreeWalker(walker) 94 | } 95 | 96 | ; Retrieves an IUIAutomationTreeWalker interface used to discover control elements. 97 | ControlViewWalker(){ 98 | UIA_Error(DllCall(this.vt(14),"ptr",this.__,"ptr*",walker),"ControlViewWalker") 99 | return new IUIAutomationTreeWalker(walker) 100 | } 101 | 102 | ; Retrieves an IUIAutomationTreeWalker interface used to discover content elements. 103 | ContentViewWalker(){ 104 | UIA_Error(DllCall(this.vt(15),"ptr",this.__,"ptr*",walker),"ContentViewWalker") 105 | return new IUIAutomationTreeWalker(walker) 106 | } 107 | 108 | ; Retrieves a tree walker object used to traverse an unfiltered view of the UI Automation tree. 109 | RawViewWalker(){ 110 | UIA_Error(DllCall(this.vt(16),"ptr",this.__,"ptr*",walker),"RawViewWalker") 111 | return new IUIAutomationTreeWalker(walker) 112 | } 113 | 114 | ; Retrieves a predefined IUIAutomationCondition interface that selects all UI elements in an unfiltered view. 115 | RawViewCondition(){ 116 | UIA_Error(DllCall(this.vt(17),"ptr",this.__,"ptr*",condition),"RawViewCondition") 117 | return new IUIAutomationCondition(condition) 118 | } 119 | 120 | ; Retrieves a predefined IUIAutomationCondition interface that selects control elements. 121 | ControlViewCondition(){ 122 | UIA_Error(DllCall(this.vt(18),"ptr",this.__,"ptr*",condition),"ControlViewCondition") 123 | return new IUIAutomationCondition(condition) 124 | } 125 | 126 | ; Retrieves a predefined IUIAutomationCondition interface that selects content elements. 127 | ContentViewCondition(){ 128 | UIA_Error(DllCall(this.vt(19),"ptr",this.__,"ptr*",condition),"ContentViewCondition") 129 | return new IUIAutomationCondition(condition) 130 | } 131 | 132 | ; Creates a cache request. 133 | ; After obtaining the IUIAutomationCacheRequest interface, use its methods to specify properties and control patterns to be cached when a UI Automation element is obtained. 134 | CreateCacheRequest(){ 135 | UIA_Error(DllCall(this.vt(20),"ptr",this.__,"ptr*",cacheRequest),"CreateCacheRequest") 136 | return new IUIAutomationCacheRequest(cacheRequest) 137 | } 138 | 139 | ; Retrieves a predefined condition that selects all elements. 140 | CreateTrueCondition(){ 141 | UIA_Error(DllCall(this.vt(21),"ptr",this.__,"ptr*",newCondition),"CreateTrueCondition") 142 | return new IUIAutomationBoolCondition(newCondition) 143 | } 144 | 145 | ; Creates a condition that is always false. 146 | ; 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. 147 | CreateFalseCondition(){ 148 | UIA_Error(DllCall(this.vt(22),"ptr",this.__,"ptr*",newCondition),"CreateFalseCondition") 149 | return new IUIAutomationBoolCondition(newCondition) 150 | } 151 | 152 | ; Creates a condition that selects elements that have a property with the specified value. 153 | CreatePropertyCondition(propertyId,value){ ; not test 154 | UIA_Error(DllCall(this.vt(23),"ptr",this.__,"int",propertyId,"ptr",variant(ptr,UIA_PropertyVariantType(propertyId),value),"ptr*",newCondition),"CreatePropertyCondition") 155 | return new IUIAutomationPropertyCondition(newCondition) 156 | } 157 | 158 | ; Creates a condition that selects elements that have a property with the specified value, using optional flags. 159 | CreatePropertyConditionEx(propertyId,value,flags){ 160 | UIA_Error(DllCall(this.vt(24),"ptr",this.__,"int",propertyId,"ptr",variant(ptr,UIA_PropertyVariantType(propertyId),value),"int",flags,"ptr*",newCondition),"CreatePropertyConditionEx") 161 | return new IUIAutomationPropertyCondition(newCondition) 162 | } 163 | 164 | ; 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. 165 | 166 | ; Creates a condition that selects elements that match both of two conditions. 167 | CreateAndCondition(condition1,condition2){ 168 | UIA_Error(DllCall(this.vt(25),"ptr",this.__,"ptr",condition1.__,"ptr",condition2.__,"ptr*",newCondition),"CreateAndCondition") 169 | return new IUIAutomationAndCondition(newCondition) 170 | } 171 | 172 | ; Creates a condition that selects elements based on multiple conditions, all of which must be true. 173 | CreateAndConditionFromArray(conditions){ 174 | UIA_Error(DllCall(this.vt(26),"ptr",this.__,"ptr",IsObject(conditions)?ComObjValue(conditions):conditions,"ptr*",newCondition),"CreateAndConditionFromArray") 175 | return new IUIAutomationAndCondition(newCondition) 176 | } 177 | 178 | ; Creates a condition that selects elements based on multiple conditions, all of which must be true. 179 | CreateAndConditionFromNativeArray(conditions,conditionCount){ 180 | UIA_Error(DllCall(this.vt(27),"ptr",this.__,"ptr",conditions,"int",conditionCount,"ptr*",newCondition),"CreateAndConditionFromNativeArray") 181 | return new IUIAutomationAndCondition(newCondition) 182 | } 183 | 184 | ; Creates a combination of two conditions where a match exists if either of the conditions is true. 185 | CreateOrCondition(condition1,condition2){ 186 | UIA_Error(DllCall(this.vt(28),"ptr",this.__,"ptr",condition1.__,"ptr",condition2.__,"ptr*",newCondition),"CreateOrCondition") 187 | return new IUIAutomationOrCondition(newCondition) 188 | } 189 | 190 | ; Creates a combination of two or more conditions where a match exists if any of the conditions is true. 191 | CreateOrConditionFromArray(conditions){ 192 | UIA_Error(DllCall(this.vt(29),"ptr",this.__,"ptr",IsObject(conditions)?ComObjValue(conditions):conditions,"ptr*",newCondition),"CreateOrConditionFromArray") 193 | return new IUIAutomationOrCondition(newCondition) 194 | } 195 | 196 | ; Creates a combination of two or more conditions where a match exists if any one of the conditions is true. 197 | CreateOrConditionFromNativeArray(conditions,conditionCount){ 198 | UIA_Error(DllCall(this.vt(30),"ptr",this.__,"ptr",conditions,"ptr",conditionCount,"ptr*",newCondition),"CreateOrConditionFromNativeArray") 199 | return new IUIAutomationOrCondition(newCondition) 200 | } 201 | 202 | ; Creates a condition that is the negative of a specified condition. 203 | CreateNotCondition(condition){ 204 | UIA_Error(DllCall(this.vt(31),"ptr",this.__,"ptr",condition.__,"ptr*",newCondition),"CreateNotCondition") 205 | return new IUIAutomationNotCondition(newCondition) 206 | } 207 | 208 | ; 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 209 | ; 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. 210 | ; 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. 211 | 212 | ; Registers a method that handles Microsoft UI Automation events. 213 | AddAutomationEventHandler(eventId,element,scope,cacheRequest,handler){ 214 | return UIA_Error(DllCall(this.vt(32),"ptr",this.__,"int",eventId,"ptr",element.__,"int",scope,"ptr",cacheRequest?cacheRequest.__:0,"ptr",handler),"AddAutomationEventHandler") 215 | } 216 | 217 | ; Removes the specified UI Automation event handler. 218 | RemoveAutomationEventHandler(eventId,element,handler){ 219 | return UIA_Error(DllCall(this.vt(33),"ptr",this.__,"int",eventId,"ptr",element.__,"ptr",handler),"RemoveAutomationEventHandler") 220 | } 221 | 222 | ; Registers a method that handles property-changed events. 223 | ; The UI item specified by element might not support the properties specified by the propertyArray parameter. 224 | ; This method serves the same purpose as IUIAutomation::AddPropertyChangedEventHandler, but takes a normal array of property identifiers instead of a SAFEARRAY. 225 | AddPropertyChangedEventHandlerNativeArray(element,scope,cacheRequest,handler,propertyArray,propertyCount){ 226 | return UIA_Error(DllCall(this.vt(34),"ptr",this.__,"ptr",element.__,"int",scope,"ptr",cacheRequest?cacheRequest.__:0,"ptr",handler,"ptr",propertyArray,"int",propertyCount),"AddPropertyChangedEventHandlerNativeArray") 227 | } 228 | 229 | ; Registers a method that handles property-changed events. 230 | ; The UI item specified by element might not support the properties specified by the propertyArray parameter. 231 | AddPropertyChangedEventHandler(element,scope,cacheRequest,handler,propertyArray){ 232 | return UIA_Error(DllCall(this.vt(35),"ptr",this.__,"ptr",element.__,"int",scope,"ptr",cacheRequest?cacheRequest.__:0,"ptr",handler,"ptr",propertyArray),"AddPropertyChangedEventHandler") 233 | } 234 | 235 | ; Removes a property-changed event handler. 236 | RemovePropertyChangedEventHandler(element,handler){ 237 | return UIA_Error(DllCall(this.vt(36),"ptr",this.__,"ptr",element.__,"ptr",handler),"RemovePropertyChangedEventHandler") 238 | } 239 | 240 | ; Registers a method that handles structure-changed events. 241 | AddStructureChangedEventHandler(element,scope,cacheRequest,handler){ 242 | return UIA_Error(DllCall(this.vt(37),"ptr",this.__,"ptr",element.__,"int",scope,"ptr",cacheRequest?cacheRequest.__:0,"ptr",handler),"AddStructureChangedEventHandler") 243 | } 244 | 245 | ; Removes a structure-changed event handler. 246 | RemoveStructureChangedEventHandler(element,handler){ 247 | return UIA_Error(DllCall(this.vt(38),"ptr",this.__,"ptr",element.__,"ptr",handler),"RemoveStructureChangedEventHandler") 248 | } 249 | 250 | ; Registers a method that handles focus-changed events. 251 | ; Focus-changed events are system-wide; you cannot set a narrower scope. 252 | AddFocusChangedEventHandler(cacheRequest,handler){ 253 | return UIA_Error(DllCall(this.vt(39),"ptr",this.__,"ptr",cacheRequest?cacheRequest.__:0,"ptr",handler),"AddFocusChangedEventHandler") 254 | } 255 | 256 | ; Removes a focus-changed event handler. 257 | RemoveFocusChangedEventHandler(handler){ 258 | return UIA_Error(DllCall(this.vt(40),"ptr",this.__,"ptr",handler),"RemoveFocusChangedEventHandler") 259 | } 260 | 261 | ; Removes all registered Microsoft UI Automation event handlers. 262 | RemoveAllEventHandlers(){ 263 | return UIA_Error(DllCall(this.vt(41),"ptr",this.__),"RemoveAllEventHandlers") 264 | } 265 | 266 | ; Converts an array of integers to a SAFEARRAY. 267 | IntNativeArrayToSafeArray(array,arrayCount){ 268 | UIA_Error(DllCall(this.vt(42),"ptr",this.__,"ptr",array,"int",arrayCount,"ptr*",safeArray),"IntNativeArrayToSafeArray") 269 | return safeArray 270 | } 271 | 272 | ; Converts a SAFEARRAY of integers to an array. 273 | IntSafeArrayToNativeArray(intArray){ 274 | UIA_Error(DllCall(this.vt(43),"ptr",this.__,"ptr",intArray,"ptr*",array,"int*",arrayCount),"IntSafeArrayToNativeArray") 275 | return [array,arrayCount] 276 | } 277 | 278 | ; Creates a VARIANT that contains the coordinates of a rectangle. 279 | ; The returned VARIANT has a data type of VT_ARRAY | VT_R8. 280 | RectToVariant(rc){ 281 | UIA_Error(DllCall(this.vt(44),"ptr",this.__,"ptr",rc,"ptr*",var),"RectToVariant") 282 | return var 283 | } 284 | 285 | ; Converts a VARIANT containing rectangle coordinates to a RECT. 286 | VariantToRect(var){ 287 | UIA_Error(DllCall(this.vt(45),"ptr",this.__,"ptr",var,"ptr*",rc),"VariantToRect") 288 | return rc 289 | } 290 | 291 | ; Converts a SAFEARRAY containing rectangle coordinates to an array of type RECT. 292 | SafeArrayToRectNativeArray(rects){ 293 | UIA_Error(DllCall(this.vt(46),"ptr",this.__,"ptr",rects,"ptr*",rectArray,"int*",rectArrayCount),"SafeArrayToRectNativeArray") 294 | return [rectArray,rectArrayCount] 295 | } 296 | 297 | ; Creates a new instance of a proxy factory object. 298 | ; Use the IUIAutomationProxyFactoryMapping interface to enter the proxy factory into the table of available proxies. 299 | CreateProxyFactoryEntry(factory){ 300 | UIA_Error(DllCall(this.vt(47),"ptr",this.__,"ptr",factory.__,"ptr*",factoryEntry),"CreateProxyFactoryEntry") 301 | return new IUIAutomationProxyFactoryEntry(factoryEntry) 302 | } 303 | 304 | ; Retrieves an object that represents the mapping of Window classnames and associated data to individual proxy factories. This property is read-only. 305 | ProxyFactoryMapping(){ 306 | UIA_Error(DllCall(this.vt(48),"ptr",this.__,"ptr*",factoryMapping),"ProxyFactoryMapping") 307 | return new IUIAutomationProxyFactoryMapping(factoryMapping) 308 | } 309 | 310 | ; The programmatic name is intended for debugging and diagnostic purposes only. The string is not localized. 311 | ; This property should not be used in string comparisons. To determine whether two properties are the same, compare the property identifiers directly. 312 | 313 | ; Retrieves the registered programmatic name of a property. 314 | GetPropertyProgrammaticName(property){ 315 | UIA_Error(DllCall(this.vt(49),"ptr",this.__,"int",property,"ptr*",name),"GetPropertyProgrammaticName") 316 | return StrGet(name,"utf-16") 317 | } 318 | 319 | ; Retrieves the registered programmatic name of a control pattern. 320 | GetPatternProgrammaticName(pattern){ 321 | UIA_Error(DllCall(this.vt(50),"ptr",this.__,"int",pattern,"ptr*",name),"GetPatternProgrammaticName") 322 | return StrGet(name,"utf-16") 323 | } 324 | 325 | ; 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. 326 | ; There is no guarantee that the element will support any particular control pattern when asked for it later. 327 | 328 | ; Retrieves the control patterns that might be supported on a UI Automation element. 329 | PollForPotentialSupportedPatterns(pElement){ 330 | UIA_Error(DllCall(this.vt(51),"ptr",this.__,"ptr",pElement.__,"ptr*",patternIds,"ptr*",patternNames),"PollForPotentialSupportedPatterns") 331 | return [patternIds,patternNames] ; SafeArray 332 | } 333 | 334 | ; Retrieves the properties that might be supported on a UI Automation element. 335 | PollForPotentialSupportedProperties(pElement){ 336 | UIA_Error(DllCall(this.vt(52),"ptr",this.__,"ptr",pElement.__,"ptr*",propertyIds,"ptr*",propertyNames),"PollForPotentialSupportedProperties") 337 | return [propertyIds,propertyNames] ; SafeArray 338 | } 339 | 340 | ; Checks a provided VARIANT to see if it contains the Not Supported identifier. 341 | ; 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. 342 | CheckNotSupported(value){ ; not completed 343 | UIA_Error(DllCall(this.vt(53),"ptr",this.__,"ptr",value,"int*",isNotSupported),"CheckNotSupported") 344 | return isNotSupported 345 | } 346 | 347 | ; Retrieves a static token object representing a property or text attribute that is not supported. This property is read-only. 348 | ; This object can be used for comparison with the results from IUIAutomationElement::GetCurrentPropertyValue or IUIAutomationTextRange::GetAttributeValue. 349 | ReservedNotSupportedValue(){ 350 | UIA_Error(DllCall(this.vt(54),"ptr",this.__,"ptr*",notSupportedValue),"ReservedNotSupportedValue") 351 | return notSupportedValue ; Iunknown 352 | } 353 | 354 | ; Retrieves a static token object representing a text attribute that is a mixed attribute. This property is read-only. 355 | ; 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. 356 | ReservedMixedAttributeValue(){ 357 | UIA_Error(DllCall(this.vt(55),"ptr",this.__,"ptr*",mixedAttributeValue),"ReservedMixedAttributeValue") 358 | return mixedAttributeValue ; Iunknown 359 | } 360 | 361 | ; This method enables UI Automation clients to get IUIAutomationElement interfaces for accessible objects implemented by a Microsoft Active Accessiblity server. 362 | ; This method may fail if the server implements UI Automation provider interfaces alongside Microsoft Active Accessibility support. 363 | ; 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. 364 | 365 | ; Retrieves a UI Automation element for the specified accessible object from a Microsoft Active Accessibility server. 366 | ElementFromIAccessible(accessible,childId){ 367 | UIA_Error(DllCall(this.vt(56),"ptr",this.__,"ptr",accessible,"int",childId,"ptr*",element),"ElementFromIAccessible") 368 | return new IUIAutomationElement(element) 369 | } 370 | 371 | ; 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. 372 | ElementFromIAccessibleBuildCache(accessible,childId,cacheRequest){ 373 | UIA_Error(DllCall(this.vt(57),"ptr",this.__,"ptr",accessible,"int",childId,"ptr",cacheRequest.__,"ptr*",element),"ElementFromIAccessibleBuildCache") 374 | return new IUIAutomationElement(element) 375 | } 376 | } 377 | 378 | ;;;;;;;;;;;;;;;;;;;;;;;; 379 | ;;IUIAutomationElement;;will be modified 380 | ;;;;;;;;;;;;;;;;;;;;;;;; 381 | 382 | class IUIAutomationElement extends IBase 383 | { 384 | 385 | ; Sets the keyboard focus to this UI Automation element. 386 | SetFocus(){ 387 | return UIA_Error(DllCall(this.vt(3),"ptr",this.__),"SetFocus") 388 | } 389 | 390 | ; Retrieves the unique identifier assigned to the UI element. 391 | ; 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. 392 | ; 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. 393 | GetRuntimeId(){ 394 | UIA_Error(DllCall(this.vt(4),"ptr",this.__,"ptr*",runtimeId),"GetRuntimeId") 395 | return runtimeId ; safearray 396 | } 397 | 398 | ; 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. 399 | ; 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. 400 | ; 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. 401 | ; 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. 402 | 403 | ; Retrieves the first child or descendant element that matches the specified condition. 404 | FindFirst(scope,condition){ 405 | UIA_Error(DllCall(this.vt(5),"ptr",this.__,"int",scope,"ptr",condition.__,"ptr*",found),"FindFirst") 406 | return new IUIAutomationElement(found) 407 | } 408 | 409 | ; Returns all UI Automation elements that satisfy the specified condition. 410 | FindAll(scope,condition){ 411 | UIA_Error(DllCall(this.vt(6),"ptr",this.__,"int",scope,"ptr",condition.__,"ptr*",found),"FindAll") 412 | return new IUIAutomationElementArray(found) 413 | } 414 | 415 | ; 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. 416 | FindFirstBuildCache(scope,condition,cacheRequest){ 417 | UIA_Error(DllCall(this.vt(7),"ptr",this.__,"int",scope,"ptr",condition.__,"ptr",cacheRequest.__,"ptr*",found),"FindFirstBuildCache") 418 | return new IUIAutomationElement(found) 419 | } 420 | 421 | ; 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. 422 | FindAllBuildCache(scope,condition,cacheRequest){ 423 | UIA_Error(DllCall(this.vt(8),"ptr",this.__,"int",scope,"ptr",condition.__,"ptr",cacheRequest.__,"ptr*",found),"FindAllBuildCache") 424 | return new IUIAutomationElementArray(found) 425 | } 426 | 427 | ; Retrieves a new UI Automation element with an updated cache. 428 | ; The original UI Automation element is unchanged. The new IUIAutomationElement interface refers to the same element and has the same runtime identifier. 429 | BuildUpdatedCache(cacheRequest){ 430 | UIA_Error(DllCall(this.vt(9),"ptr",this.__,"ptr",cacheRequest.__,"ptr*",updatedElement),"BuildUpdatedCache") 431 | return new IUIAutomationElement(updatedElement) 432 | } 433 | 434 | ; 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. 435 | 436 | ; Retrieves the current value of a property for this UI Automation element. 437 | GetCurrentPropertyValue(propertyId){ ; not test 438 | static _,_v:=variant(_) 439 | UIA_Error(DllCall(this.vt(10),"ptr",this.__,"int",propertyId,"ptr",_v),"GetCurrentPropertyValue") 440 | return GetVariantValue(_v) 441 | } 442 | 443 | ; Retrieves a property value for this UI Automation element, optionally ignoring any default value. 444 | ; Passing FALSE in the ignoreDefaultValue parameter is equivalent to calling IUIAutomationElement::GetCurrentPropertyValue. 445 | ; 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. 446 | ; This method returns a failure code if the requested property was not previously cached. 447 | GetCurrentPropertyValueEx(propertyId,ignoreDefaultValue){ 448 | static _,_v:=variant(_) 449 | UIA_Error(DllCall(this.vt(11),"ptr",this.__,"int",propertyId,"int",ignoreDefaultValue,"ptr",_v),"GetCurrentPropertyValueEx") 450 | return GetVariantValue(_v) 451 | } 452 | 453 | ; Retrieves a property value from the cache for this UI Automation element. 454 | GetCachedPropertyValue(propertyId){ 455 | static _,_v:=variant(_) 456 | UIA_Error(DllCall(this.vt(12),"ptr",this.__,"int",propertyId,"ptr",_v),"GetCachedPropertyValue") 457 | return GetVariantValue(_v) 458 | } 459 | 460 | ; Retrieves a property value from the cache for this UI Automation element, optionally ignoring any default value. 461 | GetCachedPropertyValueEx(propertyId,ignoreDefaultValue,retVal){ 462 | static _,_v:=variant(_) 463 | UIA_Error(DllCall(this.vt(13),"ptr",this.__,"int",propertyId,"int",ignoreDefaultValue,"ptr",_v),"GetCachedPropertyValueEx") 464 | return GetVariantValue(_v) 465 | } 466 | 467 | ; Retrieves the control pattern interface of the specified pattern on this UI Automation element. 468 | GetCurrentPatternAs(patternId,riid){ ; not completed 469 | UIA_Error(DllCall(this.vt(14),"ptr",this.__,"int",patternId,"ptr",riid,"ptr*",patternObject),"GetCurrentPatternAs") 470 | return patternObject 471 | } 472 | 473 | ; Retrieves the control pattern interface of the specified pattern from the cache of this UI Automation element. 474 | GetCachedPatternAs(patternId,riid){ ; not completed 475 | UIA_Error(DllCall(this.vt(15),"ptr",this.__,"int",patternId,"ptr",riid,"ptr*",patternObject),"GetCachedPatternAs") 476 | return patternObject 477 | } 478 | 479 | ; Retrieves the IUnknown interface of the specified control pattern on this UI Automation element. 480 | ; This method gets the specified control pattern based on its availability at the time of the call. 481 | ; 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. 482 | GetCurrentPattern(patternId){ 483 | UIA_Error(DllCall(this.vt(16),"ptr",this.__,"int",patternId,"ptr*",patternObject),"GetCurrentPattern") 484 | if name:=UIA_Pattern(patternID) 485 | return (name:=UIA_Pattern(patternID))?new IUIAutomation%name%Pattern(patternObject):patternObject 486 | } 487 | 488 | ; Retrieves from the cache the IUnknown interface of the specified control pattern of this UI Automation element. 489 | GetCachedPattern(patternId){ 490 | UIA_Error(DllCall(this.vt(17),"ptr",this.__,"int",patternId,"ptr*",patternObject),"GetCachedPattern") 491 | return (name:=UIA_Pattern(patternID))?new IUIAutomation%name%Pattern(patternObject):patternObject 492 | } 493 | 494 | ; Retrieves from the cache the parent of this UI Automation element. 495 | GetCachedParent(){ 496 | UIA_Error(DllCall(this.vt(18),"ptr",this.__,"ptr*",parent),"GetCachedParent") 497 | return new IUIAutomationElement(parent) 498 | } 499 | 500 | ; Retrieves the cached child elements of this UI Automation element. 501 | ; The view of the returned collection is determined by the TreeFilter property of the IUIAutomationCacheRequest that was active when this element was obtained. 502 | ; Children are cached only if the scope of the cache request included TreeScope_Subtree, TreeScope_Children, or TreeScope_Descendants. 503 | ; 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. 504 | GetCachedChildren(){ 505 | UIA_Error(DllCall(this.vt(19),"ptr",this.__,"ptr*",children),"GetCachedChildren") 506 | return new IUIAutomationElementArray(children) 507 | } 508 | 509 | ; Retrieves the identifier of the process that hosts the element. 510 | CurrentProcessId(){ 511 | UIA_Error(DllCall(this.vt(20),"ptr",this.__,"int*",retVal),"get_CurrentProcessId") 512 | return retVal 513 | } 514 | 515 | ; Retrieves the control type of the element. 516 | ; 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. 517 | CurrentControlType(){ 518 | UIA_Error(DllCall(this.vt(21),"ptr",this.__,"int*",retVal),"get_CurrentControlType") 519 | return retVal 520 | } 521 | 522 | ; Retrieves a localized description of the control type of the element. 523 | CurrentLocalizedControlType(){ 524 | UIA_Error(DllCall(this.vt(22),"ptr",this.__,"ptr*",retVal),"get_CurrentLocalizedControlType") 525 | return StrGet(retVal,"utf-16") 526 | } 527 | 528 | ; Retrieves the name of the element. 529 | CurrentName(){ 530 | UIA_Error(DllCall(this.vt(23),"ptr",this.__,"ptr*",retVal),"get_CurrentName") 531 | return StrGet(retVal,"utf-16") 532 | } 533 | 534 | ; Retrieves the accelerator key for the element. 535 | CurrentAcceleratorKey(){ 536 | UIA_Error(DllCall(this.vt(24),"ptr",this.__,"ptr*",retVal),"get_CurrentAcceleratorKey") 537 | return StrGet(retVal,"utf-16") 538 | } 539 | 540 | ; Retrieves the access key character for the element. 541 | ; 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. 542 | CurrentAccessKey(){ 543 | UIA_Error(DllCall(this.vt(25),"ptr",this.__,"ptr*",retVal),"get_CurrentAccessKey") 544 | return StrGet(retVal,"utf-16") 545 | } 546 | 547 | ; Indicates whether the element has keyboard focus. 548 | CurrentHasKeyboardFocus(){ 549 | UIA_Error(DllCall(this.vt(26),"ptr",this.__,"int*",retVal),"get_CurrentHasKeyboardFocus") 550 | return retVal 551 | } 552 | 553 | ; Indicates whether the element can accept keyboard focus. 554 | CurrentIsKeyboardFocusable(){ 555 | UIA_Error(DllCall(this.vt(27),"ptr",this.__,"int*",retVal),"get_CurrentIsKeyboardFocusable") 556 | return retVal 557 | } 558 | 559 | ; Retrieves a cached value that indicates whether the element is enabled. 560 | CurrentIsEnabled(){ 561 | UIA_Error(DllCall(this.vt(28),"ptr",this.__,"int*",retVal),"get_CurrentIsEnabled") 562 | return retVal 563 | } 564 | 565 | ; Retrieves the Microsoft UI Automation identifier of the element. 566 | ; The identifier is unique among sibling elements in a container, and is the same in all instances of the application. 567 | CurrentAutomationId(){ 568 | UIA_Error(DllCall(this.vt(29),"ptr",this.__,"ptr*",retVal),"get_CurrentAutomationId") 569 | return retVal 570 | } 571 | 572 | ; Retrieves the class name of the element. 573 | ; The value of this property is implementation-defined. The property is useful in testing environments. 574 | CurrentClassName(){ 575 | UIA_Error(DllCall(this.vt(30),"ptr",this.__,"ptr*",retVal),"get_CurrentClassName") 576 | return StrGet(retVal,"utf-16") 577 | } 578 | 579 | ; Retrieves the help text for the element. This information is typically obtained from tooltips. 580 | ; 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. 581 | CurrentHelpText(){ 582 | UIA_Error(DllCall(this.vt(31),"ptr",this.__,"ptr*",retVal),"get_CurrentHelpText") 583 | return StrGet(retVal,"utf-16") 584 | } 585 | 586 | ; Retrieves the culture identifier for the element. 587 | CurrentCulture(){ 588 | UIA_Error(DllCall(this.vt(32),"ptr",this.__,"int*",retVal),"get_CurrentCulture") 589 | return retVal 590 | } 591 | 592 | ; Indicates whether the element is a control element. 593 | CurrentIsControlElement(){ 594 | UIA_Error(DllCall(this.vt(33),"ptr",this.__,"int*",retVal),"get_CurrentIsControlElement") 595 | return retVal 596 | } 597 | 598 | ; Indicates whether the element is a content element. 599 | ; 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. 600 | CurrentIsContentElement(){ 601 | UIA_Error(DllCall(this.vt(34),"ptr",this.__,"int*",retVal),"get_CurrentIsContentElement") 602 | return retVal 603 | } 604 | 605 | ; Indicates whether the element contains a disguised password. 606 | ; This property enables applications such as screen-readers to determine whether the text content of a control should be read aloud. 607 | CurrentIsPassword(){ 608 | UIA_Error(DllCall(this.vt(35),"ptr",this.__,"int*",retVal),"get_CurrentIsPassword") 609 | return retVal 610 | } 611 | 612 | ; Retrieves the window handle of the element. 613 | CurrentNativeWindowHandle(){ 614 | UIA_Error(DllCall(this.vt(36),"ptr",this.__,"ptr*",retVal),"get_CurrentNativeWindowHandle") 615 | return retVal 616 | } 617 | 618 | ; Retrieves a description of the type of UI item represented by the element. 619 | ; 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". 620 | CurrentItemType(){ 621 | UIA_Error(DllCall(this.vt(37),"ptr",this.__,"ptr*",retVal),"get_CurrentItemType") 622 | return StrGet(retVal,"utf-16") 623 | } 624 | 625 | ; Indicates whether the element is off-screen. 626 | CurrentIsOffscreen(){ 627 | UIA_Error(DllCall(this.vt(38),"ptr",this.__,"int*",retVal),"get_CurrentIsOffscreen") 628 | return retVal 629 | } 630 | 631 | ; Retrieves a value that indicates the orientation of the element. 632 | ; This property is supported by controls such as scroll bars and sliders that can have either a vertical or a horizontal orientation. 633 | CurrentOrientation(){ 634 | UIA_Error(DllCall(this.vt(39),"ptr",this.__,"int*",retVal),"get_CurrentOrientation") 635 | return retVal ; OrientationType 636 | } 637 | 638 | ; Retrieves the name of the underlying UI framework. The name of the UI framework, such as "Win32", "WinForm", or "DirectUI". 639 | CurrentFrameworkId(){ 640 | UIA_Error(DllCall(this.vt(40),"ptr",this.__,"ptr*",retVal),"get_CurrentFrameworkId") 641 | return StrGet(retVal,"utf-16") 642 | } 643 | 644 | ; Indicates whether the element is required to be filled out on a form. 645 | CurrentIsRequiredForForm(){ 646 | UIA_Error(DllCall(this.vt(41),"ptr",this.__,"int*",retVal),"get_CurrentIsRequiredForForm") 647 | return retVal 648 | } 649 | 650 | ; Retrieves the description of the status of an item in an element. 651 | ; 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". 652 | CurrentItemStatus(){ 653 | UIA_Error(DllCall(this.vt(42),"ptr",this.__,"ptr*",retVal),"get_CurrentItemStatus") 654 | return StrGet(retVal,"utf-16") 655 | } 656 | 657 | ; Retrieves the coordinates of the rectangle that completely encloses the element, in screen coordinates. 658 | CurrentBoundingRectangle(){ 659 | UIA_Error(DllCall(this.vt(43),"ptr",this.__,"int64*",retVal),"get_CurrentBoundingRectangle") 660 | return [retVal&0xFF,(retVal>>16)&0xFF,(retVal>>32)&0xFF,retVal>>48] 661 | } 662 | 663 | ; This property maps to the Accessible Rich Internet Applications (ARIA) property. 664 | 665 | ; Retrieves the element that contains the text label for this element. 666 | ; This property could be used to retrieve, for example, the static text label for a combo box. 667 | CurrentLabeledBy(){ 668 | UIA_Error(DllCall(this.vt(44),"ptr",this.__,"ptr*",retVal),"get_CurrentLabeledBy") 669 | return retVal ; IUIAutomationElement 670 | } 671 | 672 | ; Retrieves the Accessible Rich Internet Applications (ARIA) role of the element. 673 | CurrentAriaRole(){ 674 | UIA_Error(DllCall(this.vt(45),"ptr",this.__,"ptr*",retVal),"get_CurrentAriaRole") 675 | return StrGet(retVal,"utf-16") 676 | } 677 | 678 | ; Retrieves the ARIA properties of the element. 679 | CurrentAriaProperties(){ 680 | UIA_Error(DllCall(this.vt(46),"ptr",this.__,"ptr",retVal),"get_CurrentAriaProperties") 681 | return StrGet(retVal,"utf-16") 682 | } 683 | 684 | ; Indicates whether the element contains valid data for a form. 685 | CurrentIsDataValidForForm(){ 686 | UIA_Error(DllCall(this.vt(47),"ptr",this.__,"int*",retVal),"get_CurrentIsDataValidForForm") 687 | return retVal 688 | } 689 | 690 | ; Retrieves an array of elements for which this element serves as the controller. 691 | CurrentControllerFor(){ 692 | UIA_Error(DllCall(this.vt(48),"ptr",this.__,"ptr*",retVal),"get_CurrentControllerFor") 693 | return retVal ; IUIAutomationElementArray 694 | } 695 | 696 | ; Retrieves an array of elements that describe this element. 697 | CurrentDescribedBy(){ 698 | UIA_Error(DllCall(this.vt(49),"ptr",this.__,"ptr*",retVal),"get_CurrentDescribedBy") 699 | return retVal ; IUIAutomationElementArray 700 | } 701 | 702 | ; Retrieves an array of elements that indicates the reading order after the current element. 703 | CurrentFlowsTo(){ 704 | UIA_Error(DllCall(this.vt(50),"ptr",this.__,"ptr*",retVal),"get_CurrentFlowsTo") 705 | return retVal ; IUIAutomationElementArray 706 | } 707 | 708 | ; Retrieves a description of the provider for this element. 709 | CurrentProviderDescription(){ 710 | UIA_Error(DllCall(this.vt(51),"ptr",this.__,"ptr*",retVal),"get_CurrentProviderDescription") 711 | return StrGet(retVal,"utf-16") 712 | } 713 | 714 | ; Retrieves the cached ID of the process that hosts the element. 715 | CachedProcessId(){ 716 | UIA_Error(DllCall(this.vt(52),"ptr",this.__,"int*",retVal),"get_CachedProcessId") 717 | return retVal 718 | } 719 | 720 | ; Retrieves a cached value that indicates the control type of the element. 721 | CachedControlType(){ 722 | UIA_Error(DllCall(this.vt(53),"ptr",this.__,"int*",retVal),"get_CachedControlType") 723 | return retVal 724 | } 725 | 726 | ; Retrieves the cached localized description of the control type of the element. 727 | CachedLocalizedControlType(){ 728 | UIA_Error(DllCall(this.vt(54),"ptr",this.__,"ptr*",retVal),"get_CachedLocalizedControlType") 729 | return StrGet(retVal,"utf-16") 730 | } 731 | 732 | ; Retrieves the cached name of the element. 733 | CachedName(){ 734 | UIA_Error(DllCall(this.vt(55),"ptr",this.__,"ptr*",retVal),"get_CachedName") 735 | return StrGet(retVal,"utf-16") 736 | } 737 | 738 | ; Retrieves the cached accelerator key for the element. 739 | CachedAcceleratorKey(){ 740 | UIA_Error(DllCall(this.vt(56),"ptr",this.__,"ptr*",retVal),"get_CachedAcceleratorKey") 741 | return StrGet(retVal,"utf-16") 742 | } 743 | 744 | ; Retrieves the cached access key character for the element. 745 | CachedAccessKey(){ 746 | UIA_Error(DllCall(this.vt(57),"ptr",this.__,"ptr*",retVal),"get_CachedAccessKey") 747 | return StrGet(retVal,"utf-16") 748 | } 749 | 750 | ; A cached value that indicates whether the element has keyboard focus. 751 | CachedHasKeyboardFocus(){ 752 | UIA_Error(DllCall(this.vt(58),"ptr",this.__,"int*",retVal),"get_CachedHasKeyboardFocus") 753 | return retVal 754 | } 755 | 756 | ; Retrieves a cached value that indicates whether the element can accept keyboard focus. 757 | CachedIsKeyboardFocusable(){ 758 | UIA_Error(DllCall(this.vt(59),"ptr",this.__,"int*",retVal),"get_CachedIsKeyboardFocusable") 759 | return retVal 760 | } 761 | 762 | ; Retrieves a cached value that indicates whether the element is enabled. 763 | CachedIsEnabled(){ 764 | UIA_Error(DllCall(this.vt(60),"ptr",this.__,"int*",retVal),"get_CachedIsEnabled") 765 | return retVal 766 | } 767 | 768 | ; Retrieves the cached UI Automation identifier of the element. 769 | CachedAutomationId(){ 770 | UIA_Error(DllCall(this.vt(61),"ptr",this.__,"ptr*",retVal),"get_CachedAutomationId") 771 | return retVal 772 | } 773 | 774 | ; Retrieves the cached class name of the element. 775 | CachedClassName(){ 776 | UIA_Error(DllCall(this.vt(62),"ptr",this.__,"ptr*",retVal),"get_CachedClassName") 777 | return StrGet(retVal,"utf-16") 778 | } 779 | 780 | ; 781 | CachedHelpText(){ 782 | UIA_Error(DllCall(this.vt(63),"ptr",this.__,"ptr*",retVal),"get_CachedHelpText") 783 | return StrGet(retVal,"utf-16") 784 | } 785 | 786 | ; Retrieves the cached help text for the element. 787 | CachedCulture(){ 788 | UIA_Error(DllCall(this.vt(64),"ptr",this.__,"int*",retVal),"get_CachedCulture") 789 | return retVal 790 | } 791 | 792 | ; Retrieves a cached value that indicates whether the element is a control element. 793 | CachedIsControlElement(){ 794 | UIA_Error(DllCall(this.vt(65),"ptr",this.__,"int*",retVal),"get_CachedIsControlElement") 795 | return retVal 796 | } 797 | 798 | ; A cached value that indicates whether the element is a content element. 799 | CachedIsContentElement(){ 800 | UIA_Error(DllCall(this.vt(66),"ptr",this.__,"int*",retVal),"get_CachedIsContentElement") 801 | return retVal 802 | } 803 | 804 | ; Retrieves a cached value that indicates whether the element contains a disguised password. 805 | CachedIsPassword(){ 806 | UIA_Error(DllCall(this.vt(67),"ptr",this.__,"int*",retVal),"get_CachedIsPassword") 807 | return retVal 808 | } 809 | 810 | ; Retrieves the cached window handle of the element. 811 | CachedNativeWindowHandle(){ 812 | UIA_Error(DllCall(this.vt(68),"ptr",this.__,"ptr*",retVal),"get_CachedNativeWindowHandle") 813 | return retVal 814 | } 815 | 816 | ; Retrieves a cached string that describes the type of item represented by the element. 817 | CachedItemType(){ 818 | UIA_Error(DllCall(this.vt(69),"ptr",this.__,"ptr*",retVal),"get_CachedItemType") 819 | return StrGet(retVal,"utf-16") 820 | } 821 | 822 | ; Retrieves a cached value that indicates whether the element is off-screen. 823 | CachedIsOffscreen(){ 824 | UIA_Error(DllCall(this.vt(70),"ptr",this.__,"int*",retVal),"get_CachedIsOffscreen") 825 | return retVal 826 | } 827 | 828 | ; Retrieves a cached value that indicates the orientation of the element. 829 | CachedOrientation(){ 830 | UIA_Error(DllCall(this.vt(71),"ptr",this.__,"ptr*",retVal),"get_CachedOrientation") 831 | return retVal ; OrientationType 832 | } 833 | 834 | ; Retrieves the cached name of the underlying UI framework associated with the element. 835 | CachedFrameworkId(){ 836 | UIA_Error(DllCall(this.vt(72),"ptr",this.__,"ptr*",retVal),"get_CachedFrameworkId") 837 | return StrGet(retVal,"utf-16") 838 | } 839 | 840 | ; Retrieves a cached value that indicates whether the element is required to be filled out on a form. 841 | CachedIsRequiredForForm(){ 842 | UIA_Error(DllCall(this.vt(73),"ptr",this.__,"int*",retVal),"get_CachedIsRequiredForForm") 843 | return retVal 844 | } 845 | 846 | ; Retrieves a cached description of the status of an item within an element. 847 | CachedItemStatus(){ 848 | UIA_Error(DllCall(this.vt(74),"ptr",this.__,"ptr*",retVal),"get_CachedItemStatus") 849 | return StrGet(retVal,"utf-16") 850 | } 851 | 852 | ; Retrieves the cached coordinates of the rectangle that completely encloses the element. 853 | CachedBoundingRectangle(){ 854 | UIA_Error(DllCall(this.vt(75),"ptr",this.__,"int64*",retVal),"get_CachedBoundingRectangle") 855 | return [retVal&0xFF,(retVal>>16)&0xFF,(retVal>>32)&0xFF,retVal>>48] 856 | } 857 | 858 | ; Retrieves the cached element that contains the text label for this element. 859 | CachedLabeledBy(){ 860 | UIA_Error(DllCall(this.vt(76),"ptr",this.__,"ptr*",retVal),"get_CachedLabeledBy") 861 | return new IUIAutomationElement(retVal) ; IUIAutomationElement 862 | } 863 | 864 | ; Retrieves the cached ARIA role of the element. 865 | CachedAriaRole(){ 866 | UIA_Error(DllCall(this.vt(77),"ptr",this.__,"ptr*",retVal),"get_CachedAriaRole") 867 | return StrGet(retVal,"utf-16") 868 | } 869 | 870 | ; Retrieves the cached ARIA properties of the element. 871 | CachedAriaProperties(){ 872 | UIA_Error(DllCall(this.vt(78),"ptr",this.__,"ptr*",retVal),"get_CachedAriaProperties") 873 | return StrGet(retVal,"utf-16") 874 | } 875 | 876 | ; Retrieves a cached value that indicates whether the element contains valid data for the form. 877 | CachedIsDataValidForForm(){ 878 | UIA_Error(DllCall(this.vt(79),"ptr",this.__,"int*",retVal),"get_CachedIsDataValidForForm") 879 | return retVal 880 | } 881 | 882 | ; Retrieves a cached array of UI Automation elements for which this element serves as the controller. 883 | CachedControllerFor(){ 884 | UIA_Error(DllCall(this.vt(80),"ptr",this.__,"ptr*",retVal),"get_CachedControllerFor") 885 | return new IUIAutomationElementArray(retVal) ; IUIAutomationElementArray 886 | } 887 | 888 | ; Retrieves a cached array of elements that describe this element. 889 | CachedDescribedBy(){ 890 | UIA_Error(DllCall(this.vt(81),"ptr",this.__,"ptr*",retVal),"get_CachedDescribedBy") 891 | return new IUIAutomationElementArray(retVal) ; IUIAutomationElementArray 892 | } 893 | 894 | ; Retrieves a cached array of elements that indicate the reading order after the current element. 895 | CachedFlowsTo(){ 896 | UIA_Error(DllCall(this.vt(82),"ptr",this.__,"ptr*",retVal),"get_CachedFlowsTo") 897 | return new IUIAutomationElementArray(retVal) ; IUIAutomationElementArray 898 | } 899 | 900 | ; Retrieves a cached description of the provider for this element. 901 | CachedProviderDescription(){ 902 | UIA_Error(DllCall(this.vt(83),"ptr",this.__,"ptr*",retVal),"get_CachedProviderDescription") 903 | return StrGet(retVal,"utf-16") 904 | } 905 | 906 | ; Retrieves a point on the element that can be clicked. 907 | ; A client application can use this method to simulate clicking the left or right mouse button. For example, to simulate clicking the right mouse button to display the context menu for a control: 908 | ; • Call the GetClickablePoint method to find a clickable point on the control. 909 | ; • Call the SendInput function to send a right-mouse-down, right-mouse-up sequence. 910 | GetClickablePoint(){ 911 | UIA_Error(DllCall(this.vt(84),"ptr",this.__,"int64*",clickable,"int*",gotClickable),"GetClickablePoint") 912 | return [clickable,gotClickable] 913 | } 914 | } 915 | 916 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 917 | ;;IUIAutomationElementArray;; 918 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 919 | 920 | class IUIAutomationElementArray extends IBase 921 | { 922 | ; Retrieves the number of elements in the collection. 923 | Length(){ 924 | UIA_Error(DllCall(this.vt(3),"ptr",this.__,"int*",length),"get_Length") 925 | return length 926 | } 927 | 928 | ; Retrieves a Microsoft UI Automation element from the collection. 929 | Element(index){ ; zero-based 930 | UIA_Error(DllCall(this.vt(4),"ptr",this.__,"int",index,"ptr*",element),"GetElement") 931 | return new IUIAutomationElement(element) 932 | } 933 | } 934 | 935 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 936 | ;;IUIAutomationCacheRequest;; 937 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 938 | 939 | class IUIAutomationCacheRequest extends IBase 940 | { 941 | __get(aName){ 942 | if (aName="TreeScope"){ 943 | UIA_Error(DllCall(this.vt(6),"ptr",this.__,"int*",scope),"get_TreeScope") 944 | return scope ; TreeScope 945 | }else if (aName="TreeFilter"){ 946 | UIA_Error(DllCall(this.vt(8),"ptr",this.__,"ptr*",filter),"get_TreeFilter") 947 | return filter ; IUIAutomationCondition 948 | }else if (aName="AutomationElementMode"){ 949 | UIA_Error(DllCall(this.vt(10),"ptr",this.__,"int*",mode),"get_AutomationElementMode") 950 | return mode ; AutomationElementMode 951 | } 952 | } 953 | __set(aName,aValue){ 954 | if (aName="TreeScope") 955 | return UIA_Error(DllCall(this.vt(7),"ptr",this.__,"int",aValue),"put_TreeScope") 956 | else if (aName="TreeFilter") 957 | return UIA_Error(DllCall(this.vt(9),"ptr",this.__,"ptr",aValue),"put_TreeFilter") 958 | else if (aName="AutomationElementMode") 959 | return UIA_Error(DllCall(this.vt(11),"ptr",this.__,"int",aValue),"put_AutomationElementMode") 960 | } 961 | 962 | ; Adds a property to the cache request. 963 | AddProperty(propertyId){ 964 | if IsObject(propertyId) 965 | loop % propertyId.maxindex() 966 | UIA_Error(DllCall(this.vt(3),"ptr",this.__,"int",propertyId[A_Index]),"AddProperty") 967 | else return UIA_Error(DllCall(this.vt(3),"ptr",this.__,"int",propertyId),"AddProperty") 968 | } 969 | 970 | ; Adds a control pattern to the cache request. Adding a control pattern that is already in the cache request has no effect. 971 | AddPattern(patternId){ 972 | if IsObject(patternId) 973 | loop % patternId.maxindex() 974 | UIA_Error(DllCall(this.vt(4),"ptr",this.__,"int",patternId[A_Index]),"AddPattern") 975 | else return UIA_Error(DllCall(this.vt(4),"ptr",this.__,"int",patternId),"AddPattern") 976 | } 977 | 978 | ; Creates a copy of the cache request. 979 | Clone(){ 980 | UIA_Error(DllCall(this.vt(5),"ptr",this.__,"ptr*",clonedRequest),"Clone") 981 | return new IUIAutomationCacheRequest(clonedRequest) ; IUIAutomationCacheRequest 982 | } 983 | 984 | ; TreeScope Specifies the scope of caching. 985 | ; When an element is retrieved, caching can be performed for only the element itself (the default behavior), or for the element and its children or descendants. This property describes the scope of the request. 986 | 987 | ; TreeFilter Specifies the view of the UI Automation element tree that is used when caching. 988 | 989 | ; AutomationElementMode Indicates whether returned elements contain full references to the underlying UI, or only cached information. 990 | ; AutomationElementMode_Full is the default value, and specifies that returned elements contain a full reference to the underlying UI. AutomationElementMode_None specifies that the returned elements have no reference to the underlying UI, and contain only cached information. 991 | ; Certain operations on elements, including GetCurrentPropertyValue, and SetFocus, require a full reference; attempting to perform these on an element that has none results in an error. 992 | ; Using AutomationElementMode_None can be more efficient when only properties are needed, as it avoids the overhead involved in setting up full references. 993 | } 994 | 995 | ;;;;;;;;;;;;;;;;;;;;;;;;;; 996 | ;;IUIAutomationCondition;; 997 | ;;;;;;;;;;;;;;;;;;;;;;;;;; 998 | 999 | class IUIAutomationCondition extends IBase 1000 | { 1001 | } 1002 | 1003 | class IUIAutomationBoolCondition extends IBase 1004 | { 1005 | ; Retrieves the value of the condition: either TRUE or FALSE. 1006 | value(){ 1007 | UIA_Error(DllCall(this.vt(3),"ptr",this.__,"int*",boolVal),"get_BooleanValue") 1008 | return boolVal 1009 | } 1010 | } 1011 | 1012 | class IUIAutomationPropertyCondition extends IBase 1013 | { 1014 | 1015 | ; Retrieves the identifier of the property on which this condition is based. 1016 | id(){ 1017 | UIA_Error(DllCall(this.vt(3),"ptr",this.__,"int*",propertyId),"get_PropertyId") 1018 | return propertyId 1019 | } 1020 | 1021 | ; Retrieves the property value that must be matched for the condition to be true. 1022 | value(){ 1023 | static _,propertyValue:=variant(_) 1024 | UIA_Error(DllCall(this.vt(4),"ptr",this.__,"ptr",propertyValue),"get_PropertyValue") 1025 | return GetVariantValue(propertyValue) ; 1026 | } 1027 | 1028 | ; Retrieves a set of flags that specify how the condition is applied. 1029 | flags(){ 1030 | UIA_Error(DllCall(this.vt(5),"ptr",this.__,"int*",flags),"get_PropertyConditionFlags") 1031 | return flags ; PropertyConditionFlags 1032 | } 1033 | } 1034 | 1035 | class IUIAutomationAndCondition extends IBase 1036 | { 1037 | ; Retrieves the number of conditions that make up this condition. 1038 | count(){ 1039 | UIA_Error(DllCall(this.vt(3),"ptr",this.__,"int*",childCount),"get_ChildCount") 1040 | return childCount 1041 | } 1042 | 1043 | ; Retrieves the conditions that make up this condition, as an ordinary array. 1044 | ChildrenAsNativeArray(){ 1045 | UIA_Error(DllCall(this.vt(4),"ptr",this.__,"ptr*",childArray,"int*",childArrayCount),"GetChildrenAsNativeArray") 1046 | return [childArray,childArrayCount] 1047 | } 1048 | 1049 | ; Retrieves the conditions that make up this condition. 1050 | Children(){ 1051 | UIA_Error(DllCall(this.vt(5),"ptr",this.__,"ptr*",childArray),"GetChildren") 1052 | return childArray ; SafeArray , iunknown 1053 | } 1054 | } 1055 | 1056 | class IUIAutomationOrCondition extends IBase 1057 | { 1058 | ; Retrieves the number of conditions that make up this condition. 1059 | count(){ 1060 | UIA_Error(DllCall(this.vt(3),"ptr",this.__,"int*",childCount),"get_ChildCount") 1061 | return childCount 1062 | } 1063 | 1064 | ; Retrieves the conditions that make up this condition, as an ordinary array. 1065 | ChildrenAsNativeArray(){ 1066 | UIA_Error(DllCall(this.vt(4),"ptr",this.__,"ptr*",childArray,"int*",childArrayCount),"GetChildrenAsNativeArray") 1067 | return [childArray,childArrayCount] 1068 | } 1069 | 1070 | ; Retrieves the conditions that make up this condition. 1071 | Children(){ 1072 | UIA_Error(DllCall(this.vt(5),"ptr",this.__,"ptr*",childArray),"GetChildren") 1073 | return childArray ; SafeArray , iunknown 1074 | } 1075 | } 1076 | 1077 | class IUIAutomationNotCondition extends IBase 1078 | { 1079 | ; Retrieves the condition of which this condition is the negative. The returned condition is the one that was used in creating this condition. 1080 | Child(){ 1081 | UIA_Error(DllCall(this.vt(3),"ptr",this.__,"ptr*",condition),"GetChild") 1082 | return new IUIAutomationCondition(condition) 1083 | } 1084 | } 1085 | 1086 | ;;;;;;;;;;;;;;;;;;;;;;;;;;; 1087 | ;;IUIAutomationTreeWalker;; 1088 | ;;;;;;;;;;;;;;;;;;;;;;;;;;; 1089 | 1090 | class IUIAutomationTreeWalker extends IBase 1091 | { 1092 | ; The structure of the Microsoft UI Automation tree changes as the visible UI elements on the desktop change. 1093 | ; An element can have additional child elements that do not match the current view condition and thus are not returned when navigating the element tree. 1094 | 1095 | ; Retrieves the parent element of the specified UI Automation element. 1096 | GetParentElement(element){ 1097 | UIA_Error(DllCall(this.vt(3),"ptr",this.__,"ptr",element.__,"ptr*",parent),"ParentElement") 1098 | return new IUIAutomationElement(parent) 1099 | } 1100 | 1101 | ; Retrieves the first child element of the specified UI Automation element. 1102 | GetFirstChildElement(element){ 1103 | UIA_Error(DllCall(this.vt(4),"ptr",this.__,"ptr",element.__,"ptr*",first),"FirstChildElement") 1104 | return new IUIAutomationElement(first) 1105 | } 1106 | 1107 | ; Retrieves the last child element of the specified UI Automation element. 1108 | GetLastChildElement(element){ 1109 | UIA_Error(DllCall(this.vt(5),"ptr",this.__,"ptr",element.__,"ptr*",last),"LastChildElement") 1110 | return new IUIAutomationElement(last) 1111 | } 1112 | 1113 | ; Retrieves the next sibling element of the specified UI Automation element, and caches properties and control patterns. 1114 | GetNextSiblingElement(element){ 1115 | UIA_Error(DllCall(this.vt(6),"ptr",this.__,"ptr",element.__,"ptr*",next),"NextSiblingElement") 1116 | return new IUIAutomationElement(next) 1117 | } 1118 | 1119 | ; Retrieves the previous sibling element of the specified UI Automation element, and caches properties and control patterns. 1120 | GetPreviousSiblingElement(element){ 1121 | UIA_Error(DllCall(this.vt(7),"ptr",this.__,"ptr",element.__,"ptr*",previous),"PreviousSiblingElement") 1122 | return new IUIAutomationElement(previous) 1123 | } 1124 | 1125 | ; Retrieves the ancestor element nearest to the specified Microsoft UI Automation element in the tree view. 1126 | ; The element is normalized by navigating up the ancestor chain in the tree until an element that satisfies the view condition (specified by a previous call to IUIAutomationTreeWalker::Condition) is reached. If the root element is reached, the root element is returned, even if it does not satisfy the view condition. 1127 | ; This method is useful for applications that obtain references to UI Automation elements by hit-testing. The application might want to work only with specific types of elements, and can use IUIAutomationTreeWalker::Normalize to make sure that no matter what element is initially retrieved (for example, when a scroll bar gets the input focus), only the element of interest (such as a content element) is ultimately retrieved. 1128 | NormalizeElement(element){ 1129 | UIA_Error(DllCall(this.vt(8),"ptr",this.__,"ptr",element.__,"ptr*",normalized),"NormalizeElement") 1130 | return normalized 1131 | } 1132 | 1133 | ; Retrieves the parent element of the specified UI Automation element, and caches properties and control patterns. 1134 | GetParentElementBuildCache(element,cacheRequest){ 1135 | UIA_Error(DllCall(this.vt(9),"ptr",this.__,"ptr",element.__,"ptr",cacheRequest.__,"ptr*",parent),"ParentElementBuildCache") 1136 | return new IUIAutomationElement(parent) 1137 | } 1138 | 1139 | ; Retrieves the first child element of the specified UI Automation element, and caches properties and control patterns. 1140 | GetFirstChildElementBuildCache(element,cacheRequest){ 1141 | UIA_Error(DllCall(this.vt(10),"ptr",this.__,"ptr",element.__,"ptr",cacheRequest.__,"ptr*",first),"FirstChildElementBuildCache") 1142 | return new IUIAutomationElement(first) 1143 | } 1144 | 1145 | ; Retrieves the last child element of the specified UI Automation element, and caches properties and control patterns. 1146 | GetLastChildElementBuildCache(element,cacheRequest){ 1147 | UIA_Error(DllCall(this.vt(11),"ptr",this.__,"ptr",element.__,"ptr",cacheRequest.__,"ptr*",last),"LastChildElementBuildCache") 1148 | return new IUIAutomationElement(last) 1149 | } 1150 | 1151 | ; Retrieves the next sibling element of the specified UI Automation element, and caches properties and control patterns. 1152 | GetNextSiblingElementBuildCache(element,cacheRequest){ 1153 | UIA_Error(DllCall(this.vt(12),"ptr",this.__,"ptr",element.__,"ptr",cacheRequest.__,"ptr*",next),"NextSiblingElementBuildCache") 1154 | return new IUIAutomationElement(next) 1155 | } 1156 | 1157 | ; Retrieves the previous sibling element of the specified UI Automation element, and caches properties and control patterns. 1158 | GetPreviousSiblingElementBuildCache(element,cacheRequest){ 1159 | UIA_Error(DllCall(this.vt(13),"ptr",this.__,"ptr",element.__,"ptr",cacheRequest.__,"ptr*",previous),"PreviousSiblingElementBuildCache") 1160 | return new IUIAutomationElement(previous) 1161 | } 1162 | 1163 | ; Retrieves the ancestor element nearest to the specified Microsoft UI Automation element in the tree view, prefetches the requested properties and control patterns, and stores the prefetched items in the cache. 1164 | NormalizeElementBuildCache(element,cacheRequest){ 1165 | UIA_Error(DllCall(this.vt(14),"ptr",this.__,"ptr",element.__,"ptr",cacheRequest.__,"ptr*",normalized),"NormalizeElementBuildCache") 1166 | return new IUIAutomationElement(normalized) 1167 | } 1168 | 1169 | ; Retrieves the condition that defines the view of the UI Automation tree. This property is read-only. 1170 | ; The condition that defines the view. This is the interface that was passed to CreateTreeWalker. 1171 | Condition(){ 1172 | UIA_Error(DllCall(this.vt(15),"ptr",this.__,"ptr*",condition),"_Condition") 1173 | return new IUIAutomationCondition(condition) 1174 | } 1175 | } 1176 | 1177 | ;;;;;;;;;;;;;;;;;;;;;;;; 1178 | ;;IUIAutomationPattern;; 1179 | ;;;;;;;;;;;;;;;;;;;;;;;; 1180 | 1181 | class IUIAutomationInvokePattern extends IBase 1182 | { 1183 | ; Invokes the action of a control, such as a button click. 1184 | ; Calls to this method should return immediately without blocking. However, this behavior depends on the implementation. 1185 | Invoke(){ 1186 | return UIA_Error(DllCall(this.vt(3),"ptr",this.__),"Invoke") 1187 | } 1188 | 1189 | } 1190 | class IUIAutomationDockPattern extends IBase 1191 | { 1192 | ; Sets the dock position of this element. 1193 | SetDockPosition(dockPos){ ; DockPosition 1194 | return UIA_Error(DllCall(this.vt(3),"ptr",this.__,"int",dockPos),"SetDockPosition") 1195 | } 1196 | 1197 | ; Retrieves the dock position of this element within its docking container. 1198 | CurrentDockPosition(){ 1199 | UIA_Error(DllCall(this.vt(4),"ptr",this.__,"int*",retVal),"CurrentDockPosition") 1200 | return retVal ; DockPosition 1201 | } 1202 | 1203 | ; Retrieves the cached dock position of this element within its docking container. 1204 | CachedDockPosition(){ 1205 | UIA_Error(DllCall(this.vt(5),"ptr",this.__,"int*",retVal),"CachedDockPosition") 1206 | return retVal ; DockPosition 1207 | } 1208 | } 1209 | class IUIAutomationExpandCollapsePattern extends IBase 1210 | { 1211 | ; This is a blocking method that returns after the element has been collapsed. 1212 | ; There are cases when a element that is marked as a leaf node might not know whether it has children until either the IUIAutomationExpandCollapsePattern::Collapse or the IUIAutomationExpandCollapsePattern::Expand method is called. This behavior is possible with a tree view control that does delayed loading of its child items. For example, Microsoft Windows Explorer might display the expand icon for a node even though there are currently no child items; when the icon is clicked, the control polls for child items, finds none, and removes the expand icon. In these cases clients should listen for a property-changed event on the IUIAutomationExpandCollapsePattern::CurrentExpandCollapseState property. 1213 | 1214 | ; Displays all child nodes, controls, or content of the element. 1215 | Expand(){ 1216 | return UIA_Error(DllCall(this.vt(3),"ptr",this.__),"Expand") 1217 | } 1218 | 1219 | ; Hides all child nodes, controls, or content of the element. 1220 | Collapse(){ 1221 | return UIA_Error(DllCall(this.vt(4),"ptr",this.__),"Collapse") 1222 | } 1223 | 1224 | ; Retrieves a value that indicates the state, expanded or collapsed, of the element. 1225 | CurrentExpandCollapseState(){ 1226 | UIA_Error(DllCall(this.vt(5),"ptr",this.__,"int*",retVal),"CurrentExpandCollapseState") 1227 | return retVal ; ExpandCollapseState 1228 | } 1229 | 1230 | ; Retrieves a cached value that indicates the state, expanded or collapsed, of the element. 1231 | CachedExpandCollapseState(){ 1232 | UIA_Error(DllCall(this.vt(6),"ptr",this.__,"int*",retVal),"CachedExpandCollapseState") 1233 | return retVal ; ExpandCollapseState 1234 | } 1235 | } 1236 | class IUIAutomationGridPattern extends IBase 1237 | { 1238 | ; Retrieves a UI Automation element representing an item in the grid. 1239 | GetItem(row,column){ 1240 | UIA_Error(DllCall(this.vt(3),"ptr",this.__,"int",row,"int",column,"ptr*",element),"GetItem") 1241 | return new IUIAutomationGridItemPattern(element) 1242 | } 1243 | 1244 | ; Hidden rows and columns, depending on the provider implementation, may be loaded in the Microsoft UI Automation tree and will therefore be reflected in the row count and column count properties. If the hidden rows and columns have not yet been loaded they are not counted. 1245 | 1246 | ; Retrieves the number of rows in the grid. 1247 | CurrentRowCount(){ 1248 | UIA_Error(DllCall(this.vt(4),"ptr",this.__,"int*",retVal),"CurrentRowCount") 1249 | return retVal 1250 | } 1251 | 1252 | ; The number of columns in the grid. 1253 | CurrentColumnCount(){ 1254 | UIA_Error(DllCall(this.vt(5),"ptr",this.__,"int*",retVal),"CurrentColumnCount") 1255 | return retVal 1256 | } 1257 | 1258 | ; Retrieves the cached number of rows in the grid. 1259 | CachedRowCount(){ 1260 | UIA_Error(DllCall(this.vt(6),"ptr",this.__,"int*",retVal),"CachedRowCount") 1261 | return retVal 1262 | } 1263 | 1264 | ; Retrieves the cached number of columns in the grid. 1265 | CachedColumnCount(){ 1266 | UIA_Error(DllCall(this.vt(7),"ptr",this.__,"int*",retVal),"CachedColumnCount") 1267 | return retVal 1268 | } 1269 | } 1270 | class IUIAutomationGridItemPattern extends IBase 1271 | { 1272 | ; Retrieves the element that contains the grid item. 1273 | CurrentContainingGrid(){ 1274 | UIA_Error(DllCall(this.vt(3),"ptr",this.__,"ptr*",retVal),"CurrentContainingGrid") 1275 | return retVal 1276 | } 1277 | 1278 | ; Retrieves the zero-based index of the row that contains the grid item. 1279 | CurrentRow(){ 1280 | UIA_Error(DllCall(this.vt(4),"ptr",this.__,"int*",retVal),"CurrentRow") 1281 | return retVal 1282 | } 1283 | 1284 | ; Retrieves the zero-based index of the column that contains the item. 1285 | CurrentColumn(){ 1286 | UIA_Error(DllCall(this.vt(5),"ptr",this.__,"int*",retVal),"CurrentColumn") 1287 | return retVal 1288 | } 1289 | 1290 | ; Retrieves the number of rows spanned by the grid item. 1291 | CurrentRowSpan(){ 1292 | UIA_Error(DllCall(this.vt(6),"ptr",this.__,"int*",retVal),"CurrentRowSpan") 1293 | return retVal 1294 | } 1295 | 1296 | ; Retrieves the number of columns spanned by the grid item. 1297 | CurrentColumnSpan(){ 1298 | UIA_Error(DllCall(this.vt(7),"ptr",this.__,"int*",retVal),"CurrentColumnSpan") 1299 | return retVal 1300 | } 1301 | 1302 | ; Retrieves the cached element that contains the grid item. 1303 | CachedContainingGrid(){ 1304 | UIA_Error(DllCall(this.vt(8),"ptr",this.__,"ptr*",retVal),"CachedContainingGrid") 1305 | return retVal 1306 | } 1307 | 1308 | ; Retrieves the cached zero-based index of the row that contains the item. 1309 | CachedRow(){ 1310 | UIA_Error(DllCall(this.vt(9),"ptr",this.__,"int*",retVal),"CachedRow") 1311 | return retVal 1312 | } 1313 | 1314 | ; Retrieves the cached zero-based index of the column that contains the grid item. 1315 | CachedColumn(){ 1316 | UIA_Error(DllCall(this.vt(10),"ptr",this.__,"int*",retVal),"CachedColumn") 1317 | return retVal 1318 | } 1319 | 1320 | ; Retrieves the cached number of rows spanned by a grid item. 1321 | CachedRowSpan(){ 1322 | UIA_Error(DllCall(this.vt(11),"ptr",this.__,"int*",retVal),"CachedRowSpan") 1323 | return retVal 1324 | } 1325 | 1326 | ; Retrieves the cached number of columns spanned by the grid item. 1327 | CachedColumnSpan(){ 1328 | UIA_Error(DllCall(this.vt(12),"ptr",this.__,"int*",retVal),"CachedColumnSpan") 1329 | return retVal 1330 | } 1331 | } 1332 | class IUIAutomationMultipleViewPattern extends IBase 1333 | { 1334 | ; Retrieves the name of a control-specific view. 1335 | GetViewName(view){ 1336 | UIA_Error(DllCall(this.vt(3),"ptr",this.__,"int",view,"ptr*",name),"GetViewName") 1337 | return StrGet(name,"utf-16") 1338 | } 1339 | 1340 | ; Sets the view of the control. 1341 | SetCurrentView(view){ 1342 | return UIA_Error(DllCall(this.vt(4),"ptr",this.__,"int",view),"SetCurrentView") 1343 | } 1344 | 1345 | ; Retrieves the control-specific identifier of the current view of the control. 1346 | CurrentCurrentView(){ 1347 | UIA_Error(DllCall(this.vt(5),"ptr",this.__,"int*",retVal),"CurrentCurrentView") 1348 | return retVal 1349 | } 1350 | 1351 | ; Retrieves a collection of control-specific view identifiers. 1352 | GetCurrentSupportedViews(){ 1353 | UIA_Error(DllCall(this.vt(6),"ptr",this.__,"ptr*",retVal),"GetCurrentSupportedViews") 1354 | return GetSafeArrayValue(retVal,3) 1355 | } 1356 | 1357 | ; Retrieves the cached control-specific identifier of the current view of the control. 1358 | CachedCurrentView(){ 1359 | UIA_Error(DllCall(this.vt(7),"ptr",this.__,"int*",retVal),"CachedCurrentView") 1360 | return retVal 1361 | } 1362 | 1363 | ; Retrieves a collection of control-specific view identifiers from the cache. 1364 | GetCachedSupportedViews(){ 1365 | UIA_Error(DllCall(this.vt(8),"ptr",this.__,"ptr*",retVal),"GetCachedSupportedViews") 1366 | return GetSafeArrayValue(retVal,3) 1367 | } 1368 | } 1369 | class IUIAutomationRangeValuePattern extends IBase 1370 | { 1371 | ; Sets the value of the control. 1372 | SetValue(val){ 1373 | return UIA_Error(DllCall(this.vt(3),"ptr",this.__,"double",val),"SetValue") 1374 | } 1375 | 1376 | ; Retrieves the value of the control. 1377 | CurrentValue(){ 1378 | UIA_Error(DllCall(this.vt(4),"ptr",this.__,"double*",retVal),"CurrentValue") 1379 | return retVal 1380 | } 1381 | 1382 | ; Indicates whether the value of the element can be changed. 1383 | CurrentIsReadOnly(){ 1384 | UIA_Error(DllCall(this.vt(5),"ptr",this.__,"int*",retVal),"CurrentIsReadOnly") 1385 | return retVal 1386 | } 1387 | 1388 | ; Retrieves the maximum value of the control. 1389 | CurrentMaximum(){ 1390 | UIA_Error(DllCall(this.vt(6),"ptr",this.__,"double*",retVal),"CurrentMaximum") 1391 | return retVal 1392 | } 1393 | 1394 | ; Retrieves the minimum value of the control. 1395 | CurrentMinimum(){ 1396 | UIA_Error(DllCall(this.vt(7),"ptr",this.__,"double*",retVal),"CurrentMinimum") 1397 | return retVal 1398 | } 1399 | 1400 | ; The LargeChange and SmallChange property can support a Not a Number (NaN) value. When retrieving this property, a client can use the _isnan function to determine whether the property is a NaN value. 1401 | 1402 | ; Retrieves the value that is added to or subtracted from the value of the control when a large change is made, such as when the PAGE DOWN key is pressed. 1403 | CurrentLargeChange(){ 1404 | UIA_Error(DllCall(this.vt(8),"ptr",this.__,"double*",retVal),"CurrentLargeChange") 1405 | return retVal 1406 | } 1407 | 1408 | ; Retrieves the value that is added to or subtracted from the value of the control when a small change is made, such as when an arrow key is pressed. 1409 | CurrentSmallChange(){ 1410 | UIA_Error(DllCall(this.vt(9),"ptr",this.__,"double*",retVal),"CurrentSmallChange") 1411 | return retVal 1412 | } 1413 | 1414 | ; Retrieves the cached value of the control. 1415 | CachedValue(){ 1416 | UIA_Error(DllCall(this.vt(10),"ptr",this.__,"double*",retVal),"CachedValue") 1417 | return retVal 1418 | } 1419 | 1420 | ; Retrieves a cached value that indicates whether the value of the element can be changed. 1421 | CachedIsReadOnly(){ 1422 | UIA_Error(DllCall(this.vt(11),"ptr",this.__,"int*",retVal),"CachedIsReadOnly") 1423 | return retVal 1424 | } 1425 | 1426 | ; Retrieves the cached maximum value of the control. 1427 | CachedMaximum(){ 1428 | UIA_Error(DllCall(this.vt(12),"ptr",this.__,"double*",retVal),"CachedMaximum") 1429 | return retVal 1430 | } 1431 | 1432 | ; Retrieves the cached minimum value of the control. 1433 | CachedMinimum(){ 1434 | UIA_Error(DllCall(this.vt(13),"ptr",this.__,"double*",retVal),"CachedMinimum") 1435 | return retVal 1436 | } 1437 | 1438 | ; Retrieves, from the cache, the value that is added to or subtracted from the value of the control when a large change is made, such as when the PAGE DOWN key is pressed. 1439 | CachedLargeChange(){ 1440 | UIA_Error(DllCall(this.vt(14),"ptr",this.__,"double*",retVal),"CachedLargeChange") 1441 | return retVal 1442 | } 1443 | 1444 | ; Retrieves, from the cache, the value that is added to or subtracted from the value of the control when a small change is made, such as when an arrow key is pressed. 1445 | CachedSmallChange(){ 1446 | UIA_Error(DllCall(this.vt(15),"ptr",this.__,"double*",retVal),"CachedSmallChange") 1447 | return retVal 1448 | } 1449 | } 1450 | class IUIAutomationScrollPattern extends IBase 1451 | { 1452 | ; Scrolls the visible region of the content area horizontally and vertically. 1453 | Scroll(horizontalAmount,verticalAmount){ 1454 | return UIA_Error(DllCall(this.vt(3),"ptr",this.__,"int",horizontalAmount,"int",verticalAmount),"Scroll") 1455 | } 1456 | 1457 | ; Sets the horizontal and vertical scroll positions as a percentage of the total content area within the UI Automation element. 1458 | ; This method is useful only when the content area of the control is larger than the visible region. 1459 | SetScrollPercent(horizontalPercent,verticalPercent){ 1460 | return UIA_Error(DllCall(this.vt(4),"ptr",this.__,"double",horizontalPercent,"double",verticalPercent),"SetScrollPercent") 1461 | } 1462 | 1463 | ; Retrieves the horizontal scroll position. 1464 | CurrentHorizontalScrollPercent(){ 1465 | UIA_Error(DllCall(this.vt(5),"ptr",this.__,"double*",retVal),"CurrentHorizontalScrollPercent") 1466 | return retVal 1467 | } 1468 | 1469 | ; Retrieves the vertical scroll position. 1470 | CurrentVerticalScrollPercent(){ 1471 | UIA_Error(DllCall(this.vt(6),"ptr",this.__,"double*",retVal),"CurrentVerticalScrollPercent") 1472 | return retVal 1473 | } 1474 | 1475 | ; Retrieves the horizontal size of the viewable region of a scrollable element. 1476 | CurrentHorizontalViewSize(){ 1477 | UIA_Error(DllCall(this.vt(7),"ptr",this.__,"double*",retVal),"CurrentHorizontalViewSize") 1478 | return retVal 1479 | } 1480 | 1481 | ; Retrieves the vertical size of the viewable region of a scrollable element. 1482 | CurrentVerticalViewSize(){ 1483 | UIA_Error(DllCall(this.vt(8),"ptr",this.__,"double*",retVal),"CurrentVerticalViewSize") 1484 | return retVal 1485 | } 1486 | 1487 | ; Indicates whether the element can scroll horizontally. 1488 | ; This property can be dynamic. For example, the content area of the element might not be larger than the current viewable area, meaning that the property is FALSE. However, resizing the element or adding child items can increase the bounds of the content area beyond the viewable area, making the property TRUE. 1489 | CurrentHorizontallyScrollable(){ 1490 | UIA_Error(DllCall(this.vt(9),"ptr",this.__,"int*",retVal),"CurrentHorizontallyScrollable") 1491 | return retVal 1492 | } 1493 | 1494 | ; Indicates whether the element can scroll vertically. 1495 | CurrentVerticallyScrollable(){ 1496 | UIA_Error(DllCall(this.vt(10),"ptr",this.__,"int*",retVal),"CurrentVerticallyScrollable") 1497 | return retVal 1498 | } 1499 | 1500 | ; Retrieves the cached horizontal scroll position. 1501 | CachedHorizontalScrollPercent(){ 1502 | UIA_Error(DllCall(this.vt(11),"ptr",this.__,"double*",retVal),"CachedHorizontalScrollPercent") 1503 | return retVal 1504 | } 1505 | 1506 | ; Retrieves the cached vertical scroll position. 1507 | CachedVerticalScrollPercent(){ 1508 | UIA_Error(DllCall(this.vt(12),"ptr",this.__,"double*",retVal),"CachedVerticalScrollPercent") 1509 | return retVal 1510 | } 1511 | 1512 | ; Retrieves the cached horizontal size of the viewable region of a scrollable element. 1513 | CachedHorizontalViewSize(){ 1514 | UIA_Error(DllCall(this.vt(13),"ptr",this.__,"double*",retVal),"CachedHorizontalViewSize") 1515 | return retVal 1516 | } 1517 | 1518 | ; Retrieves the cached vertical size of the viewable region of a scrollable element. 1519 | CachedVerticalViewSize(){ 1520 | UIA_Error(DllCall(this.vt(14),"ptr",this.__,"double*",retVal),"CachedVerticalViewSize") 1521 | return retVal 1522 | } 1523 | 1524 | ; Retrieves a cached value that indicates whether the element can scroll horizontally. 1525 | CachedHorizontallyScrollable(){ 1526 | UIA_Error(DllCall(this.vt(15),"ptr",this.__,"int*",retVal),"CachedHorizontallyScrollable") 1527 | return retVal 1528 | } 1529 | 1530 | ; Retrieves a cached value that indicates whether the element can scroll vertically. 1531 | CachedVerticallyScrollable(){ 1532 | UIA_Error(DllCall(this.vt(16),"ptr",this.__,"int*",retVal),"CachedVerticallyScrollable") 1533 | return retVal 1534 | } 1535 | } 1536 | class IUIAutomationScrollItemPattern extends IBase 1537 | { 1538 | ; Scrolls the content area of a container object to display the UI Automation element within the visible region (viewport) of the container. 1539 | ; This method does not provide the ability to specify the position of the element within the viewport. 1540 | ScrollIntoView(){ 1541 | return UIA_Error(DllCall(this.vt(3),"ptr",this.__),"ScrollIntoView") 1542 | } 1543 | } 1544 | class IUIAutomationSelectionPattern extends IBase 1545 | { 1546 | ; Retrieves the selected elements in the container. 1547 | GetCurrentSelection(){ 1548 | UIA_Error(DllCall(this.vt(3),"ptr",this.__,"ptr*",retVal),"GetCurrentSelection") 1549 | return retVal 1550 | } 1551 | 1552 | ; Indicates whether more than one item in the container can be selected at one time. 1553 | CurrentCanSelectMultiple(){ 1554 | UIA_Error(DllCall(this.vt(4),"ptr",this.__,"int*",retVal),"CurrentCanSelectMultiple") 1555 | return retVal 1556 | } 1557 | 1558 | ; Indicates whether at least one item must be selected at all times. 1559 | CurrentIsSelectionRequired(){ 1560 | UIA_Error(DllCall(this.vt(5),"ptr",this.__,"int*",retVal),"CurrentIsSelectionRequired") 1561 | return retVal 1562 | } 1563 | 1564 | ; Retrieves the cached selected elements in the container. 1565 | GetCachedSelection(){ 1566 | UIA_Error(DllCall(this.vt(6),"ptr",this.__,"ptr*",retVal),"GetCachedSelection") 1567 | return retVal 1568 | } 1569 | 1570 | ; Retrieves a cached value that indicates whether more than one item in the container can be selected at one time. 1571 | CachedCanSelectMultiple(){ 1572 | UIA_Error(DllCall(this.vt(7),"ptr",this.__,"int*",retVal),"CachedCanSelectMultiple") 1573 | return retVal 1574 | } 1575 | 1576 | ; Retrieves a cached value that indicates whether at least one item must be selected at all times. 1577 | CachedIsSelectionRequired(){ 1578 | UIA_Error(DllCall(this.vt(8),"ptr",this.__,"int*",retVal),"CachedIsSelectionRequired") 1579 | return retVal 1580 | } 1581 | } 1582 | class IUIAutomationSelectionItemPattern extends IBase 1583 | { 1584 | ; Clears any selected items and then selects the current element. 1585 | Select(){ 1586 | return UIA_Error(DllCall(this.vt(3),"ptr",this.__),"Select") 1587 | } 1588 | 1589 | ; Adds the current element to the collection of selected items. 1590 | AddToSelection(){ 1591 | return UIA_Error(DllCall(this.vt(4),"ptr",this.__),"AddToSelection") 1592 | } 1593 | 1594 | ; Removes this element from the selection. 1595 | ; An error code is returned if this element is the only one in the selection and the selection container requires at least one element to be selected. 1596 | RemoveFromSelection(){ 1597 | return UIA_Error(DllCall(this.vt(5),"ptr",this.__),"RemoveFromSelection") 1598 | } 1599 | 1600 | ; Indicates whether this item is selected. 1601 | CurrentIsSelected(){ 1602 | UIA_Error(DllCall(this.vt(6),"ptr",this.__,"int*",retVal),"CurrentIsSelected") 1603 | return retVal 1604 | } 1605 | 1606 | ; Retrieves the element that supports IUIAutomationSelectionPattern and acts as the container for this item. 1607 | CurrentSelectionContainer(){ 1608 | UIA_Error(DllCall(this.vt(7),"ptr",this.__,"ptr*",retVal),"CurrentSelectionContainer") 1609 | return retVal 1610 | } 1611 | 1612 | ; A cached value that indicates whether this item is selected. 1613 | CachedIsSelected(){ 1614 | UIA_Error(DllCall(this.vt(8),"ptr",this.__,"int*",retVal),"CachedIsSelected") 1615 | return retVal 1616 | } 1617 | 1618 | ; Retrieves the cached element that supports IUIAutomationSelectionPattern and acts as the container for this item. 1619 | CachedSelectionContainer(){ 1620 | UIA_Error(DllCall(this.vt(9),"ptr",this.__,"ptr*",retVal),"CachedSelectionContainer") 1621 | return retVal 1622 | } 1623 | } 1624 | class IUIAutomationSynchronizedInputPattern extends IBase 1625 | { 1626 | ; Causes the Microsoft UI Automation provider to start listening for mouse or keyboard input. 1627 | ; When matching input is found, the provider checks whether the target element matches the current element. If they match, the provider raises the UIA_InputReachedTargetEventId event; otherwise it raises the UIA_InputReachedOtherElementEventId or UIA_InputDiscardedEventId event. 1628 | ; After receiving input of the specified type, the provider stops checking for input and continues as normal. 1629 | ; If the provider is already listening for input, this method returns E_INVALIDOPERATION. 1630 | StartListening(inputType){ ; SynchronizedInputType 1631 | return UIA_Error(DllCall(this.vt(3),"ptr",this.__,"int",inputType),"StartListening") 1632 | } 1633 | 1634 | ; Causes the Microsoft UI Automation provider to stop listening for mouse or keyboard input. 1635 | Cancel(){ 1636 | return UIA_Error(DllCall(this.vt(4),"ptr",this.__),"Cancel") 1637 | } 1638 | } 1639 | class IUIAutomationTablePattern extends IBase 1640 | { 1641 | ; Retrieves a collection of UI Automation elements representing all the row headers in a table. 1642 | GetCurrentRowHeaders(){ 1643 | UIA_Error(DllCall(this.vt(3),"ptr",this.__,"ptr*",retVal),"GetCurrentRowHeaders") 1644 | return new IUIAutomationElementArray(retVal) 1645 | } 1646 | 1647 | ; Retrieves a collection of UI Automation elements representing all the column headers in a table. 1648 | GetCurrentColumnHeaders(){ 1649 | UIA_Error(DllCall(this.vt(4),"ptr",this.__,"ptr*",retVal),"GetCurrentColumnHeaders") 1650 | return new IUIAutomationElementArray(retVal) 1651 | } 1652 | 1653 | ; Retrieves the primary direction of traversal for the table. 1654 | CurrentRowOrColumnMajor(){ 1655 | UIA_Error(DllCall(this.vt(5),"ptr",this.__,"int*",retVal),"CurrentRowOrColumnMajor") 1656 | return retVal ;RowOrColumnMajor 1657 | } 1658 | 1659 | ; Retrieves a cached collection of UI Automation elements representing all the row headers in a table. 1660 | GetCachedRowHeaders(){ 1661 | UIA_Error(DllCall(this.vt(6),"ptr",this.__,"ptr*",retVal),"GetCachedRowHeaders") 1662 | return new IUIAutomationElementArray(retVal) 1663 | } 1664 | 1665 | ; Retrieves a cached collection of UI Automation elements representing all the column headers in a table. 1666 | GetCachedColumnHeaders(){ 1667 | UIA_Error(DllCall(this.vt(7),"ptr",this.__,"ptr*",retVal),"GetCachedColumnHeaders") 1668 | return new IUIAutomationElementArray(retVal) 1669 | } 1670 | 1671 | ; Retrieves the cached primary direction of traversal for the table. 1672 | CachedRowOrColumnMajor(){ 1673 | UIA_Error(DllCall(this.vt(8),"ptr",this.__,"int*",retVal),"CachedRowOrColumnMajor") 1674 | return retVal ; RowOrColumnMajor 1675 | } 1676 | } 1677 | class IUIAutomationTableItemPattern extends IBase 1678 | { 1679 | ; Retrieves the row headers associated with a table item or cell. 1680 | GetCurrentRowHeaderItems(){ 1681 | UIA_Error(DllCall(this.vt(3),"ptr",this.__,"ptr*",retVal),"GetCurrentRowHeaderItems") 1682 | return new IUIAutomationElementArray(retVal) 1683 | } 1684 | 1685 | ; Retrieves the column headers associated with a table item or cell. 1686 | GetCurrentColumnHeaderItems(){ 1687 | UIA_Error(DllCall(this.vt(4),"ptr",this.__,"ptr*",retVal),"GetCurrentColumnHeaderItems") 1688 | return new IUIAutomationElementArray(retVal) 1689 | } 1690 | 1691 | ; Retrieves the cached row headers associated with a table item or cell. 1692 | GetCachedRowHeaderItems(){ 1693 | UIA_Error(DllCall(this.vt(5),"ptr",this.__,"ptr*",retVal),"GetCachedRowHeaderItems") 1694 | return new IUIAutomationElementArray(retVal) 1695 | } 1696 | 1697 | ; Retrieves the cached column headers associated with a table item or cell. 1698 | GetCachedColumnHeaderItems(){ 1699 | UIA_Error(DllCall(this.vt(6),"ptr",this.__,"ptr*",retVal),"GetCachedColumnHeaderItems") 1700 | return new IUIAutomationElementArray(retVal) 1701 | } 1702 | } 1703 | class IUIAutomationTogglePattern extends IBase 1704 | { 1705 | ; Cycles through the toggle states of the control. 1706 | ; A control cycles through its states in this order: ToggleState_On, ToggleState_Off and, if supported, ToggleState_Indeterminate. 1707 | Toggle(){ 1708 | return UIA_Error(DllCall(this.vt(3),"ptr",this.__),"Toggle") 1709 | } 1710 | 1711 | ; Retrieves the state of the control. 1712 | CurrentToggleState(){ 1713 | UIA_Error(DllCall(this.vt(4),"ptr",this.__,"int*",retVal),"CurrentToggleState") 1714 | return retVal ; ToggleState 1715 | } 1716 | 1717 | ; Retrieves the cached state of the control. 1718 | CachedToggleState(){ 1719 | UIA_Error(DllCall(this.vt(5),"ptr",this.__,"int*",retVal),"CachedToggleState") 1720 | return retVal ; ToggleState 1721 | } 1722 | } 1723 | class IUIAutomationTransformPattern extends IBase 1724 | { 1725 | ; An element cannot be moved, resized or rotated such that its resulting screen location would be completely outside the coordinates of its container and inaccessible to the keyboard or mouse. For example, when a top-level window is moved completely off-screen or a child object is moved outside the boundaries of the container's viewport, the object is placed as close to the requested screen coordinates as possible with the top or left coordinates overridden to be within the container boundaries. 1726 | 1727 | ; Moves the UI Automation element. 1728 | Move(x,y){ 1729 | return UIA_Error(DllCall(this.vt(3),"ptr",this.__,"double",x,"double",y),"Move") 1730 | } 1731 | 1732 | ; Resizes the UI Automation element. 1733 | ; When called on a control that supports split panes, this method can have the side effect of resizing other contiguous panes. 1734 | Resize(width,height){ 1735 | return UIA_Error(DllCall(this.vt(4),"ptr",this.__,"double",width,"double",height),"Resize") 1736 | } 1737 | 1738 | ; Rotates the UI Automation element. 1739 | Rotate(degrees){ 1740 | return UIA_Error(DllCall(this.vt(5),"ptr",this.__,"double",degrees),"Rotate") 1741 | } 1742 | 1743 | ; Indicates whether the element can be moved. 1744 | CurrentCanMove(){ 1745 | UIA_Error(DllCall(this.vt(6),"ptr",this.__,"int*",retVal),"CurrentCanMove") 1746 | return retVal 1747 | } 1748 | 1749 | ; Indicates whether the element can be resized. 1750 | CurrentCanResize(){ 1751 | UIA_Error(DllCall(this.vt(7),"ptr",this.__,"int*",retVal),"CurrentCanResize") 1752 | return retVal 1753 | } 1754 | 1755 | ; Indicates whether the element can be rotated. 1756 | CurrentCanRotate(){ 1757 | UIA_Error(DllCall(this.vt(8),"ptr",this.__,"int*",retVal),"CurrentCanRotate") 1758 | return retVal 1759 | } 1760 | 1761 | ; Retrieves a cached value that indicates whether the element can be moved. 1762 | CachedCanMove(){ 1763 | UIA_Error(DllCall(this.vt(9),"ptr",this.__,"int*",retVal),"CachedCanMove") 1764 | return retVal 1765 | } 1766 | 1767 | ; Retrieves a cached value that indicates whether the element can be resized. 1768 | CachedCanResize(){ 1769 | UIA_Error(DllCall(this.vt(10),"ptr",this.__,"int*",retVal),"CachedCanResize") 1770 | return retVal 1771 | } 1772 | 1773 | ; Retrieves a cached value that indicates whether the element can be rotated. 1774 | CachedCanRotate(){ 1775 | UIA_Error(DllCall(this.vt(11),"ptr",this.__,"int*",retVal),"CachedCanRotate") 1776 | return retVal 1777 | } 1778 | } 1779 | class IUIAutomationValuePattern extends IBase 1780 | { 1781 | ; Sets the value of the element. 1782 | ; The CurrentIsEnabled property must be TRUE, and the IUIAutomationValuePattern::CurrentIsReadOnly property must be FALSE. 1783 | SetValue(val){ 1784 | UIA_Error(DllCall(this.vt(3),"ptr",this.__,"str",val),"SetValue") 1785 | return 1786 | } 1787 | 1788 | ; Retrieves the value of the element. 1789 | ; Single-line edit controls support programmatic access to their contents through IUIAutomationValuePattern. However, multiline edit controls do not support this control pattern, and their contents must be retrieved by using IUIAutomationTextPattern. 1790 | ; This property does not support the retrieval of formatting information or substring values. IUIAutomationTextPattern must be used in these scenarios as well. 1791 | CurrentValue(){ 1792 | UIA_Error(DllCall(this.vt(4),"ptr",this.__,"ptr*",retVal),"CurrentValue") 1793 | return StrGet(retVal,"utf-16") 1794 | } 1795 | 1796 | ; Indicates whether the value of the element is read-only. 1797 | CurrentIsReadOnly(){ 1798 | UIA_Error(DllCall(this.vt(5),"ptr",this.__,"int*",retVal),"CurrentIsReadOnly") 1799 | return retVal 1800 | } 1801 | 1802 | ; Retrieves the cached value of the element. 1803 | CachedValue(){ 1804 | UIA_Error(DllCall(this.vt(6),"ptr",this.__,"ptr*",retVal),"CachedValue") 1805 | return StrGet(retVal,"utf-16") 1806 | } 1807 | 1808 | ; Retrieves a cached value that indicates whether the value of the element is read-only. 1809 | ; This property must be TRUE for IUIAutomationValuePattern::SetValue to succeed. 1810 | CachedIsReadOnly(){ 1811 | UIA_Error(DllCall(this.vt(7),"ptr",this.__,"int*",retVal),"CachedIsReadOnly") 1812 | return retVal 1813 | } 1814 | } 1815 | class IUIAutomationWindowPattern extends IBase 1816 | { 1817 | ; Closes the window. 1818 | ; When called on a split pane control, this method closes the pane and removes the associated split. This method may also close all other panes, depending on implementation. 1819 | Close(){ 1820 | return UIA_Error(DllCall(this.vt(3),"ptr",this.__),"Close") 1821 | } 1822 | 1823 | ; Causes the calling code to block for the specified time or until the associated process enters an idle state, whichever completes first. 1824 | WaitForInputIdle(milliseconds){ 1825 | UIA_Error(DllCall(this.vt(4),"ptr",this.__,"int",milliseconds,"int*",success),"WaitForInputIdle") 1826 | return success 1827 | } 1828 | 1829 | ; Minimizes, maximizes, or restores the window. 1830 | SetWindowVisualState(state){ 1831 | UIA_Error(DllCall(this.vt(5),"ptr",this.__,"int",state),"SetWindowVisualState") 1832 | return 1833 | } 1834 | 1835 | ; Indicates whether the window can be maximized. 1836 | CurrentCanMaximize(){ 1837 | UIA_Error(DllCall(this.vt(6),"ptr",this.__,"int*",retVal),"CurrentCanMaximize") 1838 | return retVal 1839 | } 1840 | 1841 | ; Indicates whether the window can be minimized. 1842 | CurrentCanMinimize(){ 1843 | UIA_Error(DllCall(this.vt(7),"ptr",this.__,"int*",retVal),"CurrentCanMinimize") 1844 | return retVal 1845 | } 1846 | 1847 | ; Indicates whether the window is modal. 1848 | CurrentIsModal(){ 1849 | UIA_Error(DllCall(this.vt(8),"ptr",this.__,"int*",retVal),"CurrentIsModal") 1850 | return retVal 1851 | } 1852 | 1853 | ; Indicates whether the window is the topmost element in the z-order. 1854 | CurrentIsTopmost(){ 1855 | UIA_Error(DllCall(this.vt(9),"ptr",this.__,"int*",retVal),"CurrentIsTopmost") 1856 | return retVal 1857 | } 1858 | 1859 | ; Retrieves the visual state of the window; that is, whether it is in the normal, maximized, or minimized state. 1860 | CurrentWindowVisualState(){ 1861 | UIA_Error(DllCall(this.vt(10),"ptr",this.__,"int*",retVal),"CurrentWindowVisualState") 1862 | return retVal ; WindowVisualState 1863 | } 1864 | 1865 | ; Retrieves the current state of the window for the purposes of user interaction. 1866 | CurrentWindowInteractionState(){ 1867 | UIA_Error(DllCall(this.vt(11),"ptr",this.__,"int*",retVal),"CurrentWindowInteractionState") 1868 | return retVal ; WindowInteractionState 1869 | } 1870 | 1871 | ; Retrieves a cached value that indicates whether the window can be maximized. 1872 | CachedCanMaximize(){ 1873 | UIA_Error(DllCall(this.vt(12),"ptr",this.__,"int*",retVal),"CachedCanMaximize") 1874 | return retVal 1875 | } 1876 | 1877 | ; Retrieves a cached value that indicates whether the window can be minimized. 1878 | CachedCanMinimize(){ 1879 | UIA_Error(DllCall(this.vt(13),"ptr",this.__,"int*",retVal),"CachedCanMinimize") 1880 | return retVal 1881 | } 1882 | 1883 | ; Retrieves a cached value that indicates whether the window is modal. 1884 | CachedIsModal(){ 1885 | UIA_Error(DllCall(this.vt(14),"ptr",this.__,"int*",retVal),"CachedIsModal") 1886 | return retVal 1887 | } 1888 | 1889 | ; Retrieves a cached value that indicates whether the window is the topmost element in the z-order. 1890 | CachedIsTopmost(){ 1891 | UIA_Error(DllCall(this.vt(15),"ptr",this.__,"int*",retVal),"CachedIsTopmost") 1892 | return retVal 1893 | } 1894 | 1895 | ; Retrieves a cached value that indicates the visual state of the window; that is, whether it is in the normal, maximized, or minimized state. 1896 | CachedWindowVisualState(){ 1897 | UIA_Error(DllCall(this.vt(16),"ptr",this.__,"int*",retVal),"CachedWindowVisualState") 1898 | return retVal ; WindowVisualState 1899 | } 1900 | 1901 | ; Retrieves a cached value that indicates the current state of the window for the purposes of user interaction. 1902 | CachedWindowInteractionState(){ 1903 | UIA_Error(DllCall(this.vt(17),"ptr",this.__,"int*",retVal),"CachedWindowInteractionState") 1904 | return retVal ; WindowInteractionState 1905 | } 1906 | } 1907 | class IUIAutomationTextRangePattern extends IBase 1908 | { 1909 | ; Retrieves a new IUIAutomationTextRange identical to the original and inheriting all properties of the original. 1910 | ; The new range can be manipulated independently of the original. 1911 | Clone(){ 1912 | UIA_Error(DllCall(this.vt(3),"ptr",this.__,"ptr*",clonedRange),"Clone") 1913 | return new IUIAutomationTextRange(clonedRange) 1914 | } 1915 | 1916 | ; Retrieves a value that specifies whether this text range has the same endpoints as another text range. 1917 | ; This method compares the endpoints of the two text ranges, not the text in the ranges. The ranges are identical if they share the same endpoints. If two text ranges have different endpoints, they are not identical even if the text in both ranges is exactly the same. 1918 | Compare(range){ 1919 | UIA_Error(DllCall(this.vt(4),"ptr",this.__,"ptr",range,"int*",areSame),"Compare") 1920 | return areSame 1921 | } 1922 | 1923 | ; Retrieves a value that specifies whether the start or end endpoint of this text range is the same as the start or end endpoint of another text range. 1924 | CompareEndpoints(srcEndPoint,range,targetEndPoint){ 1925 | UIA_Error(DllCall(this.vt(5),"ptr",this.__,"int",srcEndPoint,"ptr",range,"int",targetEndPoint,"int*",compValue),"CompareEndpoints") ; TextPatternRangeEndpoint 1926 | return compValue 1927 | } 1928 | 1929 | ; Normalizes the text range by the specified text unit. The range is expanded if it is smaller than the specified unit, or shortened if it is longer than the specified unit. 1930 | ; Client applications such as screen readers use this method to retrieve the full word, sentence, or paragraph that exists at the insertion point or caret position. 1931 | ; Despite its name, the ExpandToEnclosingUnit method does not necessarily expand a text range. Instead, it "normalizes" a text range by moving the endpoints so that the range encompasses the specified text unit. The range is expanded if it is smaller than the specified unit, or shortened if it is longer than the specified unit. If the range is already an exact quantity of the specified units, it remains unchanged. The following diagram shows how ExpandToEnclosingUnit normalizes a text range by moving the endpoints of the range. 1932 | ; ExpandToEnclosingUnit defaults to the next largest text unit supported if the specified text unit is not supported by the control. The order, from smallest unit to largest, is as follows: Character Format Word Line Paragraph Page Document 1933 | ; ExpandToEnclosingUnit respects both visible and hidden text. 1934 | ExpandToEnclosingUnit(textUnit){ ; textUnit 1935 | return UIA_Error(DllCall(this.vt(6),"ptr",this.__,"int",textUnit),"ExpandToEnclosingUnit") ; textUnit 1936 | } 1937 | 1938 | ; Retrieves a text range subset that has the specified text attribute value. 1939 | ; The FindAttribute method retrieves matching text regardless of whether the text is hidden or visible. Use UIA_IsHiddenAttributeId to check text visibility. 1940 | FindAttribute(attr,val,backward){ 1941 | UIA_Error(DllCall(this.vt(7),"ptr",this.__,"int",attr,"ptr",variant(v,UIA_AttributeVariantType(attr),val),"int",backward,"ptr*",found),"FindAttribute") 1942 | return new IUIAutomationTextRange(found) 1943 | } 1944 | 1945 | ; Retrieves a text range subset that contains the specified text. There is no differentiation between hidden and visible text. 1946 | FindText(text,backward,ignoreCase){ 1947 | UIA_Error(DllCall(this.vt(8),"ptr",this.__,"str",text,"int",backward,"int",ignoreCase,"ptr*",found),"FindText") 1948 | return new IUIAutomationTextRange(found) 1949 | } 1950 | 1951 | ; Retrieves the value of the specified text attribute across the entire text range. 1952 | ; The type of value retrieved by this method depends on the attr parameter. For example, calling GetAttributeValue with the attr parameter set to UIA_FontNameAttributeId returns a string that represents the font name of the text range, while calling GetAttributeValue with attr set to UIA_IsItalicAttributeId would return a boolean. 1953 | ; If the attribute specified by attr is not supported, the value parameter receives a value that is equivalent to the IUIAutomation::ReservedNotSupportedValue property. 1954 | ; A text range can include more than one value for a particular attribute. For example, if a text range includes more than one font, the FontName attribute will have multiple values. An attribute with more than one value is called a mixed attribute. You can determine if a particular attribute is a mixed attribute by comparing the value retrieved from GetAttributeValue with the UIAutomation::ReservedMixedAttributeValue property. 1955 | ; The GetAttributeValue method retrieves the attribute value regardless of whether the text is hidden or visible. Use UIA_ IsHiddenAttributeId to check text visibility. 1956 | GetAttributeValue(attr,value){ 1957 | UIA_Error(DllCall(this.vt(9),"ptr",this.__,"int",attr,"ptr",variant(value)),"GetAttributeValue") ; Text Attribute 1958 | return GetVariantValue(value) 1959 | } 1960 | 1961 | ; Retrieves a collection of bounding rectangles for each fully or partially visible line of text in a text range. 1962 | GetBoundingRectangles(){ 1963 | UIA_Error(DllCall(this.vt(10),"ptr",this.__,"ptr*",boundingRects),"GetBoundingRectangles") 1964 | return GetSafeArrayValue(boundingRects,5) 1965 | } 1966 | 1967 | ; Returns the innermost UI Automation element that encloses the text range. 1968 | GetEnclosingElement(){ 1969 | UIA_Error(DllCall(this.vt(11),"ptr",this.__,"ptr*",enclosingElement),"GetEnclosingElement") 1970 | return new IUIAutomationElement(enclosingElement) 1971 | } 1972 | 1973 | ; Returns the plain text of the text range. 1974 | GetText(maxLength=-1){ 1975 | UIA_Error(DllCall(this.vt(12),"ptr",this.__,"int",maxLength,"ptr*",text),"GetText") 1976 | return StrGet(text,"utf-16") 1977 | } 1978 | 1979 | ; Moves the text range forward or backward by the specified number of text units . 1980 | /* 1981 | IUIAutomationTextRange::Move moves the text range to span a different part of the text; it does not alter the text in any way. 1982 | For a non-degenerate (non-empty) text range, IUIAutomationTextRange::Move normalizes and moves the range by performing the following steps. 1983 | The text range is collapsed to a degenerate (empty) range at the starting endpoint. 1984 | If necessary, the resulting text range is moved backward in the document to the beginning of the requested text unit boundary. 1985 | The text range is moved forward or backward in the document by the requested number of text unit boundaries. 1986 | The text range is expanded from the degenerate state by moving the ending endpoint forward by one requested text unit boundary. 1987 | If any of the preceding steps fail, the text range is left unchanged. If the text range cannot be moved as far as the requested number of text units, but can be moved by a smaller number of text units, the text range is moved by the smaller number of text units and moved is set to the number of text units moved. 1988 | For a degenerate text range, IUIAutomationTextRange::Move simply moves the text insertion point by the specified number of text units. 1989 | When moving a text range, IUIAutomationTextRange::Move ignores the boundaries of any embedded objects in the text. 1990 | IUIAutomationTextRange::Move respects both hidden and visible text. 1991 | If a text-based control does not support the text unit specified by the unit parameter, IUIAutomationTextRange::Move substitutes the next larger supported text unit. The size of the text units, from smallest unit to largest, is as follows. 1992 | Character 1993 | Format 1994 | Word 1995 | Line 1996 | Paragraph 1997 | Page 1998 | Document 1999 | */ 2000 | Move(unit,count){ ; TextUnit 2001 | UIA_Error(DllCall(this.vt(13),"ptr",this.__,"int",unit,"int",count,"int*",moved),"Move") ; TextUnit 2002 | return moved 2003 | } 2004 | 2005 | ; Moves one endpoint of the text range the specified number of text units within the document range. 2006 | MoveEndpointByUnit(endpoint,unit,count){ ; TextPatternRangeEndpoint , TextUnit 2007 | UIA_Error(DllCall(this.vt(14),"ptr",this.__,"int",endpoint,"int",unit,"int",count,"int*",moved),"MoveEndpointByUnit") ; TextPatternRangeEndpoint,TextUnit 2008 | return moved 2009 | } 2010 | 2011 | ; Moves one endpoint of the current text range to the specified endpoint of a second text range. 2012 | ; If the endpoint being moved crosses the other endpoint of the same text range, that other endpoint is moved also, resulting in a degenerate (empty) range and ensuring the correct ordering of the endpoints (that is, the start is always less than or equal to the end). 2013 | MoveEndpointByRange(srcEndPoint,range,targetEndPoint){ ; TextPatternRangeEndpoint , IUIAutomationTextRange , TextPatternRangeEndpoint 2014 | return UIA_Error(DllCall(this.vt(15),"ptr",this.__,"int",srcEndPoint,"ptr",range,"int",targetEndPoint),"MoveEndpointByRange") 2015 | } 2016 | 2017 | ; Selects the span of text that corresponds to this text range, and removes any previous selection. 2018 | ; If the Select method is called on a text range object that represents a degenerate (empty) text range, the text insertion point moves to the starting endpoint of the text range. 2019 | Select(){ 2020 | return UIA_Error(DllCall(this.vt(16),"ptr",this.__),"Select") 2021 | } 2022 | 2023 | ; Adds the text range to the collection of selected text ranges in a control that supports multiple, disjoint spans of selected text. 2024 | ; The text insertion point moves to the newly selected text. If AddToSelection is called on a text range object that represents a degenerate (empty) text range, the text insertion point moves to the starting endpoint of the text range. 2025 | AddToSelection(){ 2026 | return UIA_Error(DllCall(this.vt(17),"ptr",this.__),"AddToSelection") 2027 | } 2028 | 2029 | ; Removes the text range from an existing collection of selected text in a text container that supports multiple, disjoint selections. 2030 | ; The text insertion point moves to the area of the removed highlight. Providing a degenerate text range also moves the insertion point. 2031 | RemoveFromSelection(){ 2032 | return UIA_Error(DllCall(this.vt(18),"ptr",this.__),"RemoveFromSelection") 2033 | } 2034 | 2035 | ; Causes the text control to scroll until the text range is visible in the viewport. 2036 | ; The method respects both hidden and visible text. If the text range is hidden, the text control will scroll only if the hidden text has an anchor in the viewport. 2037 | ; A Microsoft UI Automation client can check text visibility by calling IUIAutomationTextRange::GetAttributeValue with the attr parameter set to UIA_IsHiddenAttributeId. 2038 | ScrollIntoView(alignToTop){ 2039 | return UIA_Error(DllCall(this.vt(19),"ptr",this.__,"int",alignToTop),"ScrollIntoView") 2040 | } 2041 | 2042 | ; Retrieves a collection of all embedded objects that fall within the text range. 2043 | GetChildren(){ 2044 | UIA_Error(DllCall(this.vt(20),"ptr",this.__,"ptr*",children),"GetChildren") 2045 | return new IUIAutomationElementArray(children) 2046 | } 2047 | } 2048 | class IUIAutomationTextRangeArrayPattern extends IBase 2049 | { 2050 | ; Retrieves the number of text ranges in the collection. 2051 | Length(){ 2052 | UIA_Error(DllCall(this.vt(3),"ptr",this.__,"int*",length),"Length") 2053 | return length 2054 | } 2055 | 2056 | ; Retrieves a text range from the collection. 2057 | GetElement(index){ ; zero-based. 2058 | UIA_Error(DllCall(this.vt(4),"ptr",this.__,"int",index,"ptr*",element),"GetElement") 2059 | return new IUIAutomationTextRangePattern(element) 2060 | } 2061 | } 2062 | class IUIAutomationTextPattern extends IBase 2063 | { 2064 | ; Retrieves the degenerate (empty) text range nearest to the specified screen coordinates. 2065 | /* 2066 | A text range that wraps a child object is returned if the screen coordinates are within the coordinates of an image, hyperlink, Microsoft Excel spreadsheet, or other embedded object. 2067 | Because hidden text is not ignored, this method retrieves a degenerate range from the visible text closest to the specified coordinates. 2068 | The implementation of RangeFromPoint in Windows Internet Explorer 9 does not return the expected result. Instead, clients should: 2069 | 1. Call the GetVisibleRanges method to retrieve an array of visible text ranges.Call the GetVisibleRanges method to retrieve an array of visible text ranges. 2070 | 2. Call the GetVisibleRanges method to retrieve an array of visible text ranges.For each text range in the array, call IUIAutomationTextRange::GetBoundingRectangles to retrieve the bounding rectangles. 2071 | 3. Call the GetVisibleRanges method to retrieve an array of visible text ranges.Check the bounding rectangles to find the text range that occupies the particular screen coordinates. 2072 | */ 2073 | RangeFromPoint(pt){ ; x|y<<32 2074 | UIA_Error(DllCall(this.vt(3),"ptr",this.__,"int64",pt,"ptr*",range),"RangeFromPoint") 2075 | return new IUIAutomationTextRange(range) 2076 | } 2077 | 2078 | ; Retrieves a text range enclosing a child element such as an image, hyperlink, Microsoft Excel spreadsheet, or other embedded object. 2079 | ; If there is no text in the range that encloses the child element, a degenerate (empty) range is returned. 2080 | ; The child parameter is either a child of the element associated with a IUIAutomationTextPattern or from the array of children of a IUIAutomationTextRange. 2081 | RangeFromChild(child){ ; IUIAutomationElement 2082 | UIA_Error(DllCall(this.vt(4),"ptr",this.__,"ptr",child.__,"ptr*",range),"RangeFromChild") 2083 | return new IUIAutomationTextRange(range) 2084 | } 2085 | 2086 | ; Retrieves a collection of text ranges that represents the currently selected text in a text-based control. 2087 | ; If the control supports the selection of multiple, non-contiguous spans of text, the ranges collection receives one text range for each selected span. 2088 | ; If the control contains only a single span of selected text, the ranges collection receives a single text range. 2089 | ; If the control contains a text insertion point but no text is selected, the ranges collection receives a degenerate (empty) text range at the position of the text insertion point. 2090 | ; If the control does not contain a text insertion point or does not support text selection, ranges is set to NULL. 2091 | ; Use the IUIAutomationTextPattern::SupportedTextSelection property to test whether a control supports text selection. 2092 | GetSelection(){ 2093 | UIA_Error(DllCall(this.vt(5),"ptr",this.__,"ptr*",ranges),"GetSelection") 2094 | return new IUIAutomationTextRangeArray(ranges) 2095 | } 2096 | 2097 | ; Retrieves an array of disjoint text ranges from a text-based control where each text range represents a contiguous span of visible text. 2098 | ; If the visible text consists of one contiguous span of text, the ranges array will contain a single text range that represents all of the visible text. 2099 | ; If the visible text consists of multiple, disjoint spans of text, the ranges array will contain one text range for each visible span, beginning with the first visible span, and ending with the last visible span. Disjoint spans of visible text can occur when the content of a text-based control is partially obscured by an overlapping window or other object, or when a text-based control with multiple pages or columns has content that is partially scrolled out of view. 2100 | ; IUIAutomationTextPattern::GetVisibleRanges retrieves a degenerate (empty) text range if no text is visible, if all text is scrolled out of view, or if the text-based control contains no text. 2101 | GetVisibleRanges(){ 2102 | UIA_Error(DllCall(this.vt(6),"ptr",this.__,"ptr*",ranges),"GetVisibleRanges") 2103 | return new IUIAutomationTextRangeArray(ranges) 2104 | } 2105 | 2106 | ; Retrieves a text range that encloses the main text of a document. 2107 | ; Some auxiliary text such as headers, footnotes, or annotations might not be included. 2108 | DocumentRange(){ 2109 | UIA_Error(DllCall(this.vt(7),"ptr",this.__,"ptr*",range),"DocumentRange") 2110 | return new IUIAutomationTextRange(range) 2111 | } 2112 | 2113 | ; Retrieves a value that specifies the type of text selection that is supported by the control. 2114 | SupportedTextSelection(){ 2115 | UIA_Error(DllCall(this.vt(8),"ptr",this.__,"int*",supportedTextSelection),"SupportedTextSelection") 2116 | return supportedTextSelection ; SupportedTextSelection 2117 | } 2118 | } 2119 | class IUIAutomationLegacyIAccessiblePattern extends IBase 2120 | { 2121 | 2122 | ; IUIAutomationLegacyIAccessiblePattern 2123 | 2124 | ; Performs a Microsoft Active Accessibility selection. 2125 | Select(flagsSelect){ ; SELFLAG 2126 | return UIA_Error(DllCall(this.vt(3),"ptr",this.__,"int",flagsSelect),"Select") ; SELFLAG 2127 | } 2128 | 2129 | ; Performs the Microsoft Active Accessibility default action for the element. 2130 | DoDefaultAction(){ 2131 | return UIA_Error(DllCall(this.vt(4),"ptr",this.__),"DoDefaultAction") 2132 | } 2133 | 2134 | ; Sets the Microsoft Active Accessibility value property for the element. This method is supported only for some elements (usually edit controls). 2135 | SetValue(szValue){ 2136 | return UIA_Error(DllCall(this.vt(5),"ptr",this.__,"str",szValue),"SetValue") 2137 | } 2138 | 2139 | ; Retrieves the Microsoft Active Accessibility child identifier for the element. If the element is not a child element, CHILDID_SELF (0) is returned. 2140 | CurrentChildId(){ 2141 | UIA_Error(DllCall(this.vt(6),"ptr",this.__,"int*",pRetVal),"CurrentChildId") 2142 | return pRetVal 2143 | } 2144 | 2145 | ; Retrieves the Microsoft Active Accessibility name property of the element. The name of an element can be used to find the element in the element tree when the automation ID property is not supported on the element. 2146 | CurrentName(){ 2147 | UIA_Error(DllCall(this.vt(7),"ptr",this.__,"ptr*",pszName),"CurrentName") 2148 | return StrGet(pszName,"utf-16") 2149 | } 2150 | 2151 | ; Retrieves the Microsoft Active Accessibility value property. 2152 | CurrentValue(){ 2153 | UIA_Error(DllCall(this.vt(8),"ptr",this.__,"ptr*",pszValue),"CurrentValue") 2154 | return StrGet(pszValue,"utf-16") 2155 | } 2156 | 2157 | ; Retrieves the Microsoft Active Accessibility description of the element. 2158 | CurrentDescription(){ 2159 | UIA_Error(DllCall(this.vt(9),"ptr",this.__,"ptr*",pszDescription),"CurrentDescription") 2160 | return StrGet(pszDescription,"utf-16") 2161 | } 2162 | 2163 | ; Retrieves the Microsoft Active Accessibility role identifier of the element. 2164 | CurrentRole(){ 2165 | UIA_Error(DllCall(this.vt(10),"ptr",this.__,"uint*",pdwRole),"CurrentRole") ; role 2166 | return pdwRole ; Roles 2167 | } 2168 | 2169 | ; Retrieves the Microsoft Active Accessibility state identifier for the element. 2170 | CurrentState(){ 2171 | UIA_Error(DllCall(this.vt(11),"ptr",this.__,"uint*",pdwState),"CurrentState") ; state id 2172 | return pdwState ; State 2173 | } 2174 | 2175 | ; Retrieves the Microsoft Active Accessibility help string for the element. 2176 | CurrentHelp(){ 2177 | UIA_Error(DllCall(this.vt(12),"ptr",this.__,"ptr*",pszHelp),"CurrentHelp") 2178 | return StrGet(pszHelp,"utf-16") 2179 | } 2180 | 2181 | ; Retrieves the Microsoft Active Accessibility keyboard shortcut property for the element. 2182 | CurrentKeyboardShortcut(){ 2183 | UIA_Error(DllCall(this.vt(13),"ptr",this.__,"ptr*",pszKeyboardShortcut),"CurrentKeyboardShortcut") 2184 | return StrGet(pszKeyboardShortcut,"utf-16") 2185 | } 2186 | 2187 | ; Retrieves the Microsoft Active Accessibility property that identifies the selected children of this element. 2188 | GetCurrentSelection(){ 2189 | UIA_Error(DllCall(this.vt(14),"ptr",this.__,"ptr*",pvarSelectedChildren),"GetCurrentSelection") 2190 | return new IUIAutomationElementArray(pvarSelectedChildren) 2191 | } 2192 | 2193 | ; Retrieves the Microsoft Active Accessibility default action for the element. 2194 | CurrentDefaultAction(){ 2195 | UIA_Error(DllCall(this.vt(15),"ptr",this.__,"ptr*",pszDefaultAction),"CurrentDefaultAction") 2196 | return StrGet(pszDefaultAction,"utf-16") 2197 | } 2198 | 2199 | ; Retrieves the cached Microsoft Active Accessibility child identifier for the element. 2200 | CachedChildId(){ 2201 | UIA_Error(DllCall(this.vt(16),"ptr",this.__,"int*",pRetVal),"CachedChildId") 2202 | return pRetVal 2203 | } 2204 | 2205 | ; Retrieves the cached Microsoft Active Accessibility name property of the element. 2206 | CachedName(){ 2207 | UIA_Error(DllCall(this.vt(17),"ptr",this.__,"ptr*",pszName),"CachedName") 2208 | return StrGet(pszName,"utf-16") 2209 | } 2210 | 2211 | ; Retrieves the cached Microsoft Active Accessibility value property. 2212 | CachedValue(){ 2213 | UIA_Error(DllCall(this.vt(18),"ptr",this.__,"ptr*",pszValue),"CachedValue") 2214 | return StrGet(pszValue,"utf-16") 2215 | } 2216 | 2217 | ; Retrieves the cached Microsoft Active Accessibility description of the element. 2218 | CachedDescription(){ 2219 | UIA_Error(DllCall(this.vt(19),"ptr",this.__,"ptr*",pszDescription),"CachedDescription") 2220 | return StrGet(pszDescription,"utf-16") 2221 | } 2222 | 2223 | ; Retrieves the cached Microsoft Active Accessibility role of the element. 2224 | CachedRole(){ 2225 | UIA_Error(DllCall(this.vt(20),"ptr",this.__,"uint*",pdwRole),"CachedRole") 2226 | return pdwRole ; Roles 2227 | } 2228 | 2229 | ; Retrieves the cached Microsoft Active Accessibility state identifier for the element. 2230 | CachedState(){ 2231 | UIA_Error(DllCall(this.vt(21),"ptr",this.__,"uint*",pdwState),"CachedState") 2232 | return pdwState ; State 2233 | } 2234 | 2235 | ; Retrieves the cached Microsoft Active Accessibility help string for the element. 2236 | CachedHelp(){ 2237 | UIA_Error(DllCall(this.vt(22),"ptr",this.__,"ptr*",pszHelp),"CachedHelp") 2238 | return StrGet(pszHelp,"utf-16") 2239 | } 2240 | 2241 | ; Retrieves the cached Microsoft Active Accessibility keyboard shortcut property for the element. 2242 | CachedKeyboardShortcut(){ 2243 | UIA_Error(DllCall(this.vt(23),"ptr",this.__,"ptr*",pszKeyboardShortcut),"CachedKeyboardShortcut") 2244 | return StrGet(pszKeyboardShortcut,"utf-16") 2245 | } 2246 | 2247 | ; Retrieves the cached Microsoft Active Accessibility property that identifies the selected children of this element. 2248 | GetCachedSelection(){ 2249 | UIA_Error(DllCall(this.vt(24),"ptr",this.__,"ptr*",pvarSelectedChildren),"GetCachedSelection") 2250 | return new IUIAutomationElementArray(pvarSelectedChildren) 2251 | } 2252 | 2253 | ; Retrieves the Microsoft Active Accessibility default action for the element. 2254 | CachedDefaultAction(){ 2255 | UIA_Error(DllCall(this.vt(25),"ptr",this.__,"ptr*",pszDefaultAction),"CachedDefaultAction") 2256 | return StrGet(pszDefaultAction,"utf-16") 2257 | } 2258 | 2259 | ; Retrieves an IAccessible object that corresponds to the Microsoft UI Automation element. 2260 | ; This method returns NULL if the underlying implementation of the 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. 2261 | GetIAccessible(){ 2262 | UIA_Error(DllCall(this.vt(26),"ptr",this.__,"ptr*",ppAccessible),"GetIAccessible") 2263 | return ppAccessible ; IAccessible 2264 | } 2265 | } 2266 | class IUIAutomationItemContainerPattern extends IBase 2267 | { 2268 | ; IUIAutomationItemContainerPattern 2269 | 2270 | ; Retrieves an element within a containing element, based on a specified property value. 2271 | ; The provider may return an actual IUIAutomationElement interface or a placeholder if the matching element is virtualized. 2272 | ; This method returns E_INVALIDARG if the property requested is not one that the container supports searching over. It is expected that most containers will support Name property, and if appropriate for the container, AutomationId and IsSelected. 2273 | ; This method can be slow, because it may need to traverse multiple objects to find a matching one. When used in a loop to return multiple items, no specific order is defined so long as each item is returned only once (that is, the loop should terminate). This method is also item-centric, not UI-centric, so items with multiple UI representations need to be hit only once. 2274 | ; When the propertyId parameter is specified as 0 (zero), the provider is expected to return the next item after pStartAfter. If pStartAfter is specified as NULL with a propertyId of 0, the provider should return the first item in the container. When propertyId is specified as 0, the value parameter should be VT_EMPTY. 2275 | FindItemByProperty(pStartAfter,propertyId,value){ ; IUIAutomationElement 2276 | UIA_Error(DllCall(this.vt(3),"ptr",this.__,"ptr",pStartAfter,"int",propertyId,"ptr",variant(_,UIA_PropertyVariantType(propertyId),value),"ptr*",pFound),"FindItemByProperty") 2277 | return new IUIAutomationElement(pFound) 2278 | } 2279 | 2280 | } 2281 | class IUIAutomationVirtualizedItemPattern extends IBase 2282 | { 2283 | ; Creates a full UI Automation element for a virtualized item. 2284 | ; A virtualized item is represented by a placeholder automation element in the UI Automation tree. The Realize method causes the provider to make full information available for the item so that a full UI Automation element can be created for the item. 2285 | Realize(){ 2286 | return UIA_Error(DllCall(this.vt(3),"ptr",this.__),"Realize") 2287 | } 2288 | } 2289 | 2290 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2291 | ;;IUIAutomationEventHandle;; 2292 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2293 | 2294 | UIA_OnEvent(ByRef ptr,name){ 2295 | if !IsFunc(name){ 2296 | msgbox %name% ia not a function. 2297 | return 2298 | } 2299 | VarSetCapacity(ptr,A_PtrSize*5) 2300 | ,NumPut(&ptr+A_PtrSize,ptr) 2301 | ,NumPut(RegisterCallback("_UIA_QueryInterface","F"),ptr,A_PtrSize*1) 2302 | ,NumPut(RegisterCallback("_UIA_AddRef","F"),ptr,A_PtrSize*2) 2303 | ,NumPut(RegisterCallback("_UIA_Release","F"),ptr,A_PtrSize*3) 2304 | ,NumPut(RegisterCallback(name,"F"),ptr,A_PtrSize*4) 2305 | return &ptr 2306 | } 2307 | _UIA_QueryInterface(pSelf, pRIID, pObj){ 2308 | DllCall("ole32\StringFromIID","ptr",pRIID,"ptr*",sz),str:=StrGet(sz) 2309 | return (str="{00000000-0000-0000-C000-000000000046}")||(str="{146c3c17-f12e-4e22-8c27-f894b9b79c69}")||(str="{40cd37d4-c756-4b0c-8c6f-bddfeeb13b50}")||(str="{e81d1b4e-11c5-42f8-9754-e7036c79f054}")||(str="{c270f6b5-5c69-4290-9745-7a7f97169468}")?NumPut(pSelf,pObj+0)*0:0x80004002 ; E_NOINTERFACE 2310 | } 2311 | _UIA_AddRef(pSelf){ 2312 | } 2313 | _UIA_Release(pSelf){ 2314 | } 2315 | 2316 | /* event handle sample 2317 | HandleAutomationEvent(pself,sender,eventId) ; IUIAutomationElement , EVENTID 2318 | HandleFocusChangedEvent(pself,sender) 2319 | HandlePropertyChangedEvent(pself,sender,propertyId,newValue) ; PROPERTYID , VARIANT 2320 | HandleStructureChangedEvent(pself,sender,changeType,runtimeId) ; StructureChangeType , SAFEARRAY 2321 | */ 2322 | 2323 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2324 | ;;IUIAutomationProxyFactory;; 2325 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2326 | 2327 | ;;;;;;;;;;;;;;;;;;;;; 2328 | ;;Wrapped Functions;; 2329 | ;;;;;;;;;;;;;;;;;;;;; 2330 | 2331 | ; create nativearray 2332 | CreateNativeArrary(ptr,type,p*){ ; not completed 2333 | count:=0 2334 | VarSetCapacity(ptr,p.maxindex()) 2335 | loop{ 2336 | 2337 | } 2338 | } 2339 | 2340 | ; transform to 2341 | 2342 | ; create variant 2343 | variant(ByRef var,type=0,val=0){ ; //not completed, type not defined 2344 | static _:={2:"short",3:"int",4:"float",5:"double",0xA:"int",0xB:"short",0x10:"uchar",0x11:"char",0x12:"ushort",0x13:"uint",0x14:"int64",0x15:"uint64"} 2345 | return (VarSetCapacity(var,8+2*A_PtrSize)+NumPut(type,var,0,"short")+NumPut(val,var,8,_.haskey(type)?t[type]:"ptr"))*0+&var 2346 | } 2347 | 2348 | ; variant type 2349 | VariantType(type){ 2350 | static _:={2:[2,"short"] ; 16 位有符号整数 2351 | ,3:[4,"int"] ; 32 位有符号整数 2352 | ,4:[4,"float"] ; 32 位浮点数 2353 | ,5:[8,"double"] ; 64 位浮点数 2354 | ,0xA:[4,"uint"] ; Error 码 (32 位整数) 2355 | ,0xB:[2,"short"] ; 布尔值 True (-1) 或 False (0) 2356 | ,0x10:[1,"char"] ; 8 位有符号整数 2357 | ,0x11:[1,"uchar"] ; 8 位无符号整数 2358 | ,0x12:[2,"ushort"] ; 16 位无符号整数 2359 | ,0x13:[4,"uint"] ; 32 位无符号整数 2360 | ,0x14:[8,"int64"] ; 64 位有符号整数 2361 | ,0x15:[8,"uint64"]} ; 64 位无符号整数 2362 | return _.haskey(type)?_[type]:[A_PtrSize,"ptr"] 2363 | } 2364 | 2365 | ; Get Value in variant 2366 | GetVariantValue(v){ 2367 | if (type:=NumGet(v+0,"ushort"))&0x2000 2368 | return GetSafeArrayValue(NumGet(v+8),type&0xFF) 2369 | else{ 2370 | return (type=8)?StrGet(NumGet(v+8,varianttype(type).2),"utf-16"):NumGet(v+8,varianttype(type).2) 2371 | } 2372 | } 2373 | 2374 | ; create safearray 2375 | SafeArray(ByRef array,type,count,p*){ 2376 | array:=ComObjArray(type,count) 2377 | loop % p.maxindex() 2378 | array[A_Index-1]:=p[A_Index] 2379 | return ComObjValue(array) 2380 | } 2381 | 2382 | ; Get Value in SafeArray 2383 | GetSafeArrayValue(p,type){ ; //not completed, only 1 dim 2384 | /* 2385 | cDims:=NumGet(p+0,"ushort") 2386 | fFeatures:=NumGet(p+2,"ushort") 2387 | cbElements:=NumGet(p+4,"uint") 2388 | cLocks:=NumGet(p+8,"uint") 2389 | pvData:=NumGet(p+8+A_PtrSize,"ptr") 2390 | ;dim 1 2391 | cElements:=NumGet(p+8+2*A_PtrSize,"uint") 2392 | lLbound:=NumGet(p+12+2*A_PtrSize,"uint") 2393 | ;dim 2 2394 | cElements:=NumGet(p+16+2*A_PtrSize,"uint") 2395 | lLbound:=NumGet(p+20+2*A_PtrSize,"uint") 2396 | 2397 | r1:=NumGet(pvData+0) 2398 | */ 2399 | t:=varianttype(type),item:={},pv:=NumGet(p+8+A_PtrSize,"ptr") 2400 | loop % NumGet(p+8+2*A_PtrSize,"uint") 2401 | item.Insert((type=8)?StrGet(NumGet(pv+(A_Index-1)*t.1,t.2),"utf-16"):NumGet(pv+(A_Index-1)*t.1,t.2)) 2402 | return item 2403 | } 2404 | 2405 | ; uia error code 2406 | UIA_Error(a,b){ 2407 | static err:={0x8000FFFF:"Catastrophic failure error.",0x80004001:"Not implemented error.",0x8007000E:"Out of memory error.",0x80070057:"One or more arguments are not valid error.",0x80004002:"Interface not supported error.",0x80004003:"Pointer not valid error.",0x80070006:"Handle not valid error.",0x80004004:"Operation aborted error.",0x80004005:"Unspecified error.",0x80070005:"General access denied error.",0x800401E5:"The object identified by this moniker could not be found." 2408 | ,0x80040201:"UIA_E_ELEMENTNOTAVAILABLE",0x80040200:"UIA_E_ELEMENTNOTENABLED",0x80131509:"UIA_E_INVALIDOPERATION",0x80040202:"UIA_E_NOCLICKABLEPOINT",0x80040204:"UIA_E_NOTSUPPORTED",0x80040203:"UIA_E_PROXYASSEMBLYNOTLOADED"} 2409 | if a && (a&=0xFFFFFFFF) 2410 | msgbox, % b " : " (err.haskey(a)?err[a]:a) 2411 | return a 2412 | } 2413 | 2414 | ;;;;;;;;;;;;;;;;; 2415 | ;;UIA Constants;; 2416 | ;;;;;;;;;;;;;;;;; 2417 | 2418 | ; Property Identifiers 2419 | UIA_Property(n){ 2420 | static id:={RuntimeId:30000,BoundingRectangle:30001,ProcessId:30002,ControlType:30003,LocalizedControlType:30004,Name:30005,AcceleratorKey:30006,AccessKey:30007,HasKeyboardFocus:30008,IsKeyboardFocusable:30009,IsEnabled:30010,AutomationId:30011,ClassName:30012,HelpText:30013,ClickablePoint:30014,Culture:30015,IsControlElement:30016,IsContentElement:30017,LabeledBy:30018,IsPassword:30019,NativeWindowHandle:30020,ItemType:30021,IsOffscreen:30022,Orientation:30023,FrameworkId:30024,IsRequiredForForm:30025,ItemStatus:30026,IsDockPatternAvailable:30027,IsExpandCollapsePatternAvailable:30028,IsGridItemPatternAvailable:30029,IsGridPatternAvailable:30030,IsInvokePatternAvailable:30031,IsMultipleViewPatternAvailable:30032,IsRangeValuePatternAvailable:30033,IsScrollPatternAvailable:30034,IsScrollItemPatternAvailable:30035,IsSelectionItemPatternAvailable:30036,IsSelectionPatternAvailable:30037,IsTablePatternAvailable:30038,IsTableItemPatternAvailable:30039,IsTextPatternAvailable:30040,IsTogglePatternAvailable:30041,IsTransformPatternAvailable:30042,IsValuePatternAvailable:30043,IsWindowPatternAvailable:30044,ValueValue:30045,ValueIsReadOnly:30046,RangeValueValue:30047,RangeValueIsReadOnly:30048,RangeValueMinimum:30049,RangeValueMaximum:30050,RangeValueLargeChange:30051,RangeValueSmallChange:30052,ScrollHorizontalScrollPercent:30053,ScrollHorizontalViewSize:30054,ScrollVerticalScrollPercent:30055,ScrollVerticalViewSize:30056,ScrollHorizontallyScrollable:30057,ScrollVerticallyScrollable:30058,SelectionSelection:30059,SelectionCanSelectMultiple:30060,SelectionIsSelectionRequired:30061,GridRowCount:30062,GridColumnCount:30063,GridItemRow:30064,GridItemColumn:30065,GridItemRowSpan:30066,GridItemColumnSpan:30067,GridItemContainingGrid:30068,DockDockPosition:30069,ExpandCollapseExpandCollapseState:30070,MultipleViewCurrentView:30071,MultipleViewSupportedViews:30072,WindowCanMaximize:30073,WindowCanMinimize:30074,WindowWindowVisualState:30075,WindowWindowInteractionState:30076,WindowIsModal:30077,WindowIsTopmost:30078,SelectionItemIsSelected:30079,SelectionItemSelectionContainer:30080,TableRowHeaders:30081,TableColumnHeaders:30082,TableRowOrColumnMajor:30083,TableItemRowHeaderItems:30084,TableItemColumnHeaderItems:30085,ToggleToggleState:30086,TransformCanMove:30087,TransformCanResize:30088,TransformCanRotate:30089,IsLegacyIAccessiblePatternAvailable:30090,LegacyIAccessibleChildId:30091,LegacyIAccessibleName:30092,LegacyIAccessibleValue:30093,LegacyIAccessibleDescription:30094,LegacyIAccessibleRole:30095,LegacyIAccessibleState:30096,LegacyIAccessibleHelp:30097,LegacyIAccessibleKeyboardShortcut:30098,LegacyIAccessibleSelection:30099,LegacyIAccessibleDefaultAction:30100,AriaRole:30101,AriaProperties:30102,IsDataValidForForm:30103,ControllerFor:30104,DescribedBy:30105,FlowsTo:30106,ProviderDescription:30107,IsItemContainerPatternAvailable:30108,IsVirtualizedItemPatternAvailable:30109,IsSynchronizedInputPatternAvailable:30110} 2421 | , name:={30000:"UIA_RuntimeIdPropertyId",30001:"UIA_BoundingRectanglePropertyId",30002:"UIA_ProcessIdPropertyId",30003:"UIA_ControlTypePropertyId",30004:"UIA_LocalizedControlTypePropertyId",30005:"UIA_NamePropertyId",30006:"UIA_AcceleratorKeyPropertyId",30007:"UIA_AccessKeyPropertyId",30008:"UIA_HasKeyboardFocusPropertyId",30009:"UIA_IsKeyboardFocusablePropertyId",30010:"UIA_IsEnabledPropertyId",30011:"UIA_AutomationIdPropertyId",30012:"UIA_ClassNamePropertyId",30013:"UIA_HelpTextPropertyId",30014:"UIA_ClickablePointPropertyId",30015:"UIA_CulturePropertyId",30016:"UIA_IsControlElementPropertyId",30017:"UIA_IsContentElementPropertyId",30018:"UIA_LabeledByPropertyId",30019:"UIA_IsPasswordPropertyId",30020:"UIA_NativeWindowHandlePropertyId",30021:"UIA_ItemTypePropertyId",30022:"UIA_IsOffscreenPropertyId",30023:"UIA_OrientationPropertyId",30024:"UIA_FrameworkIdPropertyId",30025:"UIA_IsRequiredForFormPropertyId",30026:"UIA_ItemStatusPropertyId",30027:"UIA_IsDockPatternAvailablePropertyId",30028:"UIA_IsExpandCollapsePatternAvailablePropertyId",30029:"UIA_IsGridItemPatternAvailablePropertyId",30030:"UIA_IsGridPatternAvailablePropertyId",30031:"UIA_IsInvokePatternAvailablePropertyId",30032:"UIA_IsMultipleViewPatternAvailablePropertyId",30033:"UIA_IsRangeValuePatternAvailablePropertyId",30034:"UIA_IsScrollPatternAvailablePropertyId",30035:"UIA_IsScrollItemPatternAvailablePropertyId",30036:"UIA_IsSelectionItemPatternAvailablePropertyId",30037:"UIA_IsSelectionPatternAvailablePropertyId",30038:"UIA_IsTablePatternAvailablePropertyId",30039:"UIA_IsTableItemPatternAvailablePropertyId",30040:"UIA_IsTextPatternAvailablePropertyId",30041:"UIA_IsTogglePatternAvailablePropertyId",30042:"UIA_IsTransformPatternAvailablePropertyId",30043:"UIA_IsValuePatternAvailablePropertyId",30044:"UIA_IsWindowPatternAvailablePropertyId",30045:"UIA_ValueValuePropertyId",30046:"UIA_ValueIsReadOnlyPropertyId",30047:"UIA_RangeValueValuePropertyId",30048:"UIA_RangeValueIsReadOnlyPropertyId",30049:"UIA_RangeValueMinimumPropertyId",30050:"UIA_RangeValueMaximumPropertyId",30051:"UIA_RangeValueLargeChangePropertyId",30052:"UIA_RangeValueSmallChangePropertyId",30053:"UIA_ScrollHorizontalScrollPercentPropertyId",30054:"UIA_ScrollHorizontalViewSizePropertyId",30055:"UIA_ScrollVerticalScrollPercentPropertyId",30056:"UIA_ScrollVerticalViewSizePropertyId",30057:"UIA_ScrollHorizontallyScrollablePropertyId",30058:"UIA_ScrollVerticallyScrollablePropertyId",30059:"UIA_SelectionSelectionPropertyId",30060:"UIA_SelectionCanSelectMultiplePropertyId",30061:"UIA_SelectionIsSelectionRequiredPropertyId",30062:"UIA_GridRowCountPropertyId",30063:"UIA_GridColumnCountPropertyId",30064:"UIA_GridItemRowPropertyId",30065:"UIA_GridItemColumnPropertyId",30066:"UIA_GridItemRowSpanPropertyId",30067:"UIA_GridItemColumnSpanPropertyId",30068:"UIA_GridItemContainingGridPropertyId",30069:"UIA_DockDockPositionPropertyId",30070:"UIA_ExpandCollapseExpandCollapseStatePropertyId",30071:"UIA_MultipleViewCurrentViewPropertyId",30072:"UIA_MultipleViewSupportedViewsPropertyId",30073:"UIA_WindowCanMaximizePropertyId",30074:"UIA_WindowCanMinimizePropertyId",30075:"UIA_WindowWindowVisualStatePropertyId",30076:"UIA_WindowWindowInteractionStatePropertyId",30077:"UIA_WindowIsModalPropertyId",30078:"UIA_WindowIsTopmostPropertyId",30079:"UIA_SelectionItemIsSelectedPropertyId",30080:"UIA_SelectionItemSelectionContainerPropertyId",30081:"UIA_TableRowHeadersPropertyId",30082:"UIA_TableColumnHeadersPropertyId",30083:"UIA_TableRowOrColumnMajorPropertyId",30084:"UIA_TableItemRowHeaderItemsPropertyId",30085:"UIA_TableItemColumnHeaderItemsPropertyId",30086:"UIA_ToggleToggleStatePropertyId",30087:"UIA_TransformCanMovePropertyId",30088:"UIA_TransformCanResizePropertyId",30089:"UIA_TransformCanRotatePropertyId",30090:"UIA_IsLegacyIAccessiblePatternAvailablePropertyId",30091:"UIA_LegacyIAccessibleChildIdPropertyId",30092:"UIA_LegacyIAccessibleNamePropertyId",30093:"UIA_LegacyIAccessibleValuePropertyId",30094:"UIA_LegacyIAccessibleDescriptionPropertyId",30095:"UIA_LegacyIAccessibleRolePropertyId",30096:"UIA_LegacyIAccessibleStatePropertyId",30097:"UIA_LegacyIAccessibleHelpPropertyId",30098:"UIA_LegacyIAccessibleKeyboardShortcutPropertyId",30099:"UIA_LegacyIAccessibleSelectionPropertyId",30100:"UIA_LegacyIAccessibleDefaultActionPropertyId",30101:"UIA_AriaRolePropertyId",30102:"UIA_AriaPropertiesPropertyId",30103:"UIA_IsDataValidForFormPropertyId",30104:"UIA_ControllerForPropertyId",30105:"UIA_DescribedByPropertyId",30106:"UIA_FlowsToPropertyId",30107:"UIA_ProviderDescriptionPropertyId",30108:"UIA_IsItemContainerPatternAvailablePropertyId",30109:"UIA_IsVirtualizedItemPatternAvailablePropertyId",30110:"UIA_IsSynchronizedInputPatternAvailablePropertyId"} 2422 | if n is integer 2423 | return name[n] 2424 | else return id[n] 2425 | } 2426 | 2427 | ; Property Variant Type 2428 | UIA_PropertyVariantType(id){ 2429 | static type:={30000:0x2003,30001:0x2005,30002:3,30003:3,30004:8,30005:8,30006:8,30007:8,30008:0xB,30009:0xB,30010:0xB,30011:8,30012:8,30013:8,30014:0x2005,30015:3,30016:0xB,30017:0xB,30018:0xD,30019:0xB,30020:3,30021:8,30022:0xB,30023:3,30024:8,30025:0xB,30026:8,30027:0xB,30028:0xB,30029:0xB,30030:0xB,30031:0xB,30032:0xB,30033:0xB,30034:0xB,30035:0xB,30036:0xB,30037:0xB,30038:0xB,30039:0xB,30040:0xB,30041:0xB,30042:0xB,30043:0xB,30044:0xB,30045:8,30046:0xB,30047:5,30048:0xB,30049:5,30050:5,30051:5,30052:5,30053:5,30054:5,30055:5,30056:5,30057:0xB,30058:0xB,30059:0x200D,30060:0xB,30061:0xB,30062:3,30063:3,30064:3,30065:3,30066:3,30067:3,30068:0xD,30069:3,30070:3,30071:3,30072:0x2003,30073:0xB,30074:0xB,30075:3,30076:3,30077:0xB,30078:0xB,30079:0xB,30080:0xD,30081:0x200D,30082:0x200D,30083:0x2003,30084:0x200D,30085:0x200D,30086:3,30087:0xB,30088:0xB,30089:0xB,30090:0xB,30091:3,30092:8,30093:8,30094:8,30095:3,30096:3,30097:8,30098:8,30099:0x200D,30100:8,30101:8,30102:8,30103:0xB,30104:0xD,30105:0xD,30106:0xD,30107:8,30108:0xB,30109:0xB,30110:0xB} 2430 | return type[id] 2431 | } 2432 | 2433 | ; Control Pattern Identifiers 2434 | UIA_Pattern(n){ 2435 | static id:={Invoke:10000,Selection:10001,Value:10002,RangeValue:10003,Scroll:10004,ExpandCollapse:10005,Grid:10006,GridItem:10007,MultipleView:10008,Window:10009,SelectionItem:10010,Dock:10011,Table:10012,TableItem:10013,Text:10014,Toggle:10015,Transform:10016,ScrollItem:10017,LegacyIAccessible:10018,ItemContainer:10019,VirtualizedItem:10020,SynchronizedInput:10021} 2436 | , name:={10000:"UIA_InvokePatternId",10001:"UIA_SelectionPatternId",10002:"UIA_ValuePatternId",10003:"UIA_RangeValuePatternId",10004:"UIA_ScrollPatternId",10005:"UIA_ExpandCollapsePatternId",10006:"UIA_GridPatternId",10007:"UIA_GridItemPatternId",10008:"UIA_MultipleViewPatternId",10009:"UIA_WindowPatternId",10010:"UIA_SelectionItemPatternId",10011:"UIA_DockPatternId",10012:"UIA_TablePatternId",10013:"UIA_TableItemPatternId",10014:"UIA_TextPatternId",10015:"UIA_TogglePatternId",10016:"UIA_TransformPatternId",10017:"UIA_ScrollItemPatternId",10018:"UIA_LegacyIAccessiblePatternId",10019:"UIA_ItemContainerPatternId",10020:"UIA_VirtualizedItemPatternId",10021:"UIA_SynchronizedInputPatternId"} 2437 | if n is integer 2438 | return name[n] 2439 | else return id[n] 2440 | } 2441 | 2442 | ; Text Attribute Identifiers 2443 | UIA_Attribute(n){ 2444 | static id:={AnimationStyle:40000,BackgroundColor:40001,BulletStyle:40002,CapStyle:40003,Culture:40004,FontName:40005,FontSize:40006,FontWeight:40007,ForegroundColor:40008,HorizontalTextAlignment:40009,IndentationFirstLine:40010,IndentationLeading:40011,IndentationTrailing:40012,IsHidden:40013,IsItalic:40014,IsReadOnly:40015,IsSubscript:40016,IsSuperscript:40017,MarginBottom:40018,MarginLeading:40019,MarginTop:40020,MarginTrailing:40021,OutlineStyles:40022,OverlineColor:40023,OverlineStyle:40024,StrikethroughColor:40025,StrikethroughStyle:40026,Tabs:40027,TextFlowDirections:40028,UnderlineColor:40029,UnderlineStyle:40030} 2445 | , name:={40000:"UIA_AnimationStyleAttributeId",40001:"UIA_BackgroundColorAttributeId",40002:"UIA_BulletStyleAttributeId",40003:"UIA_CapStyleAttributeId",40004:"UIA_CultureAttributeId",40005:"UIA_FontNameAttributeId",40006:"UIA_FontSizeAttributeId",40007:"UIA_FontWeightAttributeId",40008:"UIA_ForegroundColorAttributeId",40009:"UIA_HorizontalTextAlignmentAttributeId",40010:"UIA_IndentationFirstLineAttributeId",40011:"UIA_IndentationLeadingAttributeId",40012:"UIA_IndentationTrailingAttributeId",40013:"UIA_IsHiddenAttributeId",40014:"UIA_IsItalicAttributeId",40015:"UIA_IsReadOnlyAttributeId",40016:"UIA_IsSubscriptAttributeId",40017:"UIA_IsSuperscriptAttributeId",40018:"UIA_MarginBottomAttributeId",40019:"UIA_MarginLeadingAttributeId",40020:"UIA_MarginTopAttributeId",40021:"UIA_MarginTrailingAttributeId",40022:"UIA_OutlineStylesAttributeId",40023:"UIA_OverlineColorAttributeId",40024:"UIA_OverlineStyleAttributeId",40025:"UIA_StrikethroughColorAttributeId",40026:"UIA_StrikethroughStyleAttributeId",40027:"UIA_TabsAttributeId",40028:"UIA_TextFlowDirectionsAttributeId",40029:"UIA_UnderlineColorAttributeId",40030:"UIA_UnderlineStyleAttributeId"} 2446 | if n is integer 2447 | return name[n] 2448 | else return id[n] 2449 | } 2450 | 2451 | ; Text Attribute Variant type 2452 | UIA_AttributeVariantType(id){ 2453 | Static type:={40000:3,40001:3,40002:3,40003:3,40004:3,40005:8,40006:5,40007:3,40008:3,40009:3,40010:5,40011:5,40012:5,40013:0xB,40014:0xB,40015:0xB,40016:0xB,40017:0xB,40018:5,40019:5,40020:5,40021:5,40022:3,40023:3,40024:3,40025:3,40026:3,40027:0x2005,40028:3,40029:3,40030:3} 2454 | return type[id] 2455 | } 2456 | 2457 | ; Control Type Identifiers 2458 | UIA_ControlType(n){ 2459 | static id:={Button:50000,Calendar:50001,CheckBox:50002,ComboBox:50003,Edit:50004,Hyperlink:50005,Image:50006,ListItem:50007,List:50008,Menu:50009,MenuBar:50010,MenuItem:50011,ProgressBar:50012,RadioButton:50013,ScrollBar:50014,Slider:50015,Spinner:50016,StatusBar:50017,Tab:50018,TabItem:50019,Text:50020,ToolBar:50021,ToolTip:50022,Tree:50023,TreeItem:50024,Custom:50025,Group:50026,Thumb:50027,DataGrid:50028,DataItem:50029,Document:50030,SplitButton:50031,Window:50032,Pane:50033,Header:50034,HeaderItem:50035,Table:50036,TitleBar:50037,Separator:50038} 2460 | , name:={50000:"UIA_ButtonControlTypeId",50001:"UIA_CalendarControlTypeId",50002:"UIA_CheckBoxControlTypeId",50003:"UIA_ComboBoxControlTypeId",50004:"UIA_EditControlTypeId",50005:"UIA_HyperlinkControlTypeId",50006:"UIA_ImageControlTypeId",50007:"UIA_ListItemControlTypeId",50008:"UIA_ListControlTypeId",50009:"UIA_MenuControlTypeId",50010:"UIA_MenuBarControlTypeId",50011:"UIA_MenuItemControlTypeId",50012:"UIA_ProgressBarControlTypeId",50013:"UIA_RadioButtonControlTypeId",50014:"UIA_ScrollBarControlTypeId",50015:"UIA_SliderControlTypeId",50016:"UIA_SpinnerControlTypeId",50017:"UIA_StatusBarControlTypeId",50018:"UIA_TabControlTypeId",50019:"UIA_TabItemControlTypeId",50020:"UIA_TextControlTypeId",50021:"UIA_ToolBarControlTypeId",50022:"UIA_ToolTipControlTypeId",50023:"UIA_TreeControlTypeId",50024:"UIA_TreeItemControlTypeId",50025:"UIA_CustomControlTypeId",50026:"UIA_GroupControlTypeId",50027:"UIA_ThumbControlTypeId",50028:"UIA_DataGridControlTypeId",50029:"UIA_DataItemControlTypeId",50030:"UIA_DocumentControlTypeId",50031:"UIA_SplitButtonControlTypeId",50032:"UIA_WindowControlTypeId",50033:"UIA_PaneControlTypeId",50034:"UIA_HeaderControlTypeId",50035:"UIA_HeaderItemControlTypeId",50036:"UIA_TableControlTypeId",50037:"UIA_TitleBarControlTypeId",50038:"UIA_SeparatorControlTypeId"} 2461 | if n is integer 2462 | return name[n] 2463 | else return id[n] 2464 | } 2465 | 2466 | ; Event Identifiers 2467 | UIA_Event(n){ 2468 | static id:={ToolTipOpened:20000,ToolTipClosed:20001,StructureChanged:20002,MenuOpened:20003,AutomationPropertyChanged:20004,AutomationFocusChanged:20005,AsyncContentLoaded:20006,MenuClosed:20007,LayoutInvalidated:20008,Invoke_Invoked:20009,SelectionItem_ElementAddedToSelection:20010,SelectionItem_ElementRemovedFromSelection:20011,SelectionItem_ElementSelected:20012,Selection_Invalidated:20013,Text_TextSelectionChanged:20014,Text_TextChanged:20015,Window_WindowOpened:20016,Window_WindowClosed:20017,MenuModeStart:20018,MenuModeEnd:20019,InputReachedTarget:20020,InputReachedOtherElement:20021,InputDiscarded:20022} 2469 | , name:={20000:"UIA_ToolTipOpenedEventId",20001:"UIA_ToolTipClosedEventId",20002:"UIA_StructureChangedEventId",20003:"UIA_MenuOpenedEventId",20004:"UIA_AutomationPropertyChangedEventId",20005:"UIA_AutomationFocusChangedEventId",20006:"UIA_AsyncContentLoadedEventId",20007:"UIA_MenuClosedEventId",20008:"UIA_LayoutInvalidatedEventId",20009:"UIA_Invoke_InvokedEventId",20010:"UIA_SelectionItem_ElementAddedToSelectionEventId",20011:"UIA_SelectionItem_ElementRemovedFromSelectionEventId",20012:"UIA_SelectionItem_ElementSelectedEventId",20013:"UIA_Selection_InvalidatedEventId",20014:"UIA_Text_TextSelectionChangedEventId",20015:"UIA_Text_TextChangedEventId",20016:"UIA_Window_WindowOpenedEventId",20017:"UIA_Window_WindowClosedEventId",20018:"UIA_MenuModeStartEventId",20019:"UIA_MenuModeEndEventId",20020:"UIA_InputReachedTargetEventId",20021:"UIA_InputReachedOtherElementEventId",20022:"UIA_InputDiscardedEventId"} 2470 | if n is integer 2471 | return name[n] 2472 | else return id[n] 2473 | } 2474 | 2475 | ; UI Automation Enumerations 2476 | UIA_Enum(t){ 2477 | static _:={0:0 2478 | ; enum TreeScope Contains values that specify the scope of various operations in the Microsoft UI Automation tree. 2479 | ,TreeScope_Element:0x1 2480 | ,TreeScope_Children:0x2 2481 | ,TreeScope_Descendants:0x4 2482 | ,TreeScope_Parent:0x8 2483 | ,TreeScope_Ancestors:0x10 2484 | ,TreeScope_Subtree:0x7 2485 | ; enum PropertyConditionFlags Contains values used in creating property conditions. 2486 | ,PropertyConditionFlags_None:0 2487 | ,PropertyConditionFlags_IgnoreCase:1 2488 | ; enum AutomationElementMode Contains values that specify the type of reference to use when returning UI Automation elements. 2489 | ,AutomationElementMode_None:0 2490 | ,AutomationElementMode_Full:1 2491 | ;; pattern 2492 | ; enum NavigateDirection Contains values used to specify the direction of navigation within the Microsoft UI Automation tree. 2493 | ,NavigateDirection_Parent:0 2494 | ,NavigateDirection_NextSibling:1 2495 | ,NavigateDirection_PreviousSibling:2 2496 | ,NavigateDirection_FirstChild:3 2497 | ,NavigateDirection_LastChild:4 2498 | ; enum StructureChangeType Contains values that specify the type of change in the Microsoft UI Automation tree structure. 2499 | ,StructureChangeType_ChildAdded:0 2500 | ,StructureChangeType_ChildRemoved:1 2501 | ,StructureChangeType_ChildrenInvalidated:2 2502 | ,StructureChangeType_ChildrenBulkAdded:3 2503 | ,StructureChangeType_ChildrenBulkRemoved:4 2504 | ,StructureChangeType_ChildrenReordered:5 2505 | ; enum OrientationType Contains values that specify the orientation of a control. 2506 | ,OrientationType_None:0 2507 | ,OrientationType_Horizontal:1 2508 | ,OrientationType_Vertical:2 2509 | ; enum DockPosition Contains values that specify the location of a docking window represented by the Dock control pattern. 2510 | ,DockPosition_Top:0 2511 | ,DockPosition_Left:1 2512 | ,DockPosition_Bottom:2 2513 | ,DockPosition_Right:3 2514 | ,DockPosition_Fill:4 2515 | ,DockPosition_None:5 2516 | ; enum ExpandCollapseState Contains values that specify the state of a UI element that can be expanded and collapsed. 2517 | ,ExpandCollapseState_Collapsed:0 2518 | ,ExpandCollapseState_Expanded:1 2519 | ,ExpandCollapseState_PartiallyExpanded:2 2520 | ,ExpandCollapseState_LeafNode:3 2521 | ; enum ScrollAmount Contains values that specify the direction and distance to scroll. 2522 | ,ScrollAmount_LargeDecrement:0 2523 | ,ScrollAmount_SmallDecrement:1 2524 | ,ScrollAmount_NoAmount:2 2525 | ,ScrollAmount_LargeIncrement:3 2526 | ,ScrollAmount_SmallIncrement:4 2527 | ; enum RowOrColumnMajor Contains values that specify whether data in a table should be read primarily by row or by column. 2528 | ,RowOrColumnMajor_RowMajor:0 2529 | ,RowOrColumnMajor_ColumnMajor:1 2530 | ,RowOrColumnMajor_Indeterminate:2 2531 | ; enum ToggleState Contains values that specify the toggle state of a Microsoft UI Automation element that implements the Toggle control pattern. 2532 | ,ToggleState_Off:0 2533 | ,ToggleState_On:1 2534 | ,ToggleState_Indeterminate:2 2535 | ; enum WindowVisualState Contains values that specify the visual state of a window. 2536 | ,WindowVisualState_Normal:0 2537 | ,WindowVisualState_Maximized:1 2538 | ,WindowVisualState_Minimized:2 2539 | ; enum SynchronizedInputType Contains values that specify the type of synchronized input. 2540 | ,SynchronizedInputType_KeyUp:0x1 2541 | ,SynchronizedInputType_KeyDown:0x2 2542 | ,SynchronizedInputType_LeftMouseUp:0x4 2543 | ,SynchronizedInputType_LeftMouseDown:0x8 2544 | ,SynchronizedInputType_RightMouseUp:0x10 2545 | ,SynchronizedInputType_RightMouseDown:0x20 2546 | ; enum WindowInteractionState Contains values that specify the current state of the window for purposes of user interaction. 2547 | ,WindowInteractionState_Running:0 2548 | ,WindowInteractionState_Closing:1 2549 | ,WindowInteractionState_ReadyForUserInteraction:2 2550 | ,WindowInteractionState_BlockedByModalWindow:3 2551 | ; enum textUnit Contains values that specify units of text for the purposes of navigation. 2552 | ,TextUnit_Character:0 2553 | ,TextUnit_Format:1 2554 | ,TextUnit_Word:2 2555 | ,TextUnit_Line:3 2556 | ,TextUnit_Paragraph:4 2557 | ,TextUnit_Page:5 2558 | ,TextUnit_Document:6 2559 | ; enum TextPatternRangeEndpoint Contains values that specify the endpoints of a text range. 2560 | ,TextPatternRangeEndpoint_Start:0 2561 | ,TextPatternRangeEndpoint_End:1 2562 | ; enum SupportedTextSelection Contains values that specify the supported text selection attribute. 2563 | ,SupportedTextSelection_Multiple:2 2564 | ,SupportedTextSelection_None:0 2565 | ,SupportedTextSelection_Single:1} 2566 | /* 2567 | ;; IAccessible 2568 | ; enum SELFLAG specify how an accessible object becomes selected or takes the focus. http://msdn.microsoft.com/en-us/library/dd373634(v=vs.85).aspx 2569 | ,SELFLAG_NONE:0 2570 | ,SELFLAG_TAKEFOCUS:0x1 2571 | ,SELFLAG_TAKESELECTION:0x2 2572 | ,SELFLAG_EXTENDSELECTION:0x4 2573 | ,SELFLAG_ADDSELECTION:0x8 2574 | ,SELFLAG_REMOVESELECTION:0x10 2575 | ,SELFLAG_VALID:0x1f 2576 | ; enum Roles describe the roles of various UI objects in an application. http://msdn.microsoft.com/en-us/library/dd373608%28v=vs.85%29.aspx 2577 | ,ROLE_SYSTEM_TITLEBAR:0x1 2578 | ,ROLE_SYSTEM_MENUBAR:0x2 2579 | ,ROLE_SYSTEM_SCROLLBAR:0x3 2580 | ,ROLE_SYSTEM_GRIP:0x4 2581 | ,ROLE_SYSTEM_SOUND:0x5 2582 | ,ROLE_SYSTEM_CURSOR:0x6 2583 | ,ROLE_SYSTEM_CARET:0x7 2584 | ,ROLE_SYSTEM_ALERT:0x8 2585 | ,ROLE_SYSTEM_WINDOW:0x9 2586 | ,ROLE_SYSTEM_CLIENT:0xa 2587 | ,ROLE_SYSTEM_MENUPOPUP:0xb 2588 | ,ROLE_SYSTEM_MENUITEM:0xc 2589 | ,ROLE_SYSTEM_TOOLTIP:0xd 2590 | ,ROLE_SYSTEM_APPLICATION:0xe 2591 | ,ROLE_SYSTEM_DOCUMENT:0xf 2592 | ,ROLE_SYSTEM_PANE:0x10 2593 | ,ROLE_SYSTEM_CHART:0x11 2594 | ,ROLE_SYSTEM_DIALOG:0x12 2595 | ,ROLE_SYSTEM_BORDER:0x13 2596 | ,ROLE_SYSTEM_GROUPING:0x14 2597 | ,ROLE_SYSTEM_SEPARATOR:0x15 2598 | ,ROLE_SYSTEM_TOOLBAR:0x16 2599 | ,ROLE_SYSTEM_STATUSBAR:0x17 2600 | ,ROLE_SYSTEM_TABLE:0x18 2601 | ,ROLE_SYSTEM_COLUMNHEADER:0x19 2602 | ,ROLE_SYSTEM_ROWHEADER:0x1a 2603 | ,ROLE_SYSTEM_COLUMN:0x1b 2604 | ,ROLE_SYSTEM_ROW:0x1c 2605 | ,ROLE_SYSTEM_CELL:0x1d 2606 | ,ROLE_SYSTEM_LINK:0x1e 2607 | ,ROLE_SYSTEM_HELPBALLOON:0x1f 2608 | ,ROLE_SYSTEM_CHARACTER:0x20 2609 | ,ROLE_SYSTEM_LIST:0x21 2610 | ,ROLE_SYSTEM_LISTITEM:0x22 2611 | ,ROLE_SYSTEM_OUTLINE:0x23 2612 | ,ROLE_SYSTEM_OUTLINEITEM:0x24 2613 | ,ROLE_SYSTEM_PAGETAB:0x25 2614 | ,ROLE_SYSTEM_PROPERTYPAGE:0x26 2615 | ,ROLE_SYSTEM_INDICATOR:0x27 2616 | ,ROLE_SYSTEM_GRAPHIC:0x28 2617 | ,ROLE_SYSTEM_STATICTEXT:0x29 2618 | ,ROLE_SYSTEM_TEXT:0x2a 2619 | ,ROLE_SYSTEM_PUSHBUTTON:0x2b 2620 | ,ROLE_SYSTEM_CHECKBUTTON:0x2c 2621 | ,ROLE_SYSTEM_RADIOBUTTON:0x2d 2622 | ,ROLE_SYSTEM_COMBOBOX:0x2e 2623 | ,ROLE_SYSTEM_DROPLIST:0x2f 2624 | ,ROLE_SYSTEM_PROGRESSBAR:0x30 2625 | ,ROLE_SYSTEM_DIAL:0x31 2626 | ,ROLE_SYSTEM_HOTKEYFIELD:0x32 2627 | ,ROLE_SYSTEM_SLIDER:0x33 2628 | ,ROLE_SYSTEM_SPINBUTTON:0x34 2629 | ,ROLE_SYSTEM_DIAGRAM:0x35 2630 | ,ROLE_SYSTEM_ANIMATION:0x36 2631 | ,ROLE_SYSTEM_EQUATION:0x37 2632 | ,ROLE_SYSTEM_BUTTONDROPDOWN:0x38 2633 | ,ROLE_SYSTEM_BUTTONMENU:0x39 2634 | ,ROLE_SYSTEM_BUTTONDROPDOWNGRID:0x3a 2635 | ,ROLE_SYSTEM_WHITESPACE:0x3b 2636 | ,ROLE_SYSTEM_PAGETABLIST:0x3c 2637 | ,ROLE_SYSTEM_CLOCK:0x3d 2638 | ,ROLE_SYSTEM_SPLITBUTTON:0x3e 2639 | ,ROLE_SYSTEM_IPADDRESS:0x3f 2640 | ,ROLE_SYSTEM_OUTLINEBUTTON:0x40 2641 | ; enum State describe the state of objects in an application UI. http://msdn.microsoft.com/en-us/library/dd373609%28v=vs.85%29.aspx 2642 | ,STATE_SYSTEM_NORMAL:0 2643 | ,STATE_SYSTEM_UNAVAILABLE:0x1 2644 | ,STATE_SYSTEM_SELECTED:0x2 2645 | ,STATE_SYSTEM_FOCUSED:0x4 2646 | ,STATE_SYSTEM_PRESSED:0x8 2647 | ,STATE_SYSTEM_CHECKED:0x10 2648 | ,STATE_SYSTEM_MIXED:0x20 2649 | ,STATE_SYSTEM_INDETERMINATE:0x20 2650 | ,STATE_SYSTEM_READONLY:0x40 2651 | ,STATE_SYSTEM_HOTTRACKED:0x80 2652 | ,STATE_SYSTEM_DEFAULT:0x100 2653 | ,STATE_SYSTEM_EXPANDED:0x200 2654 | ,STATE_SYSTEM_COLLAPSED:0x400 2655 | ,STATE_SYSTEM_BUSY:0x800 2656 | ,STATE_SYSTEM_FLOATING:0x1000 2657 | ,STATE_SYSTEM_MARQUEED:0x2000 2658 | ,STATE_SYSTEM_ANIMATED:0x4000 2659 | ,STATE_SYSTEM_INVISIBLE:0x8000 2660 | ,STATE_SYSTEM_OFFSCREEN:0x10000 2661 | ,STATE_SYSTEM_SIZEABLE:0x20000 2662 | ,STATE_SYSTEM_MOVEABLE:0x40000 2663 | ,STATE_SYSTEM_SELFVOICING:0x80000 2664 | ,STATE_SYSTEM_FOCUSABLE:0x100000 2665 | ,STATE_SYSTEM_SELECTABLE:0x200000 2666 | ,STATE_SYSTEM_LINKED:0x400000 2667 | ,STATE_SYSTEM_TRAVERSED:0x800000 2668 | ,STATE_SYSTEM_MULTISELECTABLE:0x1000000 2669 | ,STATE_SYSTEM_EXTSELECTABLE:0x2000000 2670 | ,STATE_SYSTEM_ALERT_LOW:0x4000000 2671 | ,STATE_SYSTEM_ALERT_MEDIUM:0x8000000 2672 | ,STATE_SYSTEM_ALERT_HIGH:0x10000000 2673 | ,STATE_SYSTEM_PROTECTED:0x20000000 2674 | ,STATE_SYSTEM_VALID:0x7fffffff 2675 | ,STATE_SYSTEM_HASPOPUP:0x40000000 2676 | ; enum Event describes the events that are generated by the operating system and by server applications. http://msdn.microsoft.com/en-us/library/dd318066%28v=vs.85%29.aspx 2677 | ,EVENT_MIN:0x00000001 2678 | ,EVENT_MAX:0x7FFFFFFF 2679 | ,EVENT_SYSTEM_SOUND:0x0001 2680 | ,EVENT_SYSTEM_ALERT:0x0002 2681 | ,EVENT_SYSTEM_FOREGROUND:0x0003 2682 | ,EVENT_SYSTEM_MENUSTART:0x0004 2683 | ,EVENT_SYSTEM_MENUEND:0x0005 2684 | ,EVENT_SYSTEM_MENUPOPUPSTART:0x0006 2685 | ,EVENT_SYSTEM_MENUPOPUPEND:0x0007 2686 | ,EVENT_SYSTEM_CAPTURESTART:0x0008 2687 | ,EVENT_SYSTEM_CAPTUREEND:0x0009 2688 | ,EVENT_SYSTEM_MOVESIZESTART:0x000A 2689 | ,EVENT_SYSTEM_MOVESIZEEND:0x000B 2690 | ,EVENT_SYSTEM_CONTEXTHELPSTART:0x000C 2691 | ,EVENT_SYSTEM_CONTEXTHELPEND:0x000D 2692 | ,EVENT_SYSTEM_DRAGDROPSTART:0x000E 2693 | ,EVENT_SYSTEM_DRAGDROPEND:0x000F 2694 | ,EVENT_SYSTEM_DIALOGSTART:0x0010 2695 | ,EVENT_SYSTEM_DIALOGEND:0x0011 2696 | ,EVENT_SYSTEM_SCROLLINGSTART:0x0012 2697 | ,EVENT_SYSTEM_SCROLLINGEND:0x0013 2698 | ,EVENT_SYSTEM_SWITCHSTART:0x0014 2699 | ,EVENT_SYSTEM_SWITCHEND:0x0015 2700 | ,EVENT_SYSTEM_MINIMIZESTART:0x0016 2701 | ,EVENT_SYSTEM_MINIMIZEEND:0x0017 2702 | ,EVENT_SYSTEM_DESKTOPSWITCH:0x0020 2703 | ,EVENT_SYSTEM_END:0x00FF 2704 | ,EVENT_OEM_DEFINED_START:0x0101 2705 | ,EVENT_OEM_DEFINED_END:0x01FF 2706 | ,EVENT_UIA_EVENTID_START:0x4E00 2707 | ,EVENT_UIA_EVENTID_END:0x4EFF 2708 | ,EVENT_UIA_PROPID_START:0x7500 2709 | ,EVENT_UIA_PROPID_END:0x75FF 2710 | ,EVENT_CONSOLE_CARET:0x4001 2711 | ,EVENT_CONSOLE_UPDATE_REGION:0x4002 2712 | ,EVENT_CONSOLE_UPDATE_SIMPLE:0x4003 2713 | ,EVENT_CONSOLE_UPDATE_SCROLL:0x4004 2714 | ,EVENT_CONSOLE_LAYOUT:0x4005 2715 | ,EVENT_CONSOLE_START_APPLICATION:0x4006 2716 | ,EVENT_CONSOLE_END_APPLICATION:0x4007 2717 | ,EVENT_CONSOLE_END:0x40FF 2718 | ,EVENT_OBJECT_CREATE:0x8000 2719 | ,EVENT_OBJECT_DESTROY:0x8001 2720 | ,EVENT_OBJECT_SHOW:0x8002 2721 | ,EVENT_OBJECT_HIDE:0x8003 2722 | ,EVENT_OBJECT_REORDER:0x8004 2723 | ,EVENT_OBJECT_FOCUS:0x8005 2724 | ,EVENT_OBJECT_SELECTION:0x8006 2725 | ,EVENT_OBJECT_SELECTIONADD:0x8007 2726 | ,EVENT_OBJECT_SELECTIONREMOVE:0x8008 2727 | ,EVENT_OBJECT_SELECTIONWITHIN:0x8009 2728 | ,EVENT_OBJECT_STATECHANGE:0x800A 2729 | ,EVENT_OBJECT_LOCATIONCHANGE:0x800B 2730 | ,EVENT_OBJECT_NAMECHANGE:0x800C 2731 | ,EVENT_OBJECT_DESCRIPTIONCHANGE:0x800D 2732 | ,EVENT_OBJECT_VALUECHANGE:0x800E 2733 | ,EVENT_OBJECT_PARENTCHANGE:0x800F 2734 | ,EVENT_OBJECT_HELPCHANGE:0x8010 2735 | ,EVENT_OBJECT_DEFACTIONCHANGE:0x8011 2736 | ,EVENT_OBJECT_ACCELERATORCHANGE:0x8012 2737 | ,EVENT_OBJECT_INVOKED:0x8013 2738 | ,EVENT_OBJECT_TEXTSELECTIONCHANGED:0x8014 2739 | ,EVENT_OBJECT_CONTENTSCROLLED:0x8015 2740 | ,EVENT_SYSTEM_ARRANGMENTPREVIEW:0x8016 2741 | ,EVENT_OBJECT_END:0x80FF 2742 | ,EVENT_AIA_START:0xA000 2743 | ,EVENT_AIA_END:0xAFFF 2744 | ; enum Navigation indicate the spatial (up, down, left, and right) or logical (first child, last, next, and previous) direction observed when clients use IAccessible::accNavigate to navigate from one user interface element to another within the same container. http://msdn.microsoft.com/en-us/library/dd373600%28v=vs.85%29.aspx 2745 | ,NAVDIR_MIN:0 2746 | ,NAVDIR_UP:1 2747 | ,NAVDIR_DOWN:2 2748 | ,NAVDIR_LEFT:3 2749 | ,NAVDIR_RIGHT:4 2750 | ,NAVDIR_NEXT:5 2751 | ,NAVDIR_PREVIOUS:6 2752 | ,NAVDIR_FIRSTCHILD:7 2753 | ,NAVDIR_LASTCHILD:8 2754 | ,NAVDIR_MAX:9 2755 | ; enum Object Identifiers determine the object to which a WM_GETOBJECT message request refers. http://msdn.microsoft.com/en-us/library/dd373606%28v=vs.85%29.aspx 2756 | ,OBJID_WINDOW:0 2757 | ,OBJID_SYSMENU:-1 2758 | ,OBJID_TITLEBAR:-2 2759 | ,OBJID_MENU:-3 2760 | ,OBJID_CLIENT:-4 2761 | ,OBJID_VSCROLL:-5 2762 | ,OBJID_HSCROLL:-6 2763 | ,OBJID_SIZEGRIP:-7 2764 | ,OBJID_CARET:-8 2765 | ,OBJID_CURSOR:-9 2766 | ,OBJID_ALERT:-10 2767 | ,OBJID_SOUND:-11 2768 | ,OBJID_QUERYCLASSNAMEIDX:-12 2769 | ,OBJID_NATIVEOM:-16 2770 | */ 2771 | return _[t] 2772 | } 2773 | 2774 | ;;;;;;;;;;;;;;;;;; 2775 | ;;Base Functions;; 2776 | ;;;;;;;;;;;;;;;;;; 2777 | 2778 | ; vtable 2779 | vt(p,n){ 2780 | return NumGet(NumGet(p+0,"ptr")+n*A_PtrSize,"ptr") 2781 | } 2782 | 2783 | ; riid 2784 | GUID(ByRef GUID, sGUID){ 2785 | VarSetCapacity(GUID, 16, 0) 2786 | return DllCall("ole32\CLSIDFromString", "wstr", sGUID, "ptr", &GUID) >= 0 ? &GUID : "" 2787 | } 2788 | -------------------------------------------------------------------------------- /sample3.ahk: -------------------------------------------------------------------------------- 1 | /* 2 | Show how to recieve callback of FocusChanged event. 3 | */ 4 | #SingleInstance,force 5 | #Persistent 6 | #Include uia.ahk 7 | global $u:=new IUIAutomation,$e:=new IUIAutomationElement 8 | $u.39(0,uia_OnEvent(pEvent,"OnFocus")) 9 | return 10 | OnFocus(self,sender){ 11 | Critical 12 | ToolTip % $e.(sender).23 13 | } 14 | --------------------------------------------------------------------------------