现在的位置: 首页 > 综合 > 正文

差点搞死我的一个脚本

2013年07月21日 ⁄ 综合 ⁄ 共 402字 ⁄ 字号 评论关闭
想让记事本也有自动每隔一段时间就自动保存一次的功能,于是写下这个脚本。可惜那个时间弄的不合理,差点被搞死。
sleeptime=30000
Set ws=WScript.CreateObject("wscript.shell")
txtname=InputBox("请输入要保存的文件名(不支持中文和纯数字)")
ws.Run "notepad"
WScript.Sleep 300
ws.AppActivate "无标题-记事本"
ws.SendKeys "^s"
WScript.Sleep 300
ws.SendKeys txtname
WScript.Sleep 300
ws.SendKeys "%s"
WScript.Sleep sleeptime
While ws.AppActivate(txtname)=True
ws.SendKeys "^s"
WScript.Sleep sleeptime
Wend
WScript.Quit
有兴趣的就试试。

抱歉!评论已关闭.