PDA

View Full Version : MortScritp script trying to fix notification queue bug.


varvocel
1st October 2007, 11:10 AM
Hi,

I'm trying to write script fighting with problems with notification queue. Script is supposed to run MemMaid (which clears duplicate and messed up reminders in queue), sleep given period of time and repeat this procedure (several times a day). While script is in sleep() function device powers off. And here is my problem - sometimes script wakes up PDA, but not always. Another strange thing - I observed that if I run script, wait on device power off - I can then switch device off manually and script works OK.
Here is the source. I don't know much about PDA's suspend mode so maybe it should be written another way or it can't be done. Thank you in advance.

Script:

t=2
// minutes of sleeping only 2 - for testing only
t=60000*t
toggleDisplay(1)
message("Start")
repeat (300)
toggleDisplay(1)
runwait("\windows\MemMaidLauncher.exe","-Q")
sleep(t)
endrepeat

joemanb
4th October 2007, 05:28 PM
what version of mortscript are you using? I'm using v4.01b12 (I think it's up to beta 22 or something), anyway, In my documentation the values for toggle display are (off) and (on), using toggledisplay(on) has never failed for me. another thing you might try, instead of SLEEP, is to rescedule your script to run using RUNAT.

this is the script I use to run weather watcher everyday at 7am:

# Schedule WWupdate to run daily at 7am

# initialize variables
CurrentHour = 0
CurrentMinute = 0
CurrentSecond = 0
CurrentDay = 0
CurrentMonth = 0
CurrentYear = 0

target1 = (SystemPath("ScriptPath") & "\WWupdate.mscr")
target2 = (SystemPath("ScriptPath") & "\SchedWWupdate.mscr")


#Figure out what year, month, and day it is
GetTime ( CurrentHour, CurrentMinute, CurrentSecond, CurrentDay, CurrentMonth, CurrentYear )

If (CurrentHour < 7)
RunAt( CurrentYear, CurrentMonth, CurrentDay, 7, 0, target1)
Rerun = Timestamp()+86401
RunAt( Rerun, target2 )
EndIf

If (CurrentHour > 6)
RunAt( CurrentYear, CurrentMonth, CurrentDay+1, 3, 0, target2 )
EndIf

SleepMessage( 10, "WWupdate set to autorun at 7:00am", "Complete...", 1)

ToggleDisplay(OFF)


Good Luck!

varvocel
4th October 2007, 06:50 PM
Thank you for answer, but I think RunAt function puts task into notification queue so if queue is soiled with buggy reminders our task will never work. Correct me please if I'm wrong.

joemanb
9th October 2007, 04:02 PM
I don't know anything about buggy reminders, but the only way to see if it works is to try it. When someone tells me something doesn't work, I try it anyway, very often I find that the naysayers are wrong. Nothing risked, nothing gained! There are freeware tools to clean the notification queue. I kept having these notifications about 'replog' and 'calnot' and ran one of these tools that fixed the problem. I've never seen or heard of a situation where one notification interfered with another.

varvocel
9th October 2007, 04:38 PM
I don't know anything about buggy reminders, but the only way to see if it works is to try it. When someone tells me something doesn't work, I try it anyway, very often I find that the naysayers are wrong. Nothing risked, nothing gained!


I've tried RunAt and I'm sure it puts task into NQ.


There are freeware tools to clean the notification queue. I kept having these notifications about 'replog' and 'calnot' and ran one of these tools that fixed the problem. I've never seen or heard of a situation where one notification interfered with another.

So you are lucky... I had several cases when NQ had bad entries and any of reminders and scheduled tasks didn't work - so I tried to write script not using NQ for scheduling tasks. I tried many freeware and shareware tools and some of them did a good job, but problems is - how to run them when NQ scheduling doesn't work.

Thanks anyway.