Search This Blog

Monday, November 22, 2010

Functionality: Is to CLOSE Browser/PDFChildWindow'Parameters: ANY Property - title OR openurl OR name'

'Purpose: Is to CLOSE Browser/PDFChildWindow'Parameters: ANY Property - title OR openurl OR name'______________________________________________________

Function Close_ANY_Browser (optsBrwName)

Set BrwDesc = Description.Create()

BrwDesc("micclass").Value = "Browser"

rcBrwCount = fGetBrowsersCount()-1

UnKnown_hwnd=Browser("CreationTime:="& rcBrwCount).GetROProperty("hwnd")

Get_title= Window("hwnd:="& UnKnown_hwnd).GetROProperty("title")

Get_name = Window("hwnd:="& UnKnown_hwnd).GetRoProperty("name")

Get_openurl = Window("hwnd:="& UnKnown_hwnd).GetRoProperty("openurl")
If Get_title = "" AND Get_name = "" Then

SetProperty = "openurl"

Else

SetProperty = "title" End If
BrwDesc(SetProperty).Value = optsBrwName
If Get_title ="" AND Get_name = "" AND Get_openurl="" Then

Reporter.ReportEvent micFail,"DID NOT Get Property Values for an opened Child Window - Properties name/openurl/title were NOT assigned to the ChildWindow ","Choose another property to Perform Action - CLOSE on opened Child Window"
Else

Reporter.ReportEvent micPass,"Recognized the Child Window/Browser by using the property '" & SetProperty & "' ","Performs an Action CLOSE on opened Child Window"
SetProperty1=SetProperty & ":=" & optsBrwName

Browser(SetProperty1).Close

If NOT Browser(SetProperty1).Exist(0) Then

Close_ANY_Browser = True

End If
Set BrwDesc = Nothing

End If
End Function

-----------------------------------------

Function fGetBrowsersCount()

Set ObjIExpl = Description.Create

ObjIExpl("micclass").value = "Browser"

Set ObjIExplColl = Desktop.ChildObjects(ObjIExpl)

fGetBrowsersCount = ObjIExplColl.Count

End Function

----------------------------------------------------------

No comments:

Post a Comment