How to check if a program is running with Ruby?
-
I am pretty sure this can be done. I have done some research but have not found what I am looking for yet.
I just need to know if a given program is running.
Something like this:
if ("indigo.exe").is_running? do something endMaybe it has to be done with a system call...but which call?
-
here is one quick way
require "win32ole" procs = WIN32OLE.connect("winmgmts;\\\\.") all_proc = [] procs.InstancesOf("win32_process").each do |proc| all_proc.push proc.name.to_s.downcase end p all_proc.include?("indigo.exe") -
Thanks, but I get this error message when SketchUp loads:
Error Loading File ProcessTest.rb No such file to load -- win32oleIt would be great if this would work without the need for another file.
-
you need win32ole.so for that example.
... but you still need another file to access process identification (win32ole or win32api)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better đź’—
Register LoginAdvertisement