cueclub Posted April 16, 2010 Posted April 16, 2010 Okay, I am aware that when a program sleeps, it sleeps. nothing else for it to do. But what of with the sleeps I add some time stamps. sleep would start at 10 min, <time stamp>, run for a min < time stamp> run next function < time stamp> run run that function and sleep for 3 min < time stamp> then next function. And when that function is done < time stamp> again. so then I could calculate the remaining time. using the time stamps. and just finish the initial function sleep. Sorry if it is not making any sense, I haven had my coffee yet. so it would look something like this. while 1 func run() do stuff timestamp1 nextfunc() endfunc func2() do stuff time stamp2 next func() endfunc func3() do stuff time stamp endfunc $ts = Timestamp1 - timestamp2 - timestamp3 sleep($ts) wend something like that. Just need pointed in the right direction. Thanks in advance
Fi0da Posted April 16, 2010 Posted April 16, 2010 I think not ... Sleeps since the start after the execution of the function ... I think you should add the Sleep + times the run time of all functions. But...W8 for + replyes..Here they give solution to everything I read ... I update ... I learn ...
kaotkbliss Posted April 16, 2010 Posted April 16, 2010 Looks prett close I would do $slp=max amount of time you want to sleep While 1 func1() func2() func3() $ts=$slp-$time1-$time2-$time3 Sleep($ts) Wend Func func1() do stuff $time1=your timestamp EndFunc Func func2() do stuff $time2=your timestamp EndFunc Func func3() do stuff $time3=your timestamp EndFunc You might have to do some time conversion depending if you use @Hour and @Min for your timestamp or TimerInit(). 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
cueclub Posted April 16, 2010 Author Posted April 16, 2010 thx Fi0da ok I didnt even think about doing it like this $slp=max amount of time you want to sleep While 1 func1() func2() func3() $ts=$slp-$time1-$time2-$time3 Sleep($ts) Wend So If I do that, Instead of a timerint() I could use a Now() perhaps. Cant remember off the top of my head if it has min/sec or not. I will mess with it. Thanks you both for the reply Cue
Moderators Melba23 Posted April 16, 2010 Moderators Posted April 16, 2010 cueclub,I would do it this way (if I have understood you correctly) :expandcollapse popup; Start our 10 min timer $iBegin_10 = TimerInit() ConsoleWrite(@SEC & @CRLF) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ; Run first function Func_1() ; Wait for 1 min $iBegin_1 = TimerInit() Do Sleep(10) Until TimerDiff($iBegin_1) > 1000 ; 1*60*1000 ConsoleWrite(@SEC & @CRLF) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ; Run Second function Func_2() ; Wait for 3 mins $iBegin_3 = TimerInit() Do Sleep(10) Until TimerDiff($iBegin_3) > 3000 ; 3 * 60 * 1000 ConsoleWrite(@SEC & @CRLF) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ; Run Third function Func_3() ; Now wait until the 10 minutes are up Do Sleep(10) Until TimerDiff($iBegin_10) > 10000 ; 10 * 60 * 1000 ConsoleWrite(@SEC & @CRLF) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ; And here we are 10 minutes later Func Func_1() ; do stuff() EndFunc Func Func_2() ; do stuff() EndFunc Func Func_3() ; do stuff() EndFuncAt the moment I have set it to run for seconds rather than minutes so you can see it working with the ConsoleWrite lines. Just delete them and replace the values in the TimerDiff lines when you want it to run for the full time.If this is not want you want - drink some coffee and explain again! 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
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