Jump to content

Wait until a window is a specified size?


Go to solution Solved by Nine,

Recommended Posts

I'm writing a script that uses DOSBox-X to run Windows 98 in a DOSBox-X window, and I want to be able to send a key to the Windows 98 desktop when it opens. If I use WinWait to wait until the DOSBox-X window opens, it detects the window while the Windows 98 system is still starting up. After the Windows 98 system starts up, the window size increases from 640x480 to 1024x768, and that is when I want to send a keystroke. Is it possible to wait until a window is a specified size? Or is there some other way to accomplish this?

Thanks for any help.

EDIT: I think the way to do this may be to repeat WinGetPos until the width and height match what I'm looking for, but if there's a more efficient way, I'll be grateful to know about it.

Edited by emendelson
Link to comment
Share on other sites

It would be fairly simple:

Local $hWin = WinGetHandle('Title of your window')
Local $aPos
Local $iWidth = 1024
Local $iHeight = 768

Do
    $aPos = WinGetPos($hWin)
    Sleep(10)
Until $aPos[2] = $iWidth And $aPos[3] = $iHeight

; Do your other stuff
; Send your keystroke

 

Edited by Andreik

When the words fail... music speaks.

Link to comment
Share on other sites

  • Solution

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