Sha256: b5a480b7791483bf6e8e29119543c210554f0fa80c6d6a28ac1ae241d933887a

Contents?: true

Size: 734 Bytes

Versions: 1

Compression:

Stored size: 734 Bytes

Contents

# gem install win32-window --pre
require 'win32/window'

title = ARGV[0]
this_file = File.basename(__FILE__)

if ARGV.size.zero?
  STDERR.puts "\n    #{this_file.upcase} <window_title_substring>\n\n"
  STDERR.puts 'Finds full title, pid, and window handle for windows matching'
  STDERR.puts 'the title substring. For titles with spaces, wrap in quotes.'
  exit 1
end

count = 0
Win32::Window.find(title: /#{title}/i).each do |window|
  next if window.title.match(this_file)
  puts if count > 0
  puts "title \"#{window.title}\""
  puts "pid #{window.pid}"
  puts format('appTopLevelWindow 0x%08x', window.handle)
  count += 1
end

if count.zero?
  STDERR.puts "NO WINDOWS FOUND: \"#{title}\""
  exit 1
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rutl-0.8.0 bin/window_data.rb