russell Posted September 15, 2010 Posted September 15, 2010 How do i make a script stay ideal till a certain system time? I tried using task schdualer but it needs an admin password and i dont want to set one becuase if the script fails it rebbot the pc back to the desktop automaticly and starts agin muppet hands are so soft :)
norax Posted September 15, 2010 Posted September 15, 2010 How do i make a script stay ideal till a certain system time? I tried using task schdualer but it needs an admin password and i dont want to set one becuase if the script fails it rebbot the pc back to the desktop automaticly and starts agin well its memory consuming to make a loop check the time but it would work $StartTime = "13:30" While 1 if @HOUR & ":" & @MIN = $StartTime Then ;script code here Else Sleep(25000) EndIf WEnd
russell Posted September 15, 2010 Author Posted September 15, 2010 wow, thanks! if this consumes alot or memory, is there another way? muppet hands are so soft :)
wakillon Posted September 15, 2010 Posted September 15, 2010 wow, thanks! if this consumes alot or memory, is there another way?Try it first and look at your task manager if it is the case ! AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
Hellooopsforgotsendcommand Posted September 16, 2010 Posted September 16, 2010 wow, thanks! if this consumes alot or memory, is there another way?Tested it and it uses less than 3.6 mb on my system (xp sp2)
wakillon Posted September 17, 2010 Posted September 17, 2010 Tested it and it uses less than 3.6 mb on my system (xp sp2)So it's fine ! AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
somdcomputerguy Posted September 17, 2010 Posted September 17, 2010 It seems to me that a 25 second sleep is way too much. What if it's 24 seconds before the task should be executed? After a 25 second sleep, the task won't be run by this script until the next day.. I'll post a modified version of the earlier posted code. $StartTime = "13:30" While 1 If @HOUR & ":" & @MIN = $StartTime Then ;script code here EndIf Sleep(100) EndIf WEnd - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
Mison Posted September 18, 2010 Posted September 18, 2010 Alternatively, you can use Sleep() to pause your script until the time is right. Less memory consuming, but a bit complicated. #include<Date.au3> $currDate = _NowCalc() ; current date and time ;~ $newDate = "2010/09/18 12:05:00" ; new date and time ;~ $newDate = _NowCalcDate()&" 12:04:00" ; today's date + desired time $newDate = _DateAdd("s", "15", _NowCalc()) ; newDate is set to be 15 seconds from now. $diff = _DateDiff("s",$currDate,$newDate) ; Calculates the difference in seconds between $currDate and $newDate. Sleep($diff*1000) MsgBox(0,"","Activated on - "&_nowCalc()) Hi ;)
russell Posted September 23, 2010 Author Posted September 23, 2010 Alternatively, you can use Sleep() to pause your script until the time is right. Less memory consuming, but a bit complicated. #include<Date.au3> $currDate = _NowCalc() ; current date and time ;~ $newDate = "2010/09/18 12:05:00" ; new date and time ;~ $newDate = _NowCalcDate()&" 12:04:00" ; today's date + desired time $newDate = _DateAdd("s", "15", _NowCalc()) ; newDate is set to be 15 seconds from now. $diff = _DateDiff("s",$currDate,$newDate) ; Calculates the difference in seconds between $currDate and $newDate. Sleep($diff*1000) MsgBox(0,"","Activated on - "&_nowCalc()) Wow talk about above and beyond. Thanks! muppet hands are so soft :)
Mison Posted September 24, 2010 Posted September 24, 2010 Wow talk about above and beyond. Thanks!It is my pleasure. Hi ;)
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