Jump to content

WinWait for two windows with 'or'?


 Share

Recommended Posts

Seems simple but I don't know how to make it happen. I wanna start my script if either of two certain windows is popping up. Whichever window is first is irrelevant, as soon as one of those two is there I wanna start. How do I script this with WinWait? TIA!

WinWait (( "window1") or ("window2"))

MultiMakeMKV: batch processing for MakeMKV (Win)MultiShrink: batch processing for DVD ShrinkOffizieller Übersetzer von DVD Shrink deutsch
Link to comment
Share on other sites

Do
   Sleep(25)
Until WinExists("window1") OR WinExists("window2")

<{POST_SNAPBACK}>

Nice idea, however, WinExists seems to require a full title match. Problem is that the two windows I'm checking are

x% Analysing

x% Encoding

whereas 'x' is the percentage of how much is already done which is changing constantly. Depending on the speed of the machine and the material to be encoded the percentage shown may jump in unpredictable steps like 2%, 4%, 5%, 6% and may thus elude the poll interval on some fast machines.

On my slow machine I'm polling every 250 ms for '0%' and it works even though the first percentage I get to see is '2%'. Just to be on the safe side, is there any way to wait for a partial match of the tile window?

MultiMakeMKV: batch processing for MakeMKV (Win)MultiShrink: batch processing for DVD ShrinkOffizieller Übersetzer von DVD Shrink deutsch
Link to comment
Share on other sites

  • Developers

Nice idea, however, WinExists seems to require a full title match. Problem is that the two windows I'm checking are

x% Analysing

x% Encoding

whereas 'x'  is the percentage of how much is already done which is changing constantly. Depending on the speed of the machine and the material to be encoded the percentage shown may jump in unpredictable steps like 2%, 4%, 5%, 6% and may thus elude the poll interval on some fast machines.

On my slow machine I'm polling every 250 ms for '0%' and it works even though the first percentage I get to see is '2%'. Just to be on the safe side, is there any way to wait for a partial match of the tile window?

<{POST_SNAPBACK}>

ChecK out the following in the helpfile:

Opt("WinTitleMatchMode", 1)    ;1=start, 2=subStr, 3=exact, 4=...

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Did you try the following?

Do
   Sleep(25)
Until WinWait('yourwindow') or WinWait('yourwindow')

That shouldnt need the full title...

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Thanks to your suggestions (and Scite for Autoit) I've used this approach:

Opt("WinTitleMatchMode", 2)
Do
  Sleep(250)
Until WinExists("% Encoding") OR WinExists("% Analysing")

which works just fine. However, is there really no way to check a parent window's contents similar to 'WinSearchChildren'? Both windows I'm checking for are child windows to the window 'Backup DVD' which has some info that I'd need...

MultiMakeMKV: batch processing for MakeMKV (Win)MultiShrink: batch processing for DVD ShrinkOffizieller Übersetzer von DVD Shrink deutsch
Link to comment
Share on other sites

Question:

If you did something like this

Do

Sleep(10000)

Until WinExists("MyWin")

and the window was created at the very beginning of the 10 seconds inside the loop. Would it sleep for 10 seconds before exiting the loop?

My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
Link to comment
Share on other sites

Question:

If you did something like this

Do

Sleep(10000)

Until WinExists("MyWin")

and the window was created at the very beginning of the 10 seconds inside the loop. Would it sleep for 10 seconds before exiting the loop?

<{POST_SNAPBACK}>

It would sleep for 10 seconds before checking if the window exists, that is what the code says.

*** Matt @ MPCS

Link to comment
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
 Share

  • Recently Browsing   0 members

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