I am trying to test a window application that the name of window changes depending what the window is saved as. How can I set up regular expression so it can recognize any name. For example the window might be called "Test1" on one window and another one would be called "Bobs Test" or "test12 bob"
any suggestions on how to set up the regular expression so it can recognize anything.
say when you recorded, the window name was "Bobs Test" and now you know that it has changed to a new name and you have the name, then use something like this
Window("Bobs Test").SetTOProperty "title",newTitle
'I am assuming that the property QTP recorded was title. It can be regexpwndtitle also. Just see the OR to make sure.
now second approach is that if you know that the window will always have a specific title when it's first opened and then will change title
say you open notepad and the title always is "Untitled - Notepad" and now you recorded when it was "test.txt - Notepad" then you can got to the OR and remove the title property and then at run-time use the below code
Now hwnd property is one which would be always unique for that session.
And other method would be to use a regular expression which needs a patern like ".*Notepad" in this case which does not seems to be the case in your case. Too many case hanh [img]/images/graemlins/laugh.gif[/img]
The property QTP recorded was regexpwndtitle. It records it as cpuat (Test-qtp (Change_Requ"). But now I want this script to run if the title on the window has changed to cpuat (new-test (Change_Requ"). I thought if I set it as regular expression like cpuat \(.* it would work but it does not. I am kind of new to this if you can help me out I appreciate it.