![]() |
Re: email notification changes
I'll post it tonight when I get home.
|
Re: email notification changes
Here's the scheduler script. It must be put in the \Windows\Startup folder. It uses the windows mobile notification queue so it does not impact battery life outside of the small amount of processing power to run this script when the event is scheduled to run. Change the events listed in the events array so it runs your script on the schedule you desire.
## Scheduled Events array: ## -The eventID (quoted in brackets []) format is d,hh,mm where... ## d is day of week (0=Sunday, 6=Saturday) ## hh is hour of day (00 to 23) ## mm is minute of hour (00-59) ## -The action (quoted to the right of the equal sign) is "full_path_of_script,parameter", parameters are option schedule["1,08:00"] = "\program files\mortscript\scripts\setvolume.mscr,03" schedule["1,17:00"] = "\program files\mortscript\scripts\setvolume.mscr,12" schedule["2,08:00"] = "\program files\mortscript\scripts\setvolume.mscr,03" schedule["2,17:00"] = "\program files\mortscript\scripts\setvolume.mscr,12" schedule["3,08:00"] = "\program files\mortscript\scripts\setvolume.mscr,03" schedule["3,17:00"] = "\program files\mortscript\scripts\setvolume.mscr,12" schedule["4,08:00"] = "\program files\mortscript\scripts\setvolume.mscr,03" schedule["4,17:00"] = "\program files\mortscript\scripts\setvolume.mscr,12" schedule["5,08:00"] = "\program files\mortscript\scripts\setvolume.mscr,03" schedule["5,17:00"] = "\program files\mortscript\scripts\setvolume.mscr,12" ## ## Initialize Variables and delete the logfile if it's greater than 10KB currTimestamp = Timestamp() currDayOfWeek = FormatTime("w", currTimestamp) currHour = FormatTime("H", currTimestamp) currMinute = FormatTime("i", currTimestamp) currSeconds = FormatTime("s", currTimestamp) startOfWeek = currTimestamp - (currDayOfWeek * 86400) - (currHour * 3600) - (currMinute * 60) - currSeconds script = SystemPath("ScriptPath") & "\" & SystemPath("ScriptName") & SystemPath("ScriptExt") logfile = SystemPath("ScriptExe") & "\scripts\schedulerLog.txt" If (FileSize(logfile) > 10240) Delete(logfile) EndIf WriteFile(logfile, "^NL^currTimestamp=" & currTimestamp & ",Day=" & currDayOfWeek & ",Time=" & currHour & ":" & currMinute & ":" & currSeconds & "^NL^", 1) ## ## Loop thru the scheduled events looking for the action to perform and the next event to schedule currEvent = null firstEventInSchedule = TRUE haventFoundNextEvent = TRUE ForEach event, action in array schedule eventDayOfWeek = Substr(event,1,1) eventHour = Substr(event,3,2) eventMinute = Substr(event,6,2) eventTimestamp = startOfWeek + (eventDayOfWeek * 86400) + (eventHour * 3600) + (eventMinute * 60) If (firstEventInSchedule) ## Initialize the "next event to be scheduled" to next weeks first event nextEvent = event nextEventTimestamp = eventTimestamp + 604800 firstEventInSchedule = FALSE EndIf If (haventFoundNextEvent) If (currTimestamp < eventTimestamp) ## We found the next event so save the event offset so it can be used to schedule the next event nextEvent = event nextEventTimestamp = eventTimestamp haventFoundNextEvent = FALSE WriteFile(logfile, "**Found Next event-->", 1) Else currEvent = event currEventTimeStamp = eventTimestamp EndIf EndIf WriteFile(logfile, "**Loop-event=" & event & ",eventTimestamp=" & eventTimestamp & ",Action= " & action & "^NL^", 1) EndForEach ## At end of loop If a current event wasn't found it means the "current event" is the last event from the prior week If (currEvent eq null) currEvent = event currEventTimeStamp = eventTimestamp - 604800 EndIf WriteFile(logfile, "Curr Event--ID=" & currEvent & ",Timestamp=" & currEventTimestamp & ",action=" & schedule[currEvent] & "^NL^", 1) WriteFile(logfile, "Next Event--ID=" & nextEvent & ",Timestamp=" & nextEventTimestamp & ",action=" & schedule[nextEvent] & "^NL^", 1) ## ## Remove notification queue entry that kicked off this run of the script then add an event to run this script for the next event RemoveNotifications (script) RunAt(nextEventTimestamp, script) ## ## Perform current scheduled action passing the timestamp of the current event as the last parameter scriptToRun = part( schedule[currEvent],",",1 ) scriptParm = part( schedule[currEvent],",",2 ) callscript( scriptToRun , currEventTimeStamp , scriptParm) |
| All times are GMT -4. The time now is 02:43 PM. |
Powered by vBulletin® ©2000 - 2025, Jelsoft Enterprises Ltd.
©2012 - PPCGeeks.com