# aardio 范例: 自动化 - 发送字符串

```aardio
//自动化 - 发送字符串
//教程: https://www.aardio.com/zh-cn/doc/library-guide/std/key/sendString.html
//https://www.aardio.com/zh-cn/doc/example/Automation/Text/sendString.html
//https://www.aardio.com/zh-cn/doc/example/Languages/Python/Python%203.x/QuickStart.html
import winex; 
import process;
import winex.editor;
import key;
import mouse;

//运行程序
process.execute("notepad.exe");

//等待鼠标左键单击
mouse.wait();

//延时
thread.delay(500);

//发送全选组合键
key.combine("CTRL","A");

//发送文本。兼容性最好。但换行发回车键，制表符发 tab 键，其他控制字符忽略。
key.sendString("直接发送字符串。");

//打字效果
key.sendString( "这样就可以实现打字效果了。",200);
 
//仅支持 EM_REPLACESEL 消息的经典编辑框效果最好，回车与制表符都以纯文本方式发送。 
winex.sendString("发送字符串，替换当前选区。"); 

//自动选择合适的发送方式 
winex.editor.sendString("发送字符串，替换当前选区。"); 
```