sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    FredoBend | Powerful new bending tool for SketchUp Download

    How to check if a program is running with Ruby?

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 2 Posters 2.1k Views 2 Watching
    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

      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
      • tbdT Offline
        tbd
        last edited by

        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

          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
          • tbdT Offline
            tbd
            last edited by

            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

            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 Login
            • 1 / 1
            • First post
              Last post
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement