Sunday, April 17, 2011

script close all browsers

 'Suppose there are 10 browser ;;; write script to close all the browsers  ''The below script will close all the open browser

dim d
set d=Description.Create
d("micclass").value="Browser"
set a=Desktop.ChildObjects(d)
for i=0 to a.count-1
   a(i).close
Next


There are 10 browsers and in that 1 browser is mercury tours website.... except mercury tours browser all the other browsers should be closed Get all the browsers and for each browser get the title in the title if "mercury" word is not there then close

dim d
set d=Description.Create
d("micclass").value="Browser"
set a=Desktop.ChildObjects(d)
for i=0 to a.count-1
   s=a(i).getROProperty("title")
   if instr(1,s,"Mercury")=0 Then
     a(i).close
   End if
Next

1 comment:

  1. Anonymous7/2/12

    Great! Very helpful, thanks.
    The only adjustment I had to make to make this work with Quality Center was:

    dim d
    set d=Description.Create
    d("micclass").value="Browser"
    set a=Desktop.ChildObjects(d)
    for i=0 to a.count-2
    s=a(i).getROProperty("title")
    if instr(1,s,"Quality Center")=0 Then
    a(i).close
    End if
    Next

    ReplyDelete