Is there a way to find out if a program is running on your desktop through a Ruby program? Would it be as simple as using a system call?
process = 'Windows'
if process != #some system call to check the process
puts "Process not found"
Here's a contrived example that uses
tasklist. It assigns the result of the backtick system call to a
status variable. If this variable is empty, then the specified program isn't running.
def find_process status = `tasklist | find "notepad.exe"` if status.empty? puts "Process is not running" else puts "Process is running" end end find_process