Skip to main content
rb.window finds windows by title and acts on them. A script reaches for it to put an app’s window in place, or to wait for a window to open, gain focus or close. On macOS most of these calls raise; see rb.window on macOS. Needs: a coroutine for wait, wait_active and wait_close, so call them inside rb.run or rb.async (see Where code runs). This script waits up to 10 seconds for Notepad, brings it forward, and moves it to 0,0 at 800 by 600:
Window handles are numbers from find, list, get_foreground and from_point. Calls whose handle is optional act on the focused window when it is nil. The wait calls take timeout in milliseconds (default 5000) and check every 50 ms.