Created
October 22, 2018 19:08
-
-
Save tspangler/bc59dab8b1e0a95f9a349761a93bca00 to your computer and use it in GitHub Desktop.
Look for a window and maximize it when found
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# `gem install win32-window` first | |
require 'win32/window' | |
puts "Searching for Notepad window..." | |
window = nil | |
loop do | |
window = Window.find(title: /Notepad/) | |
break unless window.empty? | |
end | |
window = window.first | |
puts "Found Notepad window with hwnd #{window.handle}. Maximizing..." | |
window.maximize | |
puts "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment