Thanks, I'll try this out!

Guillaume Proux wrote:
Hi Astan,



Astan Chee <stanc <at> al.com.au> writes:
  
Im using py2exe to convert my python scripts to .exe. Im trying to get 
my scripts and .exes to only run (utilize full CPU) when my PC is idle 
(kinda like SETI <at> home).
    


The first step would be to change the priority of your software to run at the
lowest priority class of Windows. The simplest way to do that for me was to make
the following calls

from ctypes import windll
myprocess = windll.kernel32.GetCurrentProcess()
windll.kernel32.SetPriorityClass(myprocess,0x00000040) #0x00000040 =
IDLE_PRIORITY_CLASS

I just tried that code with an infinite loop (that usually uses 100% of CPU and
makes the machine unusable...) and I am writing this email while it runs in the
background without any obvious lag.

If this is not enough, you can probably (don't know how but...) find out about
the CPU activity and check CPU activity for a while before you decide to go
about and do your CPU crunching activities.

Regards,

Guillaume



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Py2exe-users mailing list
Py2exe-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/py2exe-users