# System.Windows.Automation 库模块帮助文档

<details>  <summary>说明</summary>  <p>
不建议在同一进程中同时导入 System.Windows.Automation，System.Windows.Automation.3。
如果先导入了 System.Windows.Automation.3 则导入 System.Windows.Automation 时忽略不作任何操作。
</p></details>

## System.Windows.Automation 成员列表 <a id="System.Windows.Automation" href="#System.Windows.Automation">&#x23;</a>

.NET System.Windows.Automation 组件。  
System.Windows.Automation.3 扩展库可导入兼容的库。  
用法相同且扩展了部分接口。  
[相关文档](https://learn.microsoft.com/zh-cn/dotnet/api/system.windows.automation?view=netframework-4.6)  

[返回对象:dotNetNameSpaceObject](https://www.aardio.com/zh-cn/docs/library-reference/dotNet/appDomain.html#dotNetNameSpaceObject)

### System.Windows.Automation.And(与条件表) <a id="System.Windows.Automation.And" href="#System.Windows.Automation.And">&#x23;</a>

```aardio
System.Windows.Automation.And({  
	ClassName = "Notepad",  
	ControlType = "Window";  
})
```

### System.Windows.Automation.Find <a id="System.Windows.Automation.Find" href="#System.Windows.Automation.Find">&#x23;</a>
查找节点。  
凡是使用此函数返回的节点都会提供一个 Find 函数用于查找子节点。  
其他函数返回的节点没有 Find 方法。

### System.Windows.Automation.Find(与条件表,与条件表...) <a id="System.Windows.Automation.Find" href="#System.Windows.Automation.Find">&#x23;</a>
此函数只有一个参数时作用与 FindByAnd 函数相同。  
表中的任何一个表参数都是 and 条件，而多个参数之间是 or 条件。  
如果参数表中单个键值对的值部分是数组，则该键值对为一个 or 条件。  
表中的名字应当是 UIA 对象的属性名，首字母要大写，  
常见的属性例如 AutomationId，Name，ControlType 等，详见 UIA 文档。  
ControlType 属性可用的值为 System.Windows.Automation.ControlType 的成员，  
常见的如 "Button", "Text"，也可以写数值。  
例如 inspect 里 ControlType 显示 UIA_TextControlTypeId （0xC364）  
那么在这里要么写 "Text"，要么就写 0xC364。

### System.Windows.Automation.Find(根节点,与条件表,与条件表...) <a id="System.Windows.Automation.Find" href="#System.Windows.Automation.Find">&#x23;</a>
此函数只有一个参数时作用与 FindByAnd 函数相同。  
表中的任何一个表参数都是 and 条件，而多个参数之间是 or 条件。  
表中的名字应当是 UIA 对象的属性名，首字母要大写，  
常见的属性例如 AutomationId，Name，ControlType 等，详见 UIA 文档。  
ControlType 属性可用的值为 System.Windows.Automation.ControlType 的成员，  
常见的如 "Button", "Text"，也可以写数值。  
例如 inspect 里 ControlType 显示 UIA_TextControlTypeId （0xC364）  
那么在这里要么写 "Text"，要么就写 0xC364。

### System.Windows.Automation.FindByAnd(与条件表) <a id="System.Windows.Automation.FindByAnd" href="#System.Windows.Automation.FindByAnd">&#x23;</a>

```aardio
System.Windows.Automation.FindByAnd({  
	ClassName = "Notepad",  
	ControlType = "Window";  
})
```

### System.Windows.Automation.FindByOr(或条件表) <a id="System.Windows.Automation.FindByOr" href="#System.Windows.Automation.FindByOr">&#x23;</a>

```aardio
System.Windows.Automation.FindByOr({  
	ClassName = {"RichEditD2DPT","RICHEDIT50W","Edit" }  
})
```

### System.Windows.Automation.GetCaret(hFocus) <a id="System.Windows.Automation.GetCaret" href="#System.Windows.Automation.GetCaret">&#x23;</a>
获取当前输入光标位置，  
返回表示屏幕位置的 ::RECT 结构体，hwnd 字段指定句柄。  
可选用参数 @1 指定输入焦点所在窗口句柄。  

此函数用于 winex.caret ,  
 由 System.Windows.Automation.3 库实现。

### System.Windows.Automation.Not(与条件表取反) <a id="System.Windows.Automation.Not" href="#System.Windows.Automation.Not">&#x23;</a>

```aardio
System.Windows.Automation.Not({  
	ClassName = "Notepad",  
	ControlType = "Window";  
})
```

### System.Windows.Automation.Or(或条件表) <a id="System.Windows.Automation.Or" href="#System.Windows.Automation.Or">&#x23;</a>

```aardio
System.Windows.Automation.Or({  
	ClassName = {"RichEditD2DPT","RICHEDIT50W","Edit" }  
})
```

## System.Windows.Automation.AutomationElement 成员列表 <a id="System.Windows.Automation.AutomationElement" href="#System.Windows.Automation.AutomationElement">&#x23;</a>

### System.Windows.Automation.AutomationElement.FromHandle(hwnd) <a id="System.Windows.Automation.AutomationElement.FromHandle" href="#System.Windows.Automation.AutomationElement.FromHandle">&#x23;</a>
自 @hwnd 参数指定句柄的窗口获取 AutomationElement 对象

## System.Windows.Automation.AutomationElement.RootElement 成员列表 <a id="System.Windows.Automation.AutomationElement.RootElement" href="#System.Windows.Automation.AutomationElement.RootElement">&#x23;</a>

### System.Windows.Automation.AutomationElement.RootElement.FocusedElement <a id="System.Windows.Automation.AutomationElement.RootElement.FocusedElement" href="#System.Windows.Automation.AutomationElement.RootElement.FocusedElement">&#x23;</a>
获取当前拥有输入焦点的 AutomationElement 对象
