PPCGeeks Forums HTC Arrive HTC HD2 HTC Thunderbolt HTC Touch Pro 2 HTC Evo 4G HTC Evo 3D Samsung Galaxy S II Motorola Droid X Apple iPhone Blackberry
Go Back   PPCGeeks > Windows Mobile > WM HTC Devices > HTC Touch Pro
Register Community Search

Notices


Reply
 
LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old 04-22-2009, 01:15 PM
apinkel's Avatar
PPCGeeks Regular
Offline
Pocket PC: Sprint HTC Touch Pro
Carrier: Sprint
 
Join Date: Dec 2008
Posts: 181
Reputation: 125
apinkel is keeping up the good workapinkel is keeping up the good work
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Re: email notification changes

I'll post it tonight when I get home.
Reply With Quote
  #12 (permalink)  
Old 04-22-2009, 10:41 PM
apinkel's Avatar
PPCGeeks Regular
Offline
Pocket PC: Sprint HTC Touch Pro
Carrier: Sprint
 
Join Date: Dec 2008
Posts: 181
Reputation: 125
apinkel is keeping up the good workapinkel is keeping up the good work
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
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)
Reply With Quote
This post has been thanked 1 times.
Reply

  PPCGeeks > Windows Mobile > WM HTC Devices > HTC Touch Pro


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -4. The time now is 01:19 AM.


Powered by vBulletin® ©2000 - 2025, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.6.0
©2012 - PPCGeeks.com