Wicked_Caty Posted February 13, 2016 Posted February 13, 2016 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!
Moderators Melba23 Posted February 13, 2016 Moderators Posted February 13, 2016 Wicked_Caty, I run many AutoIt executables that stay idle for long periods - and none of them use any CPU. It sounds as if you have a tight loop while idling which is using up cycles - try adding a Sleep(10) inside the loop. Or post the code you use and we can see exactly how to deal with the problem. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
kylomas Posted February 13, 2016 Posted February 13, 2016 (edited) Wicked_Caty, I think the problem is in line.... Oh, wait, have not seen the code. kylomas edit: Shit, there goes M23 and his bionic fingers... Edited February 13, 2016 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
Wicked_Caty Posted February 13, 2016 Author Posted February 13, 2016 Sorry, totally forgot to paste the code xD Reminder.au3
kylomas Posted February 13, 2016 Posted February 13, 2016 (edited) Wicked_Caty, Your code doesn't do anything... Func Reminder0() While 1 Sleep(20000) SoundPlay(@AppDataCommonDir + "\rem\sound.mp3") WEnd EndFunc Func Reminder1() While 1 ; variable t0 for desired time ; calculation for variable t1 for desired time <--- know how to do that, but this is just an example While Not $t0 = $t1 SoundPlay(@AppDataCommonDir + "\rem\sound.mp3") ExitLoop() WEnd WEnd EndFunc kylomas edit: ExitLoop is not a function, it is a statement. Please post a runnable reproducer. Edited February 13, 2016 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
Wicked_Caty Posted February 13, 2016 Author Posted February 13, 2016 That's not the whole code. And the whole code doesn't matter. That are only the two ways that I've figured out put into two functions. It's about the part within the functions, but what's written outside of it. And it would do something if you add those silly two lines outside of the functions and declare the variables $t0 and $t1
kylomas Posted February 13, 2016 Posted February 13, 2016 See my edit... Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
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