加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

windows – Vbscript Printscreen到MSpaint

发布时间:2020-12-14 03:51:42 所属栏目:Windows 来源:网络整理
导读:拍摄活动窗口的屏幕截图. Set Wshshell=CreateObject("Word.Basic")WshShell.sendkeys"%{prtsc}"WScript.Sleep 1500 运行Mspaint并粘贴. set Wshshell = WScript.CreateObject("WScript.Shell")Wshshell.Run "mspaint"WScript.Sleep 500WshShell.AppActivate
拍摄活动窗口的屏幕截图.

Set Wshshell=CreateObject("Word.Basic")
WshShell.sendkeys"%{prtsc}"
WScript.Sleep 1500

运行Mspaint并粘贴.

set Wshshell = WScript.CreateObject("WScript.Shell")
Wshshell.Run "mspaint"
WScript.Sleep 500

WshShell.AppActivate "Paint"
WScript.Sleep 500

WshShell.sendkeys "^(v)"
WScript.Sleep 1500

这里,拍摄活动窗口截图的操作很好..
此外,它以mspaint开头,但内容未粘贴在paint文件中.

解决方法

您对.Sendkeys的^ V参数是错误的,它应该是:

WshShell.sendkeys "^v"

.AppActivate之后的.Sleep似乎很关键;在我增加睡眠时间之前,我无法让它“工作”:

WshShell.AppActivate "Paint"
WScript.Sleep 5000

你的问题证明了这一点.Sendkeys不可靠.看here,especially the posting of Moby Disk考虑其他策略.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读