473,782 Members | 2,396 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

(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: 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 = "TJvXPCheck box"

try:
Â*Â*Â*Â*hWndÂ*= Â*wi.FindWindow Ex(Â*0,Â*0,Â*"T Form1",Â*"Speed FanÂ*4.20")Â*
Â*Â*Â*Â*printÂ* hWndÂ*
Â*Â*Â*Â*hWndÂ*= Â*wi.FindWindow Ex(Â*hWnd,Â*0, *"TPageControl" ,Â*"")Â*Â*
Â*Â*Â*Â*printÂ* hWnd
Â*Â*Â*Â*hWndÂ*= Â*wi.FindWindow Ex(Â*hWnd,Â*0, *"TTabSheet",Â* "Readings")
Â*Â*Â*Â*printÂ* hWnd
Â*Â*Â*Â*hWndÂ*= Â*wi.FindWindow Ex(Â*hWnd,Â*0, *cl,Â*"Automati cÂ*fanÂ*speed")
Â*Â*Â*Â*
Â*Â*Â*Â*printÂ* hWnd
Â*Â*Â*Â*resÂ*=Â *wi.SetForegrou ndWindow(hWnd)
Â*Â*Â*Â*res=wi. SendMessageTime out(hWnd,wc.WM_ LBUTTONDOWN,wc. MK_LBUTTON,0,2, 75)Â*Â*
Â*Â*Â*Â*resÂ*=Â *wi.SendMessage Timeout(Â*hWnd, wc.WM_LBUTTONUP ,Â*0,Â*0,Â*2,Â* 75Â*)Â*
Â*Â*Â*Â*printÂ* res
except:
Â*Â*Â*Â*pass
#end code
Jul 18 '05 #1
7 4774
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" <tl******@yahoo .com> schrieb im Newsbeitrag
news:Kl******** **********@twis ter.socal.rr.co m...
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 = "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


Jul 18 '05 #2
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
On Apr 3, 2005 1:52 AM, Claudio Grondi <cl************ @freenet.de> wrote:
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) ?


Winspector is good for this kind of thing.

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

--
Cheers,
Simon B,
si***@brunningo nline.net,
http://www.brunningonline.net/simon/blog/
Jul 18 '05 #4
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***@brunningo nline.net,
http://www.brunningonline.net/simon/blog/
Jul 18 '05 #5
>>It makes me curious if I can get also the
temperature s 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******** *************** *************** @python.org... On Apr 3, 2005 1:52 AM, Claudio Grondi <cl************ @freenet.de> wrote:
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) ?


Winspector is good for this kind of thing.

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

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


Jul 18 '05 #6
"Claudio Grondi" <cl************ @freenet.de> wrote in message news:<3b******* ******@individu al.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
"TJvXPCheck box" 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
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.goo gle.com...
"Claudio Grondi" <cl************ @freenet.de> wrote in message

news:<3b******* ******@individu al.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
"TJvXPCheck box" 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
4775
by: Bart Simpson | last post by:
Hi, I want to control 'Scheduled Tasks' in Windows 2003 by python program. But I couldn't find any Python module about win32 'Scheduled Tasks'. I could find only Perl module about it. (see http://taskscheduler.sourceforge.net) But, I want to control 'Scheduled Tasks' by python :) Is there any python module about win32 'Scheduled Tasks'?
3
3510
by: Jane Austine | last post by:
I need to control a command line program via python. I first tried popen2 and 3 but I couldn't find a way to talk to the subprocess interactively; that is, read some and then write some, and read some more again... (suppose controlling an interactive shell program) When I try this with popen family, it just hangs. I have to close one pipe before reading from the other. I know that there is a wonderful thing called Expect, but it's not...
5
4438
by: Claudio Grondi | last post by:
Background information: --------------------------------- in order to monitor mainboard sensory data as fan speeds, temperatures, applications like SpeedFan http://www.almico.com/speedfan.php or MBM http://mbm.livewiredev.com/ can be used. Both of the mentioned apps expose data got from the hardware in a shared memory area.
10
1607
by: Claudio Grondi | last post by:
German Windows 2000, SP 4 Python 2.3.4 (#53, May 25 2004, 21:17:02) IPython 0.6.10 -- An enhanced Interactive Python. Is it already known, that after switching the keyboard input scheme on German Windows 2000 to english USA International IPython generates \x00" instead of " when trying to input quotation marks?
15
11788
by: Bryan | last post by:
I have a multi-threaded C# console application that uses WMI (System.Management namespace) to make RPC calls to several servers (600+ ) and returns ScheduledJobs. The section of my code that performs the query is contained in a delegate function that I execute via a second thread. On 1 or 2 of the 600+ servers the query hangs. I've tried to use Thread.Join() coupled with a Thread.Abort() but this does not kill the thread. Based on...
0
3049
by: Doug Perkes | last post by:
I am trying to create a method called SendKeys that will write a string to the console input using the Win32 API. I have been wrestling with this for days and get more confused with every level in the APIs. Here are the questions I have about the KEV_EVENT_RECORD structure used inside of the WriteConsoleInput WIN32 API call: 1. Do I need to send both a key down and a key up event? 2. What do I put for the ControlKeyState value if no
2
3622
by: Tamir Khason | last post by:
I have a control (created by interop from Win32) wich placed into other control (regular C#), BUT I can not recieve mouse events from Win32 control even when listening to WM_MOUSE... messages from WinProc. The only way I can capture the mouse in the control is using MyWin32Control.Capture = true; from the parent form, BUT after the first click in parent form the capture stops ( even if MyWin32Control.Capture = true after perform of OnClick...
2
11965
by: Danny | last post by:
Hi I want to be able from my csharp button to start an application ( which I can do) and then somehow send a message to the win32 application that says "press the button" The win32 application ( borland app) has a button on it that I need to click in order for it to start correctly. Is this possible from csharp?? thanks
5
2349
by: digory | last post by:
Hi Our product consists of a complex application that is written in C/C++ and uses the old event-based Win32 API (some code has already been in there in times of Windows 3.11!) We cannot afford a complete reimplementation of the whole application, so we would like to gradually port portions of the application to more contemporary platforms like C#. Is it possible for a Win32-based application to encapsulate C# code? I
0
9641
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10313
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10146
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10080
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9944
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6735
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2875
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.