51Testing软件测试论坛

标题: 让脚本在输入短句后自动关闭记事本,并保存文件名为“test” [打印本页]

作者: feifei956998    时间: 2009-11-30 12:44
标题: 让脚本在输入短句后自动关闭记事本,并保存文件名为“test”
Dim WshShell
Set WshShell=WScript.CreateObject("Wscript.Shell")
WshShell.Run"notepad"
WScript.Sleep 2000
WshShell.AppActivate"无标题-记事本"
WshShell.SendKeys"hahahahahaha"
WshShell.SendKeys"%{F4}"
WshShell.SendKeys"s"

然后怎么保存文件名为“test”?
作者: hsjzfling    时间: 2009-11-30 12:59
为什么不用fso来做这件事情
作者: shanxi    时间: 2009-11-30 13:06
Ctrl + S
Send key filepath+name
Ctrl + S

请毋庸于界面自动化  这种做法完全错误。
作者: dftx511619    时间: 2009-11-30 13:36
原帖由 feifei956998 于 2009-11-30 12:44 发表
Dim WshShell
Set WshShell=WScript.CreateObject("Wscript.Shell")
WshShell.Run"notepad"
WScript.Sleep 2000
WshShell.AppActivate"无标题-记事本"
WshShell.SendKeys"hahahahahaha"
WshShell.SendKeys"%{F ...



看到你的名字下面有个“51testing测试培训就业人员”, 培训完后, 连这个问题都解决不了!

我真的为 51testing 培训感到无语了!
作者: feifei956998    时间: 2009-11-30 13:46
原帖由 dftx511619 于 2009-11-30 13:36 发表



看到你的名字下面有个“51testing测试培训就业人员”, 培训完后, 连这个问题都解决不了!

我真的为 51testing 培训感到无语了!

  因为我工作得比较早,没学到这个呢。
不懂就问一下应该没错的吧?
作者: nimcok    时间: 2009-11-30 14:22
fso处理好些吧
作者: dftx511619    时间: 2009-11-30 17:52
原帖由 nimcok 于 2009-11-30 14:22 发表
fso处理好些吧



这位兄弟正解!  用FSO对象来处理最简单!
作者: gaoshijie    时间: 2010-6-4 16:35
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"
作者: ssane1989    时间: 2010-12-29 20:42
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"




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2