emendelson Posted August 23, 2023 Share Posted August 23, 2023 (edited) 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 August 23, 2023 by emendelson Link to comment Share on other sites More sharing options...
Andreik Posted August 23, 2023 Share Posted August 23, 2023 (edited) 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 August 23, 2023 by Andreik emendelson 1 When the words fail... music speaks. Link to comment Share on other sites More sharing options...
emendelson Posted August 23, 2023 Author Share Posted August 23, 2023 @Andreik That works perfectly. Thank you. Link to comment Share on other sites More sharing options...
Solution Nine Posted August 23, 2023 Solution Share Posted August 23, 2023 You can also do it in a single line : WinWait("[TITLE:window title here;W:1024;H:768]", "", 30) ; timeout of 30 secs Andreik and emendelson 2 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Andreik Posted August 23, 2023 Share Posted August 23, 2023 Totally forgot about title special definitions. Nicely done. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
emendelson Posted August 23, 2023 Author Share Posted August 23, 2023 @Nine - Yes, VERY nice. Thank you... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now