vbs脚本的问题

来源:百度知道 编辑:UC知道 时间:2024/06/08 20:04:29
WshShell.SendKeys"lcd D:\QTP"
WshShell.SendKeys"{ENTER}"

WshShell.SendKeys"lcd Tests"
WshShell.SendKeys"{ENTER}"

==> WshShell.SendKeys"lcd 中国移动江苏公司BOMC体验"
WshShell.SendKeys"{ENTER}"

以上这个脚本中用箭头指明的语句不能执行,请问中文在这里应该怎么解决啊,在必须使用中文的情况下,请大家帮忙想想办法,谢谢了

直接就用sendkeys是不行的 sendkey不支持发送中文 但是可以通过建立ie对象实现 代码如下(程序已经通过测试~ 有问题的话发百度消息给我):
set WshShell=createobject("wscript.shell")
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate("about:blank")

WshShell.SendKeys"lcd D:\QTP"
WshShell.SendKeys"{ENTER}"
WshShell.SendKeys"lcd Tests"
WshShell.SendKeys"{ENTER}"

objIE.document.parentwindow.clipboardData.SetData "text","lcd 中国移动江苏公司BOMC体验"
WshShell.AppActivate ""
WshShell.Sendkeys"^v"
WshShell.SendKeys"{ENTER}"