用vbs截屏,但总是报错,请高手指导一下,谢谢啦
我把以下代码写到vbs文档里执行,但报Desktop不是对象的错误,具体是啥原因呢?Dim FileName ,TimeNow, ResPath
ResPath = "C:\Documents and Settings\XP\Desktop\Test Delete"
fileName = ResPath & "" & Now & ".bmp"
Desktop.CaptureBitmap filename,True
Desktop这个object 怎么去创建呢? 文件名中不能有冒号吧 ResPath是存储的位置 ResPath = "C:\Documents and Settings\XP\Desktop\Test Delete"
是存储的位置, ResPath = "C:\Documents and Settings\XP\Desktop\Test Delete"
是图片存储的位置啊 Desktop是QTP对象,需要在QTP中执行。 果真是的,谢谢4楼的回复,不过有没有办法直接可以在vbs文件中执行的截图方法呢? vbs隐藏调用qtp呢? Class JieTu
Function RecoveryFunction1(Object, Method, Arguments, retVal)
Dim FileName ,TimeNow, ResPath
ResPath = "E:/TestsResult/"
TimeNow = DotNetFactory.CreateInstance( "System.DateTime" ).Now.ToString( "ddMMyyHHmmss" )
TestNameNow=environment.Value("TestName")
FileName = ResPath & ""&TestNameNow & TimeNow & ".bmp"
desktop.CaptureBitmapfilename,True
systemutil.closedescendentprocesses
End Function
End Class
我想你应该是想做场景恢复然后截图的。。这是截图代码亲测可用 Class JieTu
Function RecoveryFunction1(Object, Method, Arguments, retVal)
Dim FileName ,TimeNow, ResPath
ResPath = "E:/TestsResult/"
TimeNow = DotNetFactory.CreateInstance( "System.DateTime" ).Now.ToString( "ddMMyyHHmmss" )
TestNameNow=environment.Value("TestName")
FileName = ResPath & ""&TestNameNow & TimeNow & ".bmp"
desktop.CaptureBitmapfilename,True
systemutil.closedescendentprocesses
End Function
End Class
我想你应该是想做场景恢复然后截图的。。这是截图代码亲测可用 Class JieTu
Function RecoveryFunction1(Object, Method, Arguments, retVal)
Dim FileName ,TimeNow, ResPath
ResPath = "E:/TestsResult/"
TimeNow = DotNetFactory.CreateInstance( "System.DateTime" ).Now.ToString( "ddMMyyHHmmss" )
TestNameNow=environment.Value("TestName")
FileName = ResPath & ""&TestNameNow & TimeNow & ".bmp"
desktop.CaptureBitmapfilename,True
systemutil.closedescendentprocesses
End Function
End Class
我想你应该是想做场景恢复然后截图的。。这是截图代码亲测可用 回复 9# SilenceHost
Class JieTu
Function RecoveryFunction1(Object, Method, Arguments, retVal)
Dim FileName ,TimeNow, ResPath
ResPath = "E:/TestsResult/"
TimeNow = DotNetFactory.CreateInstance( "System.DateTime" ).Now.ToString( "ddMMyyHHmmss" )
TestNameNow=environment.Value("TestName")
FileName = ResPath & ""&TestNameNow & TimeNow & ".bmp"
desktop.CaptureBitmapfilename,True
systemutil.closedescendentprocesses
End Function
End Class
我想你应该是想做场景恢复然后截图的。。这是截图代码亲测可用
页:
[1]