Module: Vapir::Process

Defined in:
lib/vapir-ie/process.rb

Class Method Summary collapse

Class Method Details

.count(name) ⇒ Object

Returns the number of windows processes running with the specified name.



7
8
9
10
11
12
# File 'lib/vapir-ie/process.rb', line 7

def self.count name
  mgmt = WIN32OLE.connect('winmgmts:\\\\.')
  processes = mgmt.InstancesOf('win32_process')
  processes.extend Enumerable
  processes.select{|x| x.name == name}.length
end