Sign in to follow this  
Followers 0
Rishav

Using regular expressions in command

4 posts in this topic

Hi folks

I have a problem. Every once in a while I get unhandled exceptions in my product. to take care of such errors during automation I want to use a winexist command. the problem is that the text for the error is not constant.

So I need to add in a regular expression towards the end of the command as;

Winexists("","Unhandled excpetion has occured in your application<whatever follows from here>")

Another way is using the

Opt("WinTitleMatchMode", 4)
setting. However, I need to use the setting only for that winexist command and not for the entire script. declaring WinTitleMatchMode before winexists and the resetting it to default feels counterintuitive.

any suggestions?

regards

Rishav

Share this post


Link to post
Share on other sites



Well, AutoIt will match the title of the window from the beggining by default. This means that if you use:

GUICreate("Unhandled excpetion has occured in your application Error:4564654")
GUISetState()

If Winexists("Unhandled excpetion has occured in your application") Then MsgBox(0,"","The window exists")

It'll work just fine.

But if you still want to use Regular Expressions, take a look at Advanced Window Descriptions in the help file. Here's an example:

GUICreate("Unhandled excpetion has occured in your application Error:4564654")
GUISetState()

If Winexists("[REGEXPTITLE:Unhandled excpetion has occured in your application(.*?)]") Then MsgBox(0,"","The window exists")

^This isn't really a good example on regular expressions, but you get the point.

Share this post


Link to post
Share on other sites

Well, AutoIt will match the title of the window from the beggining by default.

That was mean. o.0

now I'll go and sob in a corner for asking such a retarded question. :D

ps. Thank you.

Share this post


Link to post
Share on other sites

That was mean. o.0

now I'll go and sob in a corner for asking such a retarded question. :o

ps. Thank you.

It gets worse. Setting WinTitleMatchMode = 4 is a legacy behavior, and those advanced strings work by default in the current version.

On the positive side, you have a loooooong way to go before you ask as many retarded questions as I have!

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0