(win32) speedfan api control

tlviewer tlviewer at yahoo.com
Fri Apr 1 21:22:34 EST 2005


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 at 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 = "TJvXPCheckbox"

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.SetForegroundWindow(hWnd)
    res=wi.SendMessageTimeout(hWnd,wc.WM_LBUTTONDOWN,wc.MK_LBUTTON,0,2,75)  
    res = wi.SendMessageTimeout( hWnd,wc.WM_LBUTTONUP, 0, 0, 2, 75 ) 
    print res
except:
    pass
#end code



More information about the Python-list mailing list