Micro Focus QTP (UFT) Forums
regular expression for window title - 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 Regular Expressions (https://www.learnqtp.com/forums/Forum-UFT-QTP-Regular-Expressions)
+--- Thread: regular expression for window title (/Thread-regular-expression-for-window-title)

Pages: 1 2


regular expression for window title - test71 - 02-25-2008

Hi,
I need to use regular expression for the starting string only in the window title name as it varies everytime.I am opening a video clip & its title varies everytime as I am opening different videos each time.For this,I have first parameterized the video name using DDT so that I can open several video files in one script itself.
But after executing the sciprt once,I need to close the video window & then re execute the script with 2nd video in the data table.For this I am requiring correct the regular exp.
i've tried various combinations but its failing everytime.
the string is as follows:
eg:abcd (Original Stream) ->For the first video
defg (Original Stream) ->For the 2nd video
i.e. the first string varies everytime & 2nd string remains same.There is a space between two strings which doesn't vary.
Can anyone plz tell me what expression I can use in order to execute my script?


RE: regular expression for window title - lskmuni2000 - 02-25-2008

This might work for you

*.(Original Stream)


RE: regular expression for window title - test71 - 03-05-2008

tried above expression,but its failing. Sad


RE: regular expression for window title - Rajashekar Gouda - 03-05-2008

test71,

can you give some properties your using before"abcd (Original Stream) ->For the first video
defg (Original Stream) ->For the 2nd video "

I am testing web application and on the same page i have lot of drop downs. To work find i have written the DP as

Code:
If QOALogin.Webtable("innertext:=SHIP to Location:.*").WebList("name:=.*").GetROProperty("disabled")=0 Then
   QOALogin.Webtable("innertext:=SHIP to Location:.*").WebList("name:=.*").Select 1
  End If
Wait(3)  
If QOALogin.Webtable("innertext:=SHIP to Contact:.*",index0).WebList("name:=.*").GetROProperty("disabled")=0 Then  
   QOALogin.Webtable("innertext:=SHIP to Contact:.*",index0).WebList("name:=.*").Select 1
  End If    
  Wait(3)

Please use webtable(if u get webtable when you spy) and then regular expression.

Please let me know your result
Regards
Raj


RE: regular expression for window title - test71 - 03-05-2008

raj,
I didn't get you...
You've written "can you give some properties your using before"abcd (Original Stream) ->For the first video ,defg (Original Stream) ->For the 2nd video "
What do you mean by this? And which webtable are you asking me to use?I am not working on a web application.Its a standalone application in VC++.
I have created a data table using DDT to input the video names in the table.Now when one video is opened,script is run on that & that video is closed2nd video from the data table is taken,but when it comes to close this clip,script fails,because the statement contains name of the previous video clip.Thats why I need to use regular expression for this video clip name,so that the script will not fail.


RE: regular expression for window title - Rajashekar Gouda - 03-05-2008

test71,

what i was suggesting you is when you spy on the object you will get some hierarchy right. pls use the unique property.

The example i have given is for web application. in web application if you use spy the u will get the hierarchy as
Code:
Browser().Page().WebTable().WebList()
so if the Weblist is same then you can put some unique property in WebTable. Then you can just use the regular expression for the object like "weblist"

Regards
Raj


RE: regular expression for window title - test71 - 03-06-2008

Raj,
when I spy on the window title, I am getting a hierarchy as
Code:
Window("abcd").Window("avenue (Original Stream)")
After this what should I do?I want to use reg expression for avenue (Original Stream),where only 'avenue' text will vary evertime I open new video window.
Can you please suggest me exact expression that I can use for this?

Thanks.


RE: regular expression for window title - Rajashekar Gouda - 03-06-2008

I have two questions here
Is Window("abcd") same for both videos?
First video name is "avenue (Original Stream)" what is the name of second video name.pls give the exact name dont give as "abcd". And you have mentioned Window("avenue (Original Stream)"). is there two brackets?

Finally try this
Code:
Window("abcd").Window(".*(Original Stream)")

Let me know your results

Regards
Raj


RE: regular expression for window title - test71 - 03-07-2008

Following is an abstract from my script:
Code:
Window("Video State").WinMenu("Menu").Select "File;Open Clip...    Ctrl+O"
Window("Video State").Dialog("Open Video Clip").WinComboBox("Look in:").Select "Desktop"
Window("Video State").Dialog("Open Video Clip").WinListView("Look in:").Select "Video_clips"
Window("Video State").Dialog("Open Video Clip").WinButton("Open").Click
Window("Video State").Dialog("Open Video Clip").WinListView("Look in:").Select "movingcamVS"
Window("Video State").Dialog("Open Video Clip").WinButton("Open").Click
Window("Video State").Dialog("Open Video Clip").WinListView("Look in:").Select DataTable("Video_clip_name", dtGlobalSheet)
Window("Video State").Dialog("Open Video Clip").WinButton("Open").Click
Window("Video State").WinMenu("Menu").Select "Video;Repeat For Ever"
Window("Video State").Window("avenue (Original Stream)").Activate
Window("Video State").Window("avenue (Original Stream)").Close

In the last 2 statements I want to use reg exp for avenue (Original Stream).This will be the window title displayed for the video opened.Now in this,only 'avenue' will change for every video,(Original Stream) text will remain as it is.
I have created a data table with colmun name 'video_clip_name' in which I am giving the video clip names,so that QTP can open the videos one by one.
I have tried Window("abcd").Window(".*(Original Stream)")
But this doesn't work.Also tried to use reg exp in OR itself, with .*,but it gives error 'Cannot identify the object "avenue (Original Stream)" (of class window).Verify that this object's properties match an object currently displayed in your application.'
I am not getting what's wrong.. Sad

Thanks


RE: regular expression for window title - Ankur - 03-11-2008

test71: In OR change it to .* (Original Stream)

Also don't forget to tick the use regular expression check box while changing the above value.