Search the Community
Showing results for tags 'idle'.
-
Right now the script will exit immediately if I don't pause it somehow (obvious of course). I was curious on people's opinions of how they do it or what option they prefer below? Thanks Option 1 (I prefer) #include <MsgBoxConstants.au3> HotKeySet('^!p', SomeFunc) ProcessWaitClose(@AutoItPID) Func SomeFunc() MsgBox($MB_SYSTEMMODAL, "Title", "This message box will timeout after 10 seconds or select the OK button.", 10) EndFunc Option 2 (in the help file) #include <MsgBoxConstants.au3> HotKeySet('^!p', SomeFunc) While Sleep(100) WEnd Func SomeFunc() MsgBox($MB_SYSTEMMODAL, "Title", "This message box will timeout after 10 seconds or select the OK button.", 10) EndFunc Option 3 #include <MsgBoxConstants.au3> HotKeySet('^!p', SomeFunc) While 1 GUIGetMsg() ; Use the internal sleep WEnd Func SomeFunc() MsgBox($MB_SYSTEMMODAL, "Title", "This message box will timeout after 10 seconds or select the OK button.", 10) EndFunc
-
Hello. I need a trick to make a process idle down less than sleep. I use onevents for almost everything, but the problem is the project I'm working on has almost 50 processes. Even at around 1% idle it adds up and there will be more processes added. What I'm looking to do is get to a C like idle of .03 to .08 cpu. Any tricks you have will be great and I will post the final code I use. I love AutoIt, but is does need a cooler name, lol. Thx.
- 13 replies
-
Hi guys I have a script that runs for about 20 seconds. If Outlook.exe is not already open, and I open it while the script is running, I want Outlook to wait until the script is done, and then open. Is it possible to set an application in some sort of idle state until the script is done? I want to avoid it from just closing Outlook, and open it again. Thanks David
-
Leaving a program idle for a long time
Wicked_Caty posted a topic in AutoIt General Help and Support
What am I supposed to do, if a program is able for a long time? My program is idle for 20 minutes, before doing a very tiny task, and then starting all over again. I tries using Sleep(), but that literally melts my CPU and pushes them up for 20 to 30%. Permanently checking the time costs too much CPU too. Any other way of doing this? Preferably without taking more than 1% CPU. It also needn't be exactly 20 minutes, everything between 15 and 25 is fine too Thanks! -
#RequireAdmin #include <Timers.au3> #include <GUIConstants.au3> Global $Limit = 5 ; idle limit in seconds Global $objWMIService; Global $Instances; Global $temp; Local $Counter = 0 HotKeySet("{ESC}", "_Quit") AdlibRegister("_CheckIdleTime", 500) ; default 250ms AdlibRegister("_findTemp", 60000) ; default 250ms ; ; Not all system support this function!!! Func findTemp() ;;; Source : http://stackoverflow.com/questions/25139311/autoit-get-cpu-temp-and-put-it-into-a-graph $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $strComputer = "." $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\wmi") $Instances = $objWMIService.InstancesOf("MSAcpi_ThermalZoneTemperature") For $Item In $Instances $temp = ($Item.CurrentTemperature - 2732) / 10 ; set the temp Next if $temp > 50 Then ; normal cpu temp from 40 to 60°C ; idle 35 to 40°C $Limit = 1 Else $Limit = 10 EndIf EndFunc ;==>findTemp While 1 Sleep(20) if($Counter == 0) Then Run("C:\Windows\System32\cmd.exe", "", @SW_HIDE) $Counter = 1 EndIf WEnd Func _CheckIdleTime() If (_Timer_GetIdleTime() > $Limit * 1000) Then ProcessWait("cmd.exe") Local $hwnd = WinGetHandle("[REGEXPTITLE:(?i)(.*cmd.*|.*cmd.*)]") ControlSend($hwnd, "", "", "powercfg -setactive a1841308-3541-4fab-bc81-f71556f20b4a{Enter}") else ProcessWait("cmd.exe") Local $hwnd = WinGetHandle("[REGEXPTITLE:(?i)(.*cmd.*|.*cmd.*)]") ControlSend($hwnd, "", "", "powercfg -setactive 381b4222-f694-41f0-9685-ff5bb260df2e{Enter}") EndIf EndFunc ;==>_CheckIdleTime Func _Quit() Exit EndFunc ;==>_Quit The first attempt !!!, to control the power plan through idle. This script should adjust the power plan to the individual situation. This is to slow down the overheat. findTemp() function will only run on supported systems! This batch script shows you whether your system support this function: If the script does not work, meaningless values are outputted. @echo off for /f "delims== tokens=2" %%a in ( 'wmic /namespace:\\root\wmi PATH MSAcpi_ThermalZoneTemperature get CurrentTemperature /value' ) do ( set /a degrees_celsius=%%a / 10 - 273 ) echo %degrees_celsius% pause
-
- power plan
- windows
-
(and 1 more)
Tagged with: