do while true
set wshshell = wscript.createobject("wscript.shell")
if wshshell.appactivate("d:\") then
msgbox "ok"
wscript.quit
end if
loop
试都不要试,就知道这段代码是错误的。因为wshshell.appactivate考虑的是窗体的caption中包含的字符或字符串,你用wshshell.appactivate("d:\")这个,就是说窗体caption里要包含"d:\"这个字符串。可你打开d盘看看,是这样的吗?都是“本地磁盘(d:)”。如果有卷标,那更说不准。所以应该写成wshshell.appactivate("(d:)"),考虑到内存节约的问题,应该这样写:
set wshshell = wscript.createobject("wscript.shell")
do
if wshshell.appactivate("(d:)") then
msgbox "ok"
wscript.quit
end if
loop
如对本文有疑问,
点击进行留言回复!!
相关文章:
-
-
-
-
-
-
用vbs实现文本循环读取
因为测试中需要读取一批url数据进行浏览,其实使用qtp本身的table能实现多种读取方式,但是因为需要tabel是使用excel保存的,在没有...
[阅读全文]
-
-
-
-
-
网友评论