Close Opened Browsers Except QC

Share this post
FaceBook  Twitter  Mixx.mn     

To close all browser except Quality center, use following code:
Steps:
1) Create a Browser object

2) loop and Check if a browser is open

3) Close the browser if its not Quality center




Code:

Dim TempIndex
'1) Create a Browser object'
Set oDesc=Description.Create
oDesc("micclass").Value="Browser"
TempIndex=0

'2) loop and Check if a browser is open'
While Browser("micclass:=Browser","index:="&TempIndex).exist(0) and TempIndex<Desktop.ChildObjects(oDesc).count
'3) Close the browser if its not Quality center '
        If instr(1, Browser("micclass:=Browser","index:="&TempIndex).getRoProperty("name"),"Quality Center") = 0 Then
        Browser("micclass:=Browser","index:="&TempIndex).close
        else
        TempIndex=TempIndex+1
        End if
Wend