arielsa Posted April 9, 2006 Share Posted April 9, 2006 Hi all, I've written a program that shutdown the computer on specified times it receives from a server. (the program gives two warnings before shutting down). somehow the program uses the CPU all the time at about 15%, even when it supposed to be at "sleep" mode. Is it normal? is there something that can be done about it? Here is the code, thanks for helping. expandcollapse popupFunc remote_sd() Dim $SD_First_Warn Dim $LastRead = 0000 Dim $CurrentTime Dim $SD_Hour, $SD_Minute, $SD_Warning Dim $ini_location = '' Dim $first_warn_time_to_show $ini_location = IniRead($ini_location, "param", "ini_location", "\\server\ShutDown\sd.ini") While 1 $CurrentTime = TimerInit() If ($CurrentTime - $LastRead) > 1800000 Then $SD_First_Warn = IniRead($ini_location, "param", "first_warn", "5") $SD_Hour = IniRead($ini_location, "param", "hour", "19") $SD_Minute = IniRead($ini_location, "param", "Minute", "0") $SD_Warning = IniRead($ini_location, "param", "time_to_warn", "30") $first_warn_time_to_show = IniRead($ini_location, "param", "first_warn_time_to_show", "30") $LastRead = TimerInit() EndIf Sleep(120000) if ((@HOUR >= $SD_Hour) And (@MIN > $SD_Minute)) Then $message = (@LF & "This Computer will Shutdown in " & $SD_First_Warn & " Minutes.") SplashTextOn("Computer ShutDown", $message , 300, 70, 350, 1, 16) sleep($first_warn_time_to_show) SplashOff() ExitLoop EndIf WEnd Sleep($SD_First_Warn * 60000) $message = @LF & "Shutting down in" SplashTextOn("Computer ShutDown", $message , 300, 70, 350, 1, 16) For $x = 0 to $SD_Warning $y = $SD_Warning-$x ControlSetText("Computer ShutDown", $message, "Static1", $message &" "& $y &" Seconds") sleep(1000) Next If @WDAY <> 4 then ShutDown(13) Else ShutDown(7) EndIf EndFunc opt("TrayIconHide", 1) remote_sd() Link to comment Share on other sites More sharing options...
Developers Jos Posted April 9, 2006 Developers Share Posted April 9, 2006 Hi all, I've written a program that shutdown the computer on specified times it receives from a server. (the program gives two warnings before shutting down). somehow the program uses the CPU all the time at about 15%, even when it supposed to be at "sleep" mode.Is it normal? is there something that can be done about it?Here is the code, thanks for helping.Doesn't use any CPU here while waiting ... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
nfwu Posted April 9, 2006 Share Posted April 9, 2006 Make sure it is specifically that process which is using 15% CPU time, and not just the CPU usage label/ #) TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode() Link to comment Share on other sites More sharing options...
arielsa Posted April 9, 2006 Author Share Posted April 9, 2006 Thank you both, i see now that it was an older version of the code that i was running. 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