Ruby

Ruby – Identifying opened applications in windows machine

 

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

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s