Option : I
Function CloseIEExceptALM()
On Error Resume Next
iCurItr = 0
bExit = False
Do
Set objDlg = Dialog("regexpwndtitle:=.*Internet Explorer.*","Index:=" & iCurItr)
If Dialog("regexpwndtitle:=.*Internet Explorer.*","Index:=" & iCurItr).Exist(0) Then
If objDlg.WinButton("text:=Cancel","Index:=0").Exist(0) Then
objDlg.Activate
objDlg.WinButton("text:=Cancel","Index:=0").Click
End If
If objDlg.WinButton("text:=Close","Index:=0").Exist(0) Then
objDlg.Activate
objDlg.WinButton("text:=Close","Index:=0").Click
End If
If objDlg.WinButton("text:=Ok","Index:=0").Exist(0) Then
objDlg.Activate
objDlg.WinButton("text:=Ok","Index:=0").Click
End If
If objDlg.WinButton("text:=Close Program","Index:=0").Exist(0) Then
objDlg.Activate
objDlg.WinButton("text:=Close Program","Index:=0").Click
End If
If Dialog("regexpwndtitle:=.*Security Warning.*","Index:=0").Exist(0) Then
Dialog("regexpwndtitle:=.*Security Warning.*","Index:=0").Activate
If Dialog("regexpwndtitle:=.*Security Warning.*","Index:=0").WinBUtton("text:=&No").Exist(0) Then
Dialog("regexpwndtitle:=.*Security Warning.*","Index:=0").WinBUtton("text:=&No").Click
End If
End If
Wait(0.500)
If objDlg.Exist(0) Then
If objDlg.GetROProperty("Visible") Then
strTitle = Dialog("regexpwndtitle:=.*Internet Explorer.*","Index:=" & iCurItr).GetROProperty("title")
strText = Dialog("regexpwndtitle:=.*Internet Explorer.*","Index:=" & iCurItr).GetROProperty("text")
If InStr(strText, "HP") = 0 Then
If Dialog("regexpwndtitle:=.*Internet Explorer.*","Index:=" & iCurItr).Exist(0) Then
Dialog("regexpwndtitle:=.*Internet Explorer.*","Index:=" & iCurItr).Activate
Dialog("regexpwndtitle:=.*Internet Explorer.*","Index:=" & iCurItr).Close
End If
Wait(0.500)
iCurItr = -1
End If
End If
End If
ElseIf iCurItr> 10 Then
bExit = True
End If
iCurItr = iCurItr + 1
Loop Until iCurItr >= 100 Or bExit
Set objDlg = Nothing
End Function
Option : II
Function CloseIEexceptQC()
Dim oDesc,oChilds,iCnt,i,ihwnd,sName
Set oDesc=Description.Create
oDesc("micclass").Value="Browser"
Set oChilds = Desktop.ChildObjects(oDesc)
iCnt = oChilds.Count
For i = 0 to iCnt -1
sName = oChilds(i).getRoProperty("name")
If instr(1, sName,"Quality Center") = 0 Then
ihwnd = oChilds(i).getRoProperty("hwnd")
SystemUtil.CloseProcessByHwnd(ihwnd)
End If
Next
End Function
Function CloseIEExceptALM()
On Error Resume Next
iCurItr = 0
bExit = False
Do
Set objDlg = Dialog("regexpwndtitle:=.*Internet Explorer.*","Index:=" & iCurItr)
If Dialog("regexpwndtitle:=.*Internet Explorer.*","Index:=" & iCurItr).Exist(0) Then
If objDlg.WinButton("text:=Cancel","Index:=0").Exist(0) Then
objDlg.Activate
objDlg.WinButton("text:=Cancel","Index:=0").Click
End If
If objDlg.WinButton("text:=Close","Index:=0").Exist(0) Then
objDlg.Activate
objDlg.WinButton("text:=Close","Index:=0").Click
End If
If objDlg.WinButton("text:=Ok","Index:=0").Exist(0) Then
objDlg.Activate
objDlg.WinButton("text:=Ok","Index:=0").Click
End If
If objDlg.WinButton("text:=Close Program","Index:=0").Exist(0) Then
objDlg.Activate
objDlg.WinButton("text:=Close Program","Index:=0").Click
End If
If Dialog("regexpwndtitle:=.*Security Warning.*","Index:=0").Exist(0) Then
Dialog("regexpwndtitle:=.*Security Warning.*","Index:=0").Activate
If Dialog("regexpwndtitle:=.*Security Warning.*","Index:=0").WinBUtton("text:=&No").Exist(0) Then
Dialog("regexpwndtitle:=.*Security Warning.*","Index:=0").WinBUtton("text:=&No").Click
End If
End If
Wait(0.500)
If objDlg.Exist(0) Then
If objDlg.GetROProperty("Visible") Then
strTitle = Dialog("regexpwndtitle:=.*Internet Explorer.*","Index:=" & iCurItr).GetROProperty("title")
strText = Dialog("regexpwndtitle:=.*Internet Explorer.*","Index:=" & iCurItr).GetROProperty("text")
If InStr(strText, "HP") = 0 Then
If Dialog("regexpwndtitle:=.*Internet Explorer.*","Index:=" & iCurItr).Exist(0) Then
Dialog("regexpwndtitle:=.*Internet Explorer.*","Index:=" & iCurItr).Activate
Dialog("regexpwndtitle:=.*Internet Explorer.*","Index:=" & iCurItr).Close
End If
Wait(0.500)
iCurItr = -1
End If
End If
End If
ElseIf iCurItr> 10 Then
bExit = True
End If
iCurItr = iCurItr + 1
Loop Until iCurItr >= 100 Or bExit
Set objDlg = Nothing
End Function
Option : II
Function CloseIEexceptQC()
Dim oDesc,oChilds,iCnt,i,ihwnd,sName
Set oDesc=Description.Create
oDesc("micclass").Value="Browser"
Set oChilds = Desktop.ChildObjects(oDesc)
iCnt = oChilds.Count
For i = 0 to iCnt -1
sName = oChilds(i).getRoProperty("name")
If instr(1, sName,"Quality Center") = 0 Then
ihwnd = oChilds(i).getRoProperty("hwnd")
SystemUtil.CloseProcessByHwnd(ihwnd)
End If
Next
End Function
Comments