VBS窗口获取焦点,高手们请指教!
如下面代码,我在打开记事本之后(等待4000时)把光标移到其它窗口,然后让代码再把焦点选在记事本上并随便输入一些字符!DimWshShellSetWshShell=WSc...
如下面代码,我在打开记事本之后(等待4000时)把光标移到其它窗口,然后让代码再把焦点选在记事本上并随便输入一些字符!
Dim WshShell
Set WshShell=WScript.CreateObject("WScript.Shell")
WshShell.Run "notepad"
WScript.Sleep 4000 "!这时把光标移到另外一个窗口
WshShell.AppActivate "Untitled"
WScript.Sleep 500
WshShell.SendKeys"aadsfadfadbsvzxcv"
照这段代码执行,焦点选择不上记事本,望高手指教,谢谢! 展开
Dim WshShell
Set WshShell=WScript.CreateObject("WScript.Shell")
WshShell.Run "notepad"
WScript.Sleep 4000 "!这时把光标移到另外一个窗口
WshShell.AppActivate "Untitled"
WScript.Sleep 500
WshShell.SendKeys"aadsfadfadbsvzxcv"
照这段代码执行,焦点选择不上记事本,望高手指教,谢谢! 展开
2个回答
展开全部
Dim WshShell
Set WshShell=WScript.CreateObject("WScript.Shell")
WshShell.Run "notepad"
WScript.Sleep 4000 "!这时把光标移到另外一个窗口
WshShell.AppActivate "无标题 - 记事本"
WScript.Sleep 500
WshShell.SendKeys"aadsfadfadbsvzxcv"
Set WshShell=WScript.CreateObject("WScript.Shell")
WshShell.Run "notepad"
WScript.Sleep 4000 "!这时把光标移到另外一个窗口
WshShell.AppActivate "无标题 - 记事本"
WScript.Sleep 500
WshShell.SendKeys"aadsfadfadbsvzxcv"
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询