How to close all browsers by descriptive method?
To close a Browser with descriptive object, the below code could be used,
Dim oDesc, x
Set oDesc = Description.Create 'Create a description object
oDesc( "micclass" ).Value = "Browser"
'Loop through the collection and close each browser
If Desktop.ChildObjects(oDesc).Count > 0 Then
For x = Desktop.ChildObjects(oDesc).Count - 1 To 0 Step -1
Browser( "creationtime:=" & x ).Close
Next
End If
To close all browsers except Quality Center,
Dim oDesc, x
Set oDesc = Description.Create 'Create a description object
oDesc( "micclass" ).Value = "Browser"
'Close all browsers except Quality Center
If Desktop.ChildObjects(oDesc).Count > 0 Then
For x = Desktop.ChildObjects(oDesc).Count - 1 To 0 Step -1
If InStr(1, Browser("creationtime:="&x).GetROProperty("name"), "Quality Center") = 0 Then
Browser( "creationtime:=" & x ).Close End If
Next
End If
To close all desktop objects,
Set odesktop =Description.Create()
odesktop("micclass").value="Browser"
Set ochild=desktop.ChildObjects(odesktop)
For i=0 to ochild.Count-1
msgbox ochild(i).getRoproperty("title")
ochild(i).Close
Next
Dim oDesc, x
Set oDesc = Description.Create 'Create a description object
oDesc( "micclass" ).Value = "Browser"
'Loop through the collection and close each browser
If Desktop.ChildObjects(oDesc).Count > 0 Then
For x = Desktop.ChildObjects(oDesc).Count - 1 To 0 Step -1
Browser( "creationtime:=" & x ).Close
Next
End If
To close all browsers except Quality Center,
Dim oDesc, x
Set oDesc = Description.Create 'Create a description object
oDesc( "micclass" ).Value = "Browser"
'Close all browsers except Quality Center
If Desktop.ChildObjects(oDesc).Count > 0 Then
For x = Desktop.ChildObjects(oDesc).Count - 1 To 0 Step -1
If InStr(1, Browser("creationtime:="&x).GetROProperty("name"), "Quality Center") = 0 Then
Browser( "creationtime:=" & x ).Close End If
Next
End If
To close all desktop objects,
Set odesktop =Description.Create()
odesktop("micclass").value="Browser"
Set ochild=desktop.ChildObjects(odesktop)
For i=0 to ochild.Count-1
msgbox ochild(i).getRoproperty("title")
ochild(i).Close
Next
Comments
Post a Comment