AutoIt3 对于 unicode 的支持不是很好,但是可以绕道实现 Send 函数对于 unicode的支持
它的帮助文档里有这么一段话
To send UNICODE characters enter the character code, for example this sends a Chinese character
Send("{ASC 2709}")
http://Novell.Me
Code: ;====================================================== ; ; Function Name: _SendUnicode("string") ; Description: Send a unicode or an ASCII string. ; Parameter(s): $string is the string you want to send. ; Requirement(s): String Input. ; Return Value(s): None ; Author(s): Robie Zhou (robiezhou@gmail.com) ; ;====================================================== Func _SendUnicode($string) Local $char Local $code For $i = 1 to StringLen($string) Novell迷网站原创内容,未经允许,谢绝转载! $char = StringMid($string, $i, 1) $code = Asc($char) If $code > 127 Then $code = $code * 256 $i = $i + 1 $char = StringMid($string, $i, 1) $code = $code + Asc($char) EndIf Send("{ASC " & $code & "}") Next EndFunc |
Novell迷,迷Novell
建议把上面的函数加到autoit安装目录下的 include 子目录的 String.au3 文件里。
这样下次直接调用就可以了
再看一个例子,用上面的函数发送一个中英文混合的字符串
本例子只能运行在中文Windows上 Novell迷网站原创内容,未经允许,谢绝转载!
Code: #include <String.au3> Run("notepad.exe") WinWaitActive("未定标题") _SendUnicode("测试一下AutoIt对于Unicode的支持") Send("{ENTER}") |
本文引用自http://novell.me
本文转自 https://dream4ever.org/showthread.php?t=54252 转载请注明出处!本文地址 http://novell.me/zenworks/2009/0531/AutoIT3-unicode.html
(责任编辑:Novell迷)