Jump to content

Checking for a named window, and wait until it terminates


Recommended Posts

I know this function exists... cause I remember seeing it.. but looking at the function list twice, I missed it both times.

What's the function to check for a window (by name of window), and also conditionally pause the script until the window terminates?

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

This is what you are looking for.

WinWaitClose ( "title" [, "text" [, timeout]] )

which can be found @: Function Reference > Window Management

Edited by Guest
Link to comment
Share on other sites

  • Moderators

Hi, Mechaflash213, I believe you're looking for WinExists. Something like this maybe?

While WinExists("Untitled", "")
MsgBox(0, "", "Yep!")
Sleep(1000)
WEnd

Edit: more than one way to skin a cat. Aipion's works as well :)

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Thanks Aipion and JLogan for the quick reply.

@Aipion would it matter that it's not checking for the window first, and just carrying out the command?

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

  • Moderators

It does do a check, if the window does not exist when it checks, it simply moves on to the next command.

WinWaitClose("Untitled", "")
MsgBox(0, "", "Gone")

If the window does not exist, it will go right to the Message Box. If the window does exist, it will pause until the window is closed.

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

The difference is really in what you want to do. Using a While statement with WinExists, you can do other stuff while you wait for the window to close. With WinWaitClose, however, the script pauses completely until that condition is met.

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

I have a good one for you: how do you check it by the Class of the window?

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

I have a good one for you: how do you check it by the Class of the window?

Why don't you follow the "Title special definition" link in helpfile and find out?
Link to comment
Share on other sites

@Admiral. Sorry, I overlooked the link in the documentation. I'll make sure to be a perfect robot and not make a human mistake, like overlooking a detail, next time.

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

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