QTP关闭除了ALM/QC以外的所有IE窗口

来源:互联网 发布:Linux telnet拒绝 编辑:程序博客网 时间:2024/05/21 19:06

1:

function Close_IE_Except_ALM

Set obj = CreateObject("Shell.Application")

Set obj1 = obj.Windows
For Each objIE in obj1
 If  objIE.name = "Windows Internet Explorer" Then
  If Not Instr(Ucase(objIE.Document.Title),"HP QUALITY CENTER")>0 Then
   objIE.Quit
   wait(1)
   If  Dialog("nativeclass:= #32770").WinButton("text:=OK").Exist Then
     Dialog("nativeclass:= #32770").WinButton("text:=OK").Click
   End If      
  End If
 End If

next

end function 


2:

function Close_IE_Except_ALM
Dim WinIe,Ie,i
Set WinIe=description.Create()
WinIe("regexpwndtitle").value=" Windows Internet Explorer"   
Set Ie=desktop.ChildObjects(WinIe)
For i=0 to Ie.count-1
On error resume next
if not instr(Ucase(Ie(i).getroproperty("Title")),"HP APPLICATION LIFECYCLE")>0 then
Ie(i).close
end if  
On error goto 0
Next
set WinIe = nothing
end function