gpt4 book ai didi

VBS sendkeys 模拟击键操作 问题解决

转载 作者:qq735679552 更新时间:2022-09-29 22:32:09 24 4
gpt4 key购买 nike

CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界.

这篇CFSDN的博客文章VBS sendkeys 模拟击键操作 问题解决由作者收集整理,如果你对这篇文章有兴趣,记得点赞哟.

复制代码 代码如下

' ====================================== ' VBS 中 SendKeys 模拟键盘击键 ' 2009-07-26 ' 刘林 ' ====================================== Dim WshShell Set WshShell=WScript.CreateObject("WScript.Shell") WshShell.Run "cmd" ' 让脚本等待1000毫秒,也就是1秒再执行下一条语句 WScript.Sleep 1000 ' -- 发送字符时,输入法一定要在英文件状态下 ' 发送分号 WshShell.SendKeys ";" WScript.Sleep 1000 ' 发送冒号 WshShell.SendKeys ":" WScript.Sleep 1000 ' 发送双引号 -- 利用chr把双引号转换出来 WshShell.SendKeys Chr(34) WScript.Sleep 1000 ' 发送带有双引号的字符串 WshShell.SendKeys Chr(34)&"this is a string"&Chr(34) WScript.Sleep 1000 ' -- 切记,这里是模拟的击键操作,所以不能发送中文 'WshShell.SendKeys Chr(34)&"这是一个字符串"&Chr(34) WScript.Sleep 1000 ' ================================================ ' -- 如何模拟回车,上档键,Alt键喃? ' ================================================ ' -- 如何模拟回车, -- {enter}这就代表是发送回车 WshShell.SendKeys "this is a enter!{enter}" WScript.Sleep 1000 ' -- 如何模拟上档键Shift, -- +这就代表是发送shift WshShell.SendKeys "this is +a" ' 结果为 this is A WScript.Sleep 1000 ' -- 如何模拟Alt, -- %这就代表是发送Alt WshShell.SendKeys "this is %{TAB}" ' 结果为 切换窗口 WScript.Sleep 1000 ' =========================================================== ' -- 那么如何发送%, + ^ 喃 WshShell.SendKeys "this is {+}{^}{%}" ' 结果为 切换窗口 WScript.Sleep 1000 ' -- 这里你可能已经明白了,发送送特殊字符时,请放到 {} 中 ' =========================================================== ' ====================================== ' 更多信息请看VBS帮助文档 2009-07-26 ' ====================================== 。

最后此篇关于VBS sendkeys 模拟击键操作 问题解决的文章就讲到这里了,如果你想了解更多关于VBS sendkeys 模拟击键操作 问题解决的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com