Sign in to follow this  
Followers 0
Chetwood

WinWait for two windows with 'or'?

11 posts in this topic

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

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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=...


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites

well why not throw mine in there too.

While 1
    If winexists("window1") or winexists("My other app") Then ExitLoop
sleep(10)   
Wend

MsgBox(1,"info","started")

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
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

Share this post


Link to post
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]

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

k thx


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]

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