• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

How to check if a program is running with Ruby?

Scheduled Pinned Locked Moved Developers' Forum
4 Posts 2 Posters 2.0k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    Whaat
    last edited by 8 Dec 2007, 06:48

    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
    
    end
    

    Maybe it has to be done with a system call...but which call?

    SketchUp Plugins for Professionals

    1 Reply Last reply Reply Quote 0
    • T Offline
      tbd
      last edited by 8 Dec 2007, 06:49

      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")
      

      SketchUp Ruby Consultant | Podium 1.x developer
      http://plugins.ro

      1 Reply Last reply Reply Quote 0
      • W Offline
        Whaat
        last edited by 8 Dec 2007, 06:49

        Thanks, but I get this error message when SketchUp loads:

        Error Loading File ProcessTest.rb
        No such file to load -- win32ole
        

        It would be great if this would work without the need for another file.

        SketchUp Plugins for Professionals

        1 Reply Last reply Reply Quote 0
        • T Offline
          tbd
          last edited by 8 Dec 2007, 06:50

          you need win32ole.so for that example.
          ... but you still need another file to access process identification (win32ole or win32api)

          SketchUp Ruby Consultant | Podium 1.x developer
          http://plugins.ro

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          1 / 1
          • First post
            1/4
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement