Micro Focus QTP (UFT) Forums
Regular Expression on opening and using a PDF file - 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 on opening and using a PDF file (/Thread-Regular-Expression-on-opening-and-using-a-PDF-file)



Regular Expression on opening and using a PDF file - mv8167 - 05-11-2011

How can I change my script using RegEx to ignore these _1, _2 … etc and [1], [2]…etc?

Please see my attachment for a visual example.

The "ALL IMAGED CLIENT DOCUMENTS" is in my OR. But now my web page shows ALL IMAGED CLIENT DOCUMENTS[1].zip and the pdf file show ALL IMAGED CLIENT DOCUMENTS_1.pdf. If I continue, both will jump to [2] and _2 respectfully.

I am not sure if I add

Code:
Window("ALL IMAGED CLIENT DOCUMENTS/_[0-9]").Activate
and
Window("ALL IMAGED CLIENT DOCUMENTS").WinListView("SysListView32").Select "ALL IMAGED CLIENT DOCUMENTS/_[0-9]/.pdf"


current code:
Code:
Window("ALL IMAGED CLIENT DOCUMENTS").Activate
Window("ALL IMAGED CLIENT DOCUMENTS").WinListView("SysListView32").Select "ALL IMAGED CLIENT DOCUMENTS_1.pdf"
Window("ALL IMAGED CLIENT DOCUMENTS").WinToolbar("ToolbarWindow32_3").Press "&File"
Window("ALL IMAGED CLIENT DOCUMENTS").WinMenu("ContextMenu").Select "Open"
Window("ALL IMAGED CLIENT DOCUMENTS").Activate
Window("ALL IMAGED CLIENT DOCUMENTS").HighLight(0)

I have been reading up on RegEx (https://www.learnqtp.com/regular-expressions-regularized/) but I have found myself even more confused. lol


RE: Regular Expression on opening and using a PDF file - jsknight1969 - 05-17-2011

ALL IMAGED CLIENT DOCUMENTS((\[[0-9]+\])|(_[0-9]+)).(pdf|zip)

Change the OR windows text to use this Expression. Hopefully that will solve your issue or at least lead you in the right direction.


RE: Regular Expression on opening and using a PDF file - mv8167 - 05-20-2011

Thank you so much. I will try this asap. Presently, I am using Window("regexpwndtitle:=ALL IMAGED CLIENT DOCUMENTS.*") but your code will help in another situation.

wonderfull