dnyberg Posted March 21, 2005 Share Posted March 21, 2005 I'd like to make something that works like this: while(1) { if (CPU utilization < 40%) emit a mouse click; sleep 5 minutes; } Do the pieces needed for that exist? (I haven't found them in the docs, and am not sufficiently expert in winternals to know what all the system dlls etc do). Is there a function, external app, dll call or something that would let me measure CPU util like that, to use it to control a script's execution? Thanks! Link to comment Share on other sites More sharing options...
Andre Posted March 21, 2005 Share Posted March 21, 2005 (edited) Hi, Very simple Start taskmgr.exe from your script and hide it. use the following code to get the cpu usage. While 1 $Cpu = StatusbarGetText('Windows Taakbeheer','',2) ToolTip($Cpu,0,0) Sleep(10) WEnd Andre Edit : Replace Windows Taakbeheer with your language of course Edited March 21, 2005 by Andre What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel! Link to comment Share on other sites More sharing options...
dnyberg Posted March 21, 2005 Author Share Posted March 21, 2005 Hm, okay. I guess some "if !exist..." etc would be desirable as well, but it looks like those are the primitive bits I'll need. Thanks! Link to comment Share on other sites More sharing options...
layer Posted March 21, 2005 Share Posted March 21, 2005 you could write a Dll with SystemGetTimes NOTE: NOT SystemGetTime...maybe ill give it a shot, although many think i really need a lot fo learning to do with C++ so, it may not be safe if i made it.. ill wait but in andres example you could just do likeif $cpu = 40 then blahblahi think.. FootbaG Link to comment Share on other sites More sharing options...
dnyberg Posted March 21, 2005 Author Share Posted March 21, 2005 Something using a dll call would surely be more elegant, but leeching off task manager would be a quick and dirty way to get basic function going. I'm looking to make my pc do a pile of work while I'm away from it, but starting multiple instances of the task make it crash. Way too much virtual memory to run in parallel. That crashes the machine. Emit a mouse click will do, if I stack up a bunch of windows exactly over each other and place the mouse cursor over the "go" button. I bet I could do better by searching windows for a given title string too. More elaborations. But once it's all done, this could be kinda neat. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now