Jump to content

Recommended Posts

Posted (edited)

Okay, what the hell. My post keeps getting all garbled when I edit it. Forget it. It was a bad idea anyway.

(I suggested WinExists, but that won't wait for it. Perhaps you could just use WinWait with the timeout parameter)

Also, if the names are similar in nature, you could try matching them in a different way. For example, if you were matching AIM windows, they all say "Instant Message" in them, so you could do partial substring matches with wintitlematchmode.

Edited by Nevin
Posted

Something like:

Opt("WinTitleMatchMode", 4)

WinWait("[REGEXPTITLE:.?(Notepad|Calculator).?]")

MsgBox(0,"","One of the specified windows opened")

This should match *Notepad* or *Calculator*, if you need it to match the exact title, take off the .? from both sides.

Posted

Something like:

Opt("WinTitleMatchMode", 4)

WinWait("[REGEXPTITLE:.?(Notepad|Calculator).?]")

MsgBox(0,"","One of the specified windows opened")

This should match *Notepad* or *Calculator*, if you need it to match the exact title, take off the .? from both sides.

Can i use wildcard, here section of the script

WinWait,NR2003

WinSetTitle,NR2003, ,NRrs%numrs%

WinMinimize,NR2003rs%numrs%

Could this work

WinWait,NR*

WinSetTitle,NR*, ,NRrs%numrs%

WinMinimize,NR*rs%numrs%

My issue is that the window could be NR2003 or NR"something else"

Posted

The example I provided is using a wildcard on both sides of the string

This should match *Notepad* or *Calculator*, if you need it to match the exact title, take off the .? from both sides.

Posted

Can i use wildcard, here section of the script

WinWait,NR2003

WinSetTitle,NR2003, ,NRrs%numrs%

WinMinimize,NR2003rs%numrs%

Could this work

WinWait,NR*

WinSetTitle,NR*, ,NRrs%numrs%

WinMinimize,NR*rs%numrs%

My issue is that the window could be NR2003 or NR"something else"

Sorry but i'll need more explanation to understand your exemple, Do i need Opt and MsgBox in my exemple? What is REGEXPTITLE?

is ? the wildcard? if so will replacing * with ? in my exemple work?

Posted

You need the Opt("WinTitleMatchMode", 4) to get the put title matching into advanced mode for the regular expression.

REGEXPTITLE will match whatever is in the regular expression. My example would be the same as *Notepad* or *Calculator*

You can't replace .? with *

That isn't how regular expressions work.

See:

http://www.autoitscript.com/autoit3/docs/f...tringRegExp.htm

http://en.wikipedia.org/wiki/Regular_expression

http://www.regular-expressions.info/

Posted

Can i use wildcard, here section of the script

WinWait,NR2003

WinSetTitle,NR2003, ,NRrs%numrs%

WinMinimize,NR2003rs%numrs%

Could this work

WinWait,NR*

WinSetTitle,NR*, ,NRrs%numrs%

WinMinimize,NR*rs%numrs%

My issue is that the window could be NR2003 or NR"something else"

That is AutoIt2 syntax. This is a AutoIt3 forum btw. AutoIt3 is the latest and greatest. Please visit the AutoIt3 download page for AutoIt3 if you are interested. AutoIt3 is what weaponx is preaching about.

Also look within the AutoIt3 help file at the topic "AutoIt" -> "Using AutoIt" -> "Window Titles and Text (Advanced)".

You can consider using AdlibEnable() for the 2nd window if it is unpredictable for appearance.

:)

Posted

...I have a script i've done a few years back...

Like MHz said, you should consider moving up to AutoIt3. If you do not want to convert to AutoIt3, you can post your request for help in this forum:

http://www.autoitscript.com/forum/index.php?showforum=5

(...but you already knew that - since you have a topic and a reply in that forum already :-)

http://www.autoitscript.com/forum/index.php?showtopic=6101

[some admin might want to move this post to the V2 forum.]

Either way, enjoy AutoIt2 or AutoIt3.

[size="1"][font="Arial"].[u].[/u][/font][/size]

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...