Windows - window status (Running vs Not Responding)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rdahlstrom

    Windows - window status (Running vs Not Responding)

    Does anyone know how to determine the window status (Running or Not
    Responding)? I've tried various methods with no success...

    This would be on a variety of Windows systems, but all at least XP,
    and mostly server 2003. Everyone will have Python 2.5.1 on them, and
    the script would be running locally.

    Any ideas?
  • rdahlstrom

    #2
    Re: Windows - window status (Running vs Not Responding)

    On Apr 11, 1:45 pm, rdahlstrom <roger.dahlst.. .@gmail.comwrot e:
    Does anyone know how to determine the window status (Running or Not
    Responding)? I've tried various methods with no success...
    >
    This would be on a variety of Windows systems, but all at least XP,
    and mostly server 2003. Everyone will have Python 2.5.1 on them, and
    the script would be running locally.
    >
    Any ideas?

    Basically, I'm looking for something similar to the Process.Respond ing
    property in System.Diagnost ics...

    Comment

    • Tim Golden

      #3
      Re: Windows - window status (Running vs Not Responding)

      rdahlstrom wrote:
      On Apr 11, 1:45 pm, rdahlstrom <roger.dahlst.. .@gmail.comwrot e:
      >Does anyone know how to determine the window status (Running or Not
      >Responding)? I've tried various methods with no success...
      >>
      >This would be on a variety of Windows systems, but all at least XP,
      >and mostly server 2003. Everyone will have Python 2.5.1 on them, and
      >the script would be running locally.
      >>
      >Any ideas?
      >
      >
      Basically, I'm looking for something similar to the Process.Respond ing
      property in System.Diagnost ics...
      Well one (slightly drastic) possibility might be to use IronPython [1]
      or Python.NET [2] to invoke the .Net functionality directly. AFAIK there
      is no direct alternative: I believe that WMI can be a useful match
      for System.Diagnost ics but doesn't deal with windows (ie user-interface
      elements). Presumably you could find a top-level window for each
      process, using something vaguely like this [3] coupled with this [4]
      and send it a suitable SendMessage to "ping" it. Haven't done it myself
      but can't see why it shouldn't work.

      All a bit handwavey but maybe it'll point you somewhere...

      TJG

      [1] http://www.codeplex.com/Wiki/View.as...ame=IronPython
      [2] http://pythonnet.sourceforge.net/
      [3] http://timgolden.me.uk/python/wmi_co...ning_processes
      [4]

      Comment

      • Mike Driscoll

        #4
        Re: Windows - window status (Running vs Not Responding)

        On Apr 11, 2:10 pm, rdahlstrom <roger.dahlst.. .@gmail.comwrot e:
        On Apr 11, 1:45 pm, rdahlstrom <roger.dahlst.. .@gmail.comwrot e:
        >
        Does anyone know how to determine the window status (Running or Not
        Responding)? I've tried various methods with no success...
        >
        This would be on a variety of Windows systems, but all at least XP,
        and mostly server 2003. Everyone will have Python 2.5.1 on them, and
        the script would be running locally.
        >
        Any ideas?
        >
        Basically, I'm looking for something similar to the Process.Respond ing
        property in System.Diagnost ics...
        Hmmm...I think you should re-post to the Python win32 group. They'll
        know the answer, if there is one. Here's the link to get signed up:


        Also, you might take a look at the WMI module:



        I'm pretty sure it can do that, but I don't know how. I did find an
        article on it:



        If you're better than I am, you can probably translate this to the
        Python equivalent. Zenoss also has some monitoring software that's
        open source Python code.

        Mike

        Comment

        • Tim Golden

          #5
          Re: Windows - window status (Running vs Not Responding)

          Mike Driscoll wrote:

          >
          If you're better than I am, you can probably translate this to the
          Python equivalent. Zenoss also has some monitoring software that's
          open source Python code.
          I'm afraid that article only allows you to determine whether
          a known executable is running, If that's what the OP's after,
          then you can do as much by querying WMI thusly:

          <code>
          import wmi
          c = wmi.WMI ()

          EXE = "notepad.ex e"
          for process in c.Win32_Process (Caption=EXE):
          print process
          break
          else:
          print "None found"

          </code>

          TJG

          Comment

          • Roger  Dahlstrom

            #6
            Re: Windows - window status (Running vs Not Responding)

            On Apr 11, 3:46 pm, Tim Golden <m...@timgolden .me.ukwrote:
            rdahlstrom wrote:
            On Apr 11, 1:45 pm, rdahlstrom <roger.dahlst.. .@gmail.comwrot e:
            Does anyone know how to determine the window status (Running or Not
            Responding)? I've tried various methods with no success...
            >
            This would be on a variety of Windows systems, but all at least XP,
            and mostly server 2003. Everyone will have Python 2.5.1 on them, and
            the script would be running locally.
            >
            Any ideas?
            >
            Basically, I'm looking for something similar to the Process.Respond ing
            property in System.Diagnost ics...
            >
            Well one (slightly drastic) possibility might be to use IronPython [1]
            or Python.NET [2] to invoke the .Net functionality directly. AFAIK there
            is no direct alternative: I believe that WMI can be a useful match
            for System.Diagnost ics but doesn't deal with windows (ie user-interface
            elements). Presumably you could find a top-level window for each
            process, using something vaguely like this [3] coupled with this [4]
            and send it a suitable SendMessage to "ping" it. Haven't done it myself
            but can't see why it shouldn't work.
            >
            All a bit handwavey but maybe it'll point you somewhere...
            >
            TJG
            >
            [1]http://www.codeplex.co m/Wiki/View.aspx?Proje ctName=IronPyth on
            [2]http://pythonnet.sourc eforge.net/
            [3]http://timgolden.me.uk/python/wmi_cookbook.ht ml#running_proc esses
            [4]http://timgolden.me.uk/python/win32_how_do_i/find-the-window-for-my-s...
            You know, I thought about sending it a message, but I found that, in
            testing, I am able to move, resize, and copy text from a "Not
            Responding" window. I was having a tough time figuring out a suitable
            message that I could send a generic window, one that I had no idea
            about what it had available to me. Other than sending it a graceful
            exit message (which I really don't want to do), have you any ides
            about what to send it?

            Comment

            • Roger  Dahlstrom

              #7
              Re: Windows - window status (Running vs Not Responding)

              On Apr 11, 3:54 pm, Mike Driscoll <kyoso...@gmail .comwrote:
              On Apr 11, 2:10 pm, rdahlstrom <roger.dahlst.. .@gmail.comwrot e:
              >
              On Apr 11, 1:45 pm, rdahlstrom <roger.dahlst.. .@gmail.comwrot e:
              >
              Does anyone know how to determine the window status (Running or Not
              Responding)? I've tried various methods with no success...
              >
              This would be on a variety of Windows systems, but all at least XP,
              and mostly server 2003. Everyone will have Python 2.5.1 on them, and
              the script would be running locally.
              >
              Any ideas?
              >
              Basically, I'm looking for something similar to the Process.Respond ing
              property in System.Diagnost ics...
              >
              Hmmm...I think you should re-post to the Python win32 group. They'll
              know the answer, if there is one. Here's the link to get signed up:http://mail.python.org/mailman/listinfo/python-win32
              >
              Also, you might take a look at the WMI module:
              >

              >
              I'm pretty sure it can do that, but I don't know how. I did find an
              article on it:
              >

              >
              If you're better than I am, you can probably translate this to the
              Python equivalent. Zenoss also has some monitoring software that's
              open source Python code.
              >
              Mike
              I thought about posting to the win32 group, but in looking at all of
              the win32 apis, I couldn't find anything that did this - other than
              System.Diagnost ic in c#, which isn't available to win32 (nor would you
              expect it to be, I guess)

              Comment

              • Roger  Dahlstrom

                #8
                Re: Windows - window status (Running vs Not Responding)

                On Apr 11, 3:46 pm, Tim Golden <m...@timgolden .me.ukwrote:
                rdahlstrom wrote:
                On Apr 11, 1:45 pm, rdahlstrom <roger.dahlst.. .@gmail.comwrot e:
                Does anyone know how to determine the window status (Running or Not
                Responding)? I've tried various methods with no success...
                >
                This would be on a variety of Windows systems, but all at least XP,
                and mostly server 2003. Everyone will have Python 2.5.1 on them, and
                the script would be running locally.
                >
                Any ideas?
                >
                Basically, I'm looking for something similar to the Process.Respond ing
                property in System.Diagnost ics...
                >
                Well one (slightly drastic) possibility might be to use IronPython [1]
                or Python.NET [2] to invoke the .Net functionality directly. AFAIK there
                is no direct alternative: I believe that WMI can be a useful match
                for System.Diagnost ics but doesn't deal with windows (ie user-interface
                elements). Presumably you could find a top-level window for each
                process, using something vaguely like this [3] coupled with this [4]
                and send it a suitable SendMessage to "ping" it. Haven't done it myself
                but can't see why it shouldn't work.
                >
                All a bit handwavey but maybe it'll point you somewhere...
                >
                TJG
                >
                [1]http://www.codeplex.co m/Wiki/View.aspx?Proje ctName=IronPyth on
                [2]http://pythonnet.sourc eforge.net/
                [3]http://timgolden.me.uk/python/wmi_cookbook.ht ml#running_proc esses
                [4]http://timgolden.me.uk/python/win32_how_do_i/find-the-window-for-my-s...
                I had actually contemplated using ctypes and linking the .dll
                directly, but even though I'm running 32 bit Python, some of the
                machines that I want to run this on are 64 bit windows, so it doesn't
                work. If I get desperate, I'll check out IronPython, but I'd really
                like to stay (as much as possible) with our standard package (2.5.1
                with wmi/win32)

                Comment

                • Mike Driscoll

                  #9
                  Re: Windows - window status (Running vs Not Responding)

                  On Apr 11, 3:22 pm, Tim Golden <m...@timgolden .me.ukwrote:
                  Mike Driscoll wrote:>
                  If you're better than I am, you can probably translate this to the
                  Python equivalent. Zenoss also has some monitoring software that's
                  open source Python code.
                  >
                  I'm afraid that article only allows you to determine whether
                  a known executable is running, If that's what the OP's after,
                  then you can do as much by querying WMI thusly:
                  >
                  <code>
                  import wmi
                  c = wmi.WMI ()
                  >
                  EXE = "notepad.ex e"
                  for process in c.Win32_Process (Caption=EXE):
                  print process
                  break
                  else:
                  print "None found"
                  >
                  </code>
                  >
                  TJG
                  Tim,

                  Oh well. I guess my Google-Fu failed me this time around. Thanks for
                  looking at it though.

                  Mike

                  Comment

                  • Tim Golden

                    #10
                    Re: Windows - window status (Running vs Not Responding)

                    rdahlstrom wrote:
                    On Apr 11, 1:45 pm, rdahlstrom <roger.dahlst.. .@gmail.comwrot e:
                    >Does anyone know how to determine the window status (Running or Not
                    >Responding)? I've tried various methods with no success...
                    >>
                    >This would be on a variety of Windows systems, but all at least XP,
                    >and mostly server 2003. Everyone will have Python 2.5.1 on them, and
                    >the script would be running locally.
                    >>
                    >Any ideas?
                    >
                    >
                    Basically, I'm looking for something similar to the Process.Respond ing
                    property in System.Diagnost ics...
                    Well one (slightly drastic) possibility might be to use IronPython [1]
                    or Python.NET [2] to invoke the .Net functionality directly. AFAIK there
                    is no direct alternative: I believe that WMI can be a useful match
                    for System.Diagnost ics but doesn't deal with windows (ie user-interface
                    elements). Presumably you could find a top-level window for each
                    process, using something vaguely like this [3] coupled with this [4]
                    and send it a suitable SendMessage to "ping" it. Haven't done it myself
                    but can't see why it shouldn't work.

                    All a bit handwavey but maybe it'll point you somewhere...

                    TJG

                    [1] http://www.codeplex.com/Wiki/View.as...ame=IronPython
                    [2] http://pythonnet.sourceforge.net/
                    [3] http://timgolden.me.uk/python/wmi_co...ning_processes
                    [4]

                    Comment

                    • Mike Driscoll

                      #11
                      Re: Windows - window status (Running vs Not Responding)

                      On Apr 11, 2:10 pm, rdahlstrom <roger.dahlst.. .@gmail.comwrot e:
                      On Apr 11, 1:45 pm, rdahlstrom <roger.dahlst.. .@gmail.comwrot e:
                      >
                      Does anyone know how to determine the window status (Running or Not
                      Responding)? I've tried various methods with no success...
                      >
                      This would be on a variety of Windows systems, but all at least XP,
                      and mostly server 2003. Everyone will have Python 2.5.1 on them, and
                      the script would be running locally.
                      >
                      Any ideas?
                      >
                      Basically, I'm looking for something similar to the Process.Respond ing
                      property in System.Diagnost ics...
                      Hmmm...I think you should re-post to the Python win32 group. They'll
                      know the answer, if there is one. Here's the link to get signed up:


                      Also, you might take a look at the WMI module:



                      I'm pretty sure it can do that, but I don't know how. I did find an
                      article on it:



                      If you're better than I am, you can probably translate this to the
                      Python equivalent. Zenoss also has some monitoring software that's
                      open source Python code.

                      Mike

                      Comment

                      • Tim Golden

                        #12
                        Re: Windows - window status (Running vs Not Responding)

                        Mike Driscoll wrote:

                        >
                        If you're better than I am, you can probably translate this to the
                        Python equivalent. Zenoss also has some monitoring software that's
                        open source Python code.
                        I'm afraid that article only allows you to determine whether
                        a known executable is running, If that's what the OP's after,
                        then you can do as much by querying WMI thusly:

                        <code>
                        import wmi
                        c = wmi.WMI ()

                        EXE = "notepad.ex e"
                        for process in c.Win32_Process (Caption=EXE):
                        print process
                        break
                        else:
                        print "None found"

                        </code>

                        TJG

                        Comment

                        • Roger  Dahlstrom

                          #13
                          Re: Windows - window status (Running vs Not Responding)

                          On Apr 11, 3:46 pm, Tim Golden <m...@timgolden .me.ukwrote:
                          rdahlstrom wrote:
                          On Apr 11, 1:45 pm, rdahlstrom <roger.dahlst.. .@gmail.comwrot e:
                          Does anyone know how to determine the window status (Running or Not
                          Responding)? I've tried various methods with no success...
                          >
                          This would be on a variety of Windows systems, but all at least XP,
                          and mostly server 2003. Everyone will have Python 2.5.1 on them, and
                          the script would be running locally.
                          >
                          Any ideas?
                          >
                          Basically, I'm looking for something similar to the Process.Respond ing
                          property in System.Diagnost ics...
                          >
                          Well one (slightly drastic) possibility might be to use IronPython [1]
                          or Python.NET [2] to invoke the .Net functionality directly. AFAIK there
                          is no direct alternative: I believe that WMI can be a useful match
                          for System.Diagnost ics but doesn't deal with windows (ie user-interface
                          elements). Presumably you could find a top-level window for each
                          process, using something vaguely like this [3] coupled with this [4]
                          and send it a suitable SendMessage to "ping" it. Haven't done it myself
                          but can't see why it shouldn't work.
                          >
                          All a bit handwavey but maybe it'll point you somewhere...
                          >
                          TJG
                          >
                          [1]http://www.codeplex.co m/Wiki/View.aspx?Proje ctName=IronPyth on
                          [2]http://pythonnet.sourc eforge.net/
                          [3]http://timgolden.me.uk/python/wmi_cookbook.ht ml#running_proc esses
                          [4]http://timgolden.me.uk/python/win32_how_do_i/find-the-window-for-my-s...
                          You know, I thought about sending it a message, but I found that, in
                          testing, I am able to move, resize, and copy text from a "Not
                          Responding" window. I was having a tough time figuring out a suitable
                          message that I could send a generic window, one that I had no idea
                          about what it had available to me. Other than sending it a graceful
                          exit message (which I really don't want to do), have you any ides
                          about what to send it?

                          Comment

                          • Roger  Dahlstrom

                            #14
                            Re: Windows - window status (Running vs Not Responding)

                            On Apr 11, 3:54 pm, Mike Driscoll <kyoso...@gmail .comwrote:
                            On Apr 11, 2:10 pm, rdahlstrom <roger.dahlst.. .@gmail.comwrot e:
                            >
                            On Apr 11, 1:45 pm, rdahlstrom <roger.dahlst.. .@gmail.comwrot e:
                            >
                            Does anyone know how to determine the window status (Running or Not
                            Responding)? I've tried various methods with no success...
                            >
                            This would be on a variety of Windows systems, but all at least XP,
                            and mostly server 2003. Everyone will have Python 2.5.1 on them, and
                            the script would be running locally.
                            >
                            Any ideas?
                            >
                            Basically, I'm looking for something similar to the Process.Respond ing
                            property in System.Diagnost ics...
                            >
                            Hmmm...I think you should re-post to the Python win32 group. They'll
                            know the answer, if there is one. Here's the link to get signed up:http://mail.python.org/mailman/listinfo/python-win32
                            >
                            Also, you might take a look at the WMI module:
                            >

                            >
                            I'm pretty sure it can do that, but I don't know how. I did find an
                            article on it:
                            >

                            >
                            If you're better than I am, you can probably translate this to the
                            Python equivalent. Zenoss also has some monitoring software that's
                            open source Python code.
                            >
                            Mike
                            I thought about posting to the win32 group, but in looking at all of
                            the win32 apis, I couldn't find anything that did this - other than
                            System.Diagnost ic in c#, which isn't available to win32 (nor would you
                            expect it to be, I guess)

                            Comment

                            • Roger  Dahlstrom

                              #15
                              Re: Windows - window status (Running vs Not Responding)

                              On Apr 11, 3:46 pm, Tim Golden <m...@timgolden .me.ukwrote:
                              rdahlstrom wrote:
                              On Apr 11, 1:45 pm, rdahlstrom <roger.dahlst.. .@gmail.comwrot e:
                              Does anyone know how to determine the window status (Running or Not
                              Responding)? I've tried various methods with no success...
                              >
                              This would be on a variety of Windows systems, but all at least XP,
                              and mostly server 2003. Everyone will have Python 2.5.1 on them, and
                              the script would be running locally.
                              >
                              Any ideas?
                              >
                              Basically, I'm looking for something similar to the Process.Respond ing
                              property in System.Diagnost ics...
                              >
                              Well one (slightly drastic) possibility might be to use IronPython [1]
                              or Python.NET [2] to invoke the .Net functionality directly. AFAIK there
                              is no direct alternative: I believe that WMI can be a useful match
                              for System.Diagnost ics but doesn't deal with windows (ie user-interface
                              elements). Presumably you could find a top-level window for each
                              process, using something vaguely like this [3] coupled with this [4]
                              and send it a suitable SendMessage to "ping" it. Haven't done it myself
                              but can't see why it shouldn't work.
                              >
                              All a bit handwavey but maybe it'll point you somewhere...
                              >
                              TJG
                              >
                              [1]http://www.codeplex.co m/Wiki/View.aspx?Proje ctName=IronPyth on
                              [2]http://pythonnet.sourc eforge.net/
                              [3]http://timgolden.me.uk/python/wmi_cookbook.ht ml#running_proc esses
                              [4]http://timgolden.me.uk/python/win32_how_do_i/find-the-window-for-my-s...
                              I had actually contemplated using ctypes and linking the .dll
                              directly, but even though I'm running 32 bit Python, some of the
                              machines that I want to run this on are 64 bit windows, so it doesn't
                              work. If I get desperate, I'll check out IronPython, but I'd really
                              like to stay (as much as possible) with our standard package (2.5.1
                              with wmi/win32)

                              Comment

                              Working...