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 7 4754
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
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.
>>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/
"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.
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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |