Micro Focus QTP (UFT) Forums
Dynamic Window Name and Windows application - 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: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Dynamic Window Name and Windows application (/Thread-Dynamic-Window-Name-and-Windows-application)



Dynamic Window Name and Windows application - GSKQA - 06-18-2009

Hi All...
Iam new to QTP and this is my first recorded code .
After recording and modifying the code little bit .I modified the code littlebit bcas the window names changes for every run.
Please help me...thx

Satya

The Actual Recorded Code is :
Code:
Window("SLIM - [Study '10-P-746' Event Log]").WinMenu("Menu").Select "File;Print...    Ctrl+P"


the Modified code is
Code:
Var = Window("ForeGround:=True").GetROProperty("regexpwndtitle")
Set oWindow = Description.Create()
oWindow("regexpwndtitle").Value =Var
msgbox Var

Window("regexpwndtitle:="& Var).WinMenu("Menu").Select "File;Print...    Ctrl+P"


The Error iam getting is:::::::::::>
The "Menu" object was not found in the Object Repository.
Check the Object Repository to confirm that the object exists or to find the correct name for the object.

Line (49):
Code:
"Window("regexpwndtitle:="& Var).WinMenu("Menu").Select "File;Print...    Ctrl+P"".



RE: Dynamic Window Name and Windows application - ursvinod - 06-18-2009

Hi
Use regular expression
Code:
Window("regexpwndtitle:= SLIM.*").WinMenu("Menu").Select "File;Print...    Ctrl+P"

I dont understand why you are using the property "ForeGround" to get the regexpwndtitle of the window... instead try this

Code:
Window("ForeGround:=True").WinMenu("Menu").Select "File;Print...    Ctrl+P"

Let me know is the above code works..

-Vinod