//自动化 - 发送字符串 //教程: doc://library-guide/std/key/sendString.md //doc://example/Automation/Text/sendString.aardio //doc://example/Languages/Python/Python%203.x/QuickStart.md 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("发送字符串,替换当前选区。");