By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,587 Members | 1,718 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,587 IT Pros & Developers. It's quick & easy.

(win32) speedfan api control

P: n/a
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: tl******@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,¬*"TPa geControl",¬*"")¬*¬*
¬*¬*¬*¬*print¬*hWnd
¬*¬*¬*¬*hWnd¬*=¬*wi.FindWindowEx(¬*hWnd,¬*0,¬*"TTa bSheet",¬*"Readings")
¬*¬*¬*¬*print¬*hWnd
¬*¬*¬*¬*hWnd¬*=¬*wi.FindWindowEx(¬*hWnd,¬*0,¬*cl,¬ *"Automatic¬*fan¬*speed")
¬*¬*¬*¬*
¬*¬*¬*¬*print¬*hWnd
¬*¬*¬*¬*res¬*=¬*wi.SetForegroundWindow(hWnd)
¬*¬*¬*¬*res=wi.SendMessageTimeout(hWnd,wc.WM_LBUTT ONDOWN,wc.MK_LBUTTON,0,2,75)¬*¬*
¬*¬*¬*¬*res¬*=¬*wi.SendMessageTimeout(¬*hWnd,wc.WM _LBUTTONUP,¬*0,¬*0,¬*2,¬*75¬*)¬*
¬*¬*¬*¬*print¬*res
except:
¬*¬*¬*¬*pass
#end code
Jul 18 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
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
"TJvXPCheckbox" and the other
values necessary to access the program
GUI ? (as I can see, there is no source
code of SpeedFan available) ?

Claudio

"tlviewer" <tl******@yahoo.com> schrieb im Newsbeitrag
news:Kl******************@twister.socal.rr.com...
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: tl******@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,w c.MK_LBUTTON,0,2,75)
res = wi.SendMessageTimeout( hWnd,wc.WM_LBUTTONUP, 0, 0, 2, 75 )
print res
except:
pass
#end code


Jul 18 '05 #2

P: n/a
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.

Jul 18 '05 #3

P: n/a
On Apr 3, 2005 1:52 AM, Claudio Grondi <cl************@freenet.de> wrote:
May I ask how did you get the
"TJvXPCheckbox" and the other
values necessary to access the program
GUI ? (as I can see, there is no source
code of SpeedFan available) ?


Winspector is good for this kind of thing.

http://www.brunningonline.net/simon/...es/001320.html

--
Cheers,
Simon B,
si***@brunningonline.net,
http://www.brunningonline.net/simon/blog/
Jul 18 '05 #4

P: n/a
On Apr 2, 2005 3:22 AM, tlviewer <tl******@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!

http://www.tizmoi.net/watsup/intro.html

--
Cheers,
Simon B,
si***@brunningonline.net,
http://www.brunningonline.net/simon/blog/
Jul 18 '05 #5

P: n/a
>>It makes me curious if I can get also the
temperatures into Python script for
further processing
Winspector is good for this kind of thing.
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" <si************@gmail.com> schrieb im Newsbeitrag
news:ma**************************************@pyth on.org... On Apr 3, 2005 1:52 AM, Claudio Grondi <cl************@freenet.de> wrote:
May I ask how did you get the
"TJvXPCheckbox" and the other
values necessary to access the program
GUI ? (as I can see, there is no source
code of SpeedFan available) ?


Winspector is good for this kind of thing.

http://www.brunningonline.net/simon/...es/001320.html

--
Cheers,
Simon B,
si***@brunningonline.net,
http://www.brunningonline.net/simon/blog/


Jul 18 '05 #6

P: n/a
"Claudio Grondi" <cl************@freenet.de> wrote in message news:<3b*************@individual.net>...
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
"TJvXPCheckbox" and the other
values necessary to access the program
GUI ? (as I can see, there is no source
code of SpeedFan available) ?


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

P: n/a
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
http://mbm.livewiredev.com
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" <go****@almico.com> schrieb im Newsbeitrag
news:b3**************************@posting.google.c om...
"Claudio Grondi" <cl************@freenet.de> wrote in message

news:<3b*************@individual.net>...
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
"TJvXPCheckbox" and the other
values necessary to access the program
GUI ? (as I can see, there is no source
code of SpeedFan available) ?


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

Jul 18 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.