(win32) speedfan api control

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

    #1

    (win32) speedfan api control

    hello,

    If you run the Mainboard monitor, speedfan, here is
    an ActivePython script to force automatic fan control.
            http://www.almico.com/speedfan.php

    It's a great example of how clean the WinApi interface is
    in ActivePython. The script sets focus to the checkbox of
    interest and toggles the checkbox. AFAIK, speedfan will only
    start without fan control, requiring the user to manually
    check the checkbox to turn it on.

    hope someone finds it useful,
    tlviewer

    #!/usr/bin/python
    # author: tlviewer@yahoo. com
    # date: April 1, 2005
    # description: turn on SpeedFan automatic fan speed
    # keywords: speedfan readings
    #import win32api as ap

    import win32gui as wi
    import win32ui as ui
    import win32con as wc

    # dialog class name
    cl = "TJvXPCheck box"

    try:
        hWnd = wi.FindWindowEx ( 0, 0, "TForm1", "SpeedFan 4.20") 
        print hWnd 
        hWnd = wi.FindWindowEx ( hWnd, 0, "TPageControl",  "")  
        print hWnd
        hWnd = wi.FindWindowEx ( hWnd, 0, "TTabSheet" , "Readings")
        print hWnd
        hWnd = wi.FindWindowEx ( hWnd, 0, cl, "Automatic fan speed")
        
        print hWnd
        res = wi.SetForegroun dWindow(hWnd)
        res=wi.SendMess ageTimeout(hWnd ,wc.WM_LBUTTOND OWN,wc.MK_LBUTT ON,0,2,75)  
        res = wi.SendMessageT imeout( hWnd,wc.WM_LBUT TONUP, 0, 0, 2, 75 ) 
        print res
    except:
        pass
    #end code
  • Claudio Grondi

    #2
    Re: (win32) speedfan api control

    your script works ok on my W2K box :-).

    It makes me curious if I can get also the
    temperatures into Python script for
    further processing as easy as the setting
    of the checkbox is done? (I have not
    much experience with this kind of
    programming yet)
    May I ask how did you get the
    "TJvXPCheck box" and the other
    values necessary to access the program
    GUI ? (as I can see, there is no source
    code of SpeedFan available) ?

    Claudio

    "tlviewer" <tlviewer@yahoo .com> schrieb im Newsbeitrag
    news:Kln3e.1390 5$e06.7165@twis ter.socal.rr.co m...[color=blue]
    > hello,
    >
    > If you run the Mainboard monitor, speedfan, here is
    > an ActivePython script to force automatic fan control.
    > http://www.almico.com/speedfan.php
    >
    > It's a great example of how clean the WinApi interface is
    > in ActivePython. The script sets focus to the checkbox of
    > interest and toggles the checkbox. AFAIK, speedfan will only
    > start without fan control, requiring the user to manually
    > check the checkbox to turn it on.
    >
    > hope someone finds it useful,
    > tlviewer
    >
    > #!/usr/bin/python
    > # author: tlviewer@yahoo. com
    > # date: April 1, 2005
    > # description: turn on SpeedFan automatic fan speed
    > # keywords: speedfan readings
    > #import win32api as ap
    >
    > import win32gui as wi
    > import win32ui as ui
    > import win32con as wc
    >
    > # dialog class name
    > cl = "TJvXPCheck box"
    >
    > try:
    > hWnd = wi.FindWindowEx ( 0, 0, "TForm1", "SpeedFan 4.20")
    > print hWnd
    > hWnd = wi.FindWindowEx ( hWnd, 0, "TPageContr ol", "")
    > print hWnd
    > hWnd = wi.FindWindowEx ( hWnd, 0, "TTabSheet" , "Readings")
    > print hWnd
    > hWnd = wi.FindWindowEx ( hWnd, 0, cl, "Automatic fan speed")
    >
    > print hWnd
    > res = wi.SetForegroun dWindow(hWnd)
    > res=wi.SendMess ageTimeout(hWnd ,wc.WM_LBUTTOND OWN,wc.MK_LBUTT ON,0,2,75)
    > res = wi.SendMessageT imeout( hWnd,wc.WM_LBUT TONUP, 0, 0, 2, 75 )
    > print res
    > except:
    > pass
    > #end code[/color]



    Comment

    • Cappy2112

      #3
      Re: (win32) speedfan api control

      Nice idea- getting the handle to a control.
      But how do you know what to pass for wparam , lparam , flags ?

      BTW- I don't see anything unique to Active Python here.
      You can do all of this with the Python windows extensions, which can be
      installed without Active Python.

      Comment

      • Simon Brunning

        #4
        Re: (win32) speedfan api control

        On Apr 3, 2005 1:52 AM, Claudio Grondi <claudio.grondi @freenet.de> wrote:[color=blue]
        > May I ask how did you get the
        > "TJvXPCheck box" and the other
        > values necessary to access the program
        > GUI ? (as I can see, there is no source
        > code of SpeedFan available) ?[/color]

        Winspector is good for this kind of thing.



        --
        Cheers,
        Simon B,
        simon@brunningo nline.net,

        Comment

        • Simon Brunning

          #5
          Re: (win32) speedfan api control

          On Apr 2, 2005 3:22 AM, tlviewer <tlviewer@yahoo .com> wrote:
          (Snip Windows GUI automation stuff.)

          WATSUP includes a module for Windows GUI automation. It's probably
          worth a look - it might save you from doing all the research that I
          had to do!



          --
          Cheers,
          Simon B,
          simon@brunningo nline.net,

          Comment

          • Claudio Grondi

            #6
            Re: (win32) speedfan api control

            >>It makes me curious if I can get also the[color=blue][color=green]
            >>temperature s into Python script for
            >>further processing[/color][/color]
            [color=blue]
            > Winspector is good for this kind of thing.[/color]

            Thanks for the link to Winspector - with this
            tool it's really easy to find out the names
            required to get down to the window elements
            of a running application.

            In the special case of speedfan there seems
            to be no way to get the temperatures shown
            in Reading tab into a Python script, because
            the texts with the temperature values are not
            separate window elements. The only
            message sent to "TJvPanel" (it's the class
            of the element with the temperatures) is
            WM_PAINT with 0, 0 values, so the actual
            temperatures are "hidden" from beeing
            accessed as easy as the value of the
            checkbox.
            Knowing the rectangle of the "TJvPanel"
            it should be probably possible to OCR
            the text shown, but this is another story.

            By the way: is there a free tool (primary
            for Windows, but best for both Linux
            and Windows) able to get the text of the
            word under the current mouse pointer
            position like it is done e.g. by Babylon
            translator?

            Claudio


            "Simon Brunning" <simon.brunning @gmail.com> schrieb im Newsbeitrag
            news:mailman.12 91.1112618988.1 799.python-list@python.org ...[color=blue]
            > On Apr 3, 2005 1:52 AM, Claudio Grondi <claudio.grondi @freenet.de> wrote:[color=green]
            > > May I ask how did you get the
            > > "TJvXPCheck box" and the other
            > > values necessary to access the program
            > > GUI ? (as I can see, there is no source
            > > code of SpeedFan available) ?[/color]
            >
            > Winspector is good for this kind of thing.
            >
            > http://www.brunningonline.net/simon/...es/001320.html
            >
            > --
            > Cheers,
            > Simon B,
            > simon@brunningo nline.net,
            > http://www.brunningonline.net/simon/blog/[/color]



            Comment

            • Almico

              #7
              Re: (win32) speedfan api control

              "Claudio Grondi" <claudio.grondi @freenet.de> wrote in message news:<3b8m2tF6e nbpaU1@individu al.net>...[color=blue]
              > your script works ok on my W2K box :-).
              >
              > It makes me curious if I can get also the
              > temperatures into Python script for
              > further processing as easy as the setting
              > of the checkbox is done? (I have not
              > much experience with this kind of
              > programming yet)
              > May I ask how did you get the
              > "TJvXPCheck box" and the other
              > values necessary to access the program
              > GUI ? (as I can see, there is no source
              > code of SpeedFan available) ?[/color]

              SpeedFan publishes a Shared Memory area. Drop SpeedFan's author (me
              :-)) an email to get its specs.

              Comment

              • Claudio Grondi

                #8
                Re: (win32) speedfan api control

                I have got the specs for SpeedFan from
                the SpeedFan author :-) ,
                but ...
                inbetween I found, that full specs of the
                shared memory access to
                fan speeds, board, CPU temperature data
                are also exposed by the MBM application

                and already published online
                (including C, VB, Delphi code examples).
                but ...
                I failed to get the data into
                a Python script :-( .
                For details see my other
                "Problem with access to shared memory(W2K) /
                ORIGINALLY (win32) speedfan api control"
                posting.

                Claudio


                "Almico" <google@almico. com> schrieb im Newsbeitrag
                news:b3a3df2d.0 504051532.15e88 2d4@posting.goo gle.com...[color=blue]
                > "Claudio Grondi" <claudio.grondi @freenet.de> wrote in message[/color]
                news:<3b8m2tF6e nbpaU1@individu al.net>...[color=blue][color=green]
                > > your script works ok on my W2K box :-).
                > >
                > > It makes me curious if I can get also the
                > > temperatures into Python script for
                > > further processing as easy as the setting
                > > of the checkbox is done? (I have not
                > > much experience with this kind of
                > > programming yet)
                > > May I ask how did you get the
                > > "TJvXPCheck box" and the other
                > > values necessary to access the program
                > > GUI ? (as I can see, there is no source
                > > code of SpeedFan available) ?[/color]
                >
                > SpeedFan publishes a Shared Memory area. Drop SpeedFan's author (me
                > :-)) an email to get its specs.[/color]


                Comment

                Working...