Micro Focus QTP (UFT) Forums
How to close a Window obj with a "text:="& ReportName - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: How to close a Window obj with a "text:="& ReportName (/Thread-How-to-close-a-Window-obj-with-a-text-ReportName)



How to close a Window obj with a "text:="& ReportName - mv8167 - 02-02-2012

Currently, the code below close all of my objects with micclaasss = window. I need to close a Window obj with a "text:="& ReportName & ".*" only.

How do I add this in?

Code:
Sub CloseWindow (ReportName)

   'CLOSE REPORTNAME BROWSER
        Set oWindow=Description.Create()
        oWindow("micclass").Value="Window"
        Set obj=Desktop.ChildObjects(oWindow)
        For i=0 to obj.Count-1
        obj(i).Close
        Next

End Sub

Do i just add:
oWindow("text").Value=ReportName



RE: How to close a Window obj with a "text:="& ReportName - rajpes - 02-03-2012

Code:
oWindow("text").Value="ReportName.*"



RE: How to close a Window obj with a "text:="& ReportName - mv8167 - 02-03-2012

Rajpes,

thx

Should it not be:
oWindow("text").Value= ReportName & ".*"

ReportName is a dynamic variable.

Either way, this did not close the Window with the ReportName that I had hoped. It closed all of my windows even messing with logging me off. lol


RE: How to close a Window obj with a "text:="& ReportName - rajpes - 02-03-2012

Code:
Set oWindow=Description.Create()
oWindow("micclass").Value="Window"
oWindow("text").Value=ReportName&".*"
Set obj=Desktop.ChildObjects(oWindow)

msgbox obj.count