Code

require ‘rubygems’

require ‘win32ole’

 

def window_name_opened(name)

w=WIN32OLE.new(‘WScript.Shell’)

output=w. AppActivate(name)

puts output

end

window_name_opened(‘notepad’)

#=> false

 

Step 2 –> Now open one note pad and run the ruby program again it should returns TRUE

 

Leave a Reply