让脚本在输入短句后自动关闭记事本,并保存文件名为“test”
Dim WshShellSet WshShell=WScript.CreateObject("Wscript.Shell")
WshShell.Run"notepad"
WScript.Sleep 2000
WshShell.AppActivate"无标题-记事本"
WshShell.SendKeys"hahahahahaha"
WshShell.SendKeys"%{F4}"
WshShell.SendKeys"s"
然后怎么保存文件名为“test”? 为什么不用fso来做这件事情 Ctrl + S
Send key filepath+name
Ctrl + S
请毋庸于界面自动化这种做法完全错误。 原帖由 feifei956998 于 2009-11-30 12:44 发表 http://bbs.51testing.com/images/common/back.gif
Dim WshShell
Set WshShell=WScript.CreateObject("Wscript.Shell")
WshShell.Run"notepad"
WScript.Sleep 2000
WshShell.AppActivate"无标题-记事本"
WshShell.SendKeys"hahahahahaha"
WshShell.SendKeys"%{F ...
看到你的名字下面有个“51testing测试培训就业人员”, 培训完后, 连这个问题都解决不了!
我真的为 51testing 培训感到无语了! 原帖由 dftx511619 于 2009-11-30 13:36 发表 http://bbs.51testing.com/images/common/back.gif
看到你的名字下面有个“51testing测试培训就业人员”, 培训完后, 连这个问题都解决不了!
我真的为 51testing 培训感到无语了!
:L因为我工作得比较早,没学到这个呢。
不懂就问一下应该没错的吧? fso处理好些吧 原帖由 nimcok 于 2009-11-30 14:22 发表 http://bbs.51testing.com/images/common/back.gif
fso处理好些吧
这位兄弟正解!用FSO对象来处理最简单! Dim WshShell
Set WshShell=WScript.CreateObject("WScript.Shell")
WshShell.Run"notepad"
WScript.Sleep 1000
WshShell.AppActivate"无标题-记事本"
WshShell.SendKeys"no means yes!"
WshShell.SendKeys"%FA"
WshShell.SendKeys"name"
WScript.Sleep 1000
WshShell.SendKeys"%s" Dim wshshell
Set wshshell=WScript.CreateObject("wscript.shell")
wshshell.Run "notepad"
WScript.Sleep 500
wshshell.AppActivate "vbs学习"
wshshell.SendKeys "This is the most wonderful day of my life"&Chr(13)&"because I'm here With you now"
WScript.Sleep 2000
wshshell.SendKeys "%FA"
wshshell.SendKeys "d:\obp\aaa"
WScript.Sleep 1000
wshshell.SendKeys "%s"
页:
[1]