I'm surprised that more people don't use MortScript. It is a very useful scripting language for mobile devices. It is freeware and can handle some pretty complex tasks with a few lines of code.
Case in point. I was able to write a simple script to monitor notifications and turn on the led blink when any are active.
MortScript can read and write to the registry, execute programs and subroutines and functions, send keystrokes and mouseclicks to applications, perform file manipulation and a lot more.
#
# NLED.mscr - Monitors notifications and turns on and off the notification LED accordingly.
#
# check dependencies
If ( NOT FileExists( "\Windows\LEDUp.exe" ) )
Message ( "Installation of LEDUp.exe is required! Exiting...", "NLED script" )
Exit
EndIf
# initialize variables
LedOn = FALSE
Notify = FALSE
# start notification check loop
While ( 1 )
# check the registry for any notifications
Notify = RegValueExists( "HKLM", "System\State\Shell\Notifications\Active", "CLSID" )
# turn on the led if any notifications are pending. Keep turning on each iteration since
# the OS turns it off whenever there is a new notification.
If ( Notify )
RunWait( "\Windows\LEDUp.exe", "0 1" )
LedOn = TRUE
EndIf
# turn off the led if no notifications are pending
If ( LedOn && NOT Notify )
RunWait( "\Windows\LEDUp.exe", "0 0" )
LedOn = FALSE
EndIf
# wait 5 seconds
Sleep( 5000 )
EndWhile
People should post useful scripts they write to this thread for others to use. Attached is the above code zipped up. It requires installation of LEDUp.exe also attached. Install MortScript, LEDUp and copy the script to your device. Paste a shortcut of the script to \Windows\Startup to have it start at boot if it works for you.
Edit: Changed sleep to 5 seconds to activate the led before the keyguard puts the device to sleep when locked.
Last edited by hannip; 03/15/2007 at 01:17 AM.
Reason: point to released MortScript 4.0
Do you use AIM UK but are tired of having to manually make a data connection before you can sign in? Try this script to load AIM.
Code:
# RunAIM.mscr - start the default data connection and load AIM
connActive = Connected()
If ( NOT connActive )
Connect( "The Internet" )
EndIf
Run ( "\Windows\Start Menu\Programs\AIM.lnk" )
Hannip, a problem I have with autoupdating on weatherpanel is that it won't disconnect my EVDO after it pulls down information ... is it possible to write a script that can detect such an event and then autodisconnect it?
Here is a simple script that you can assign to a button. I tried it assigned to the side button on my treo 700wx and it works great. If you have AE Button Plus you can assign it to any button.
What this script does is open the mail folders for selection. If tmail isn't active it will launch it first. Before this you had to whip out your stylus to switch folders unless you have WM5 AKU3.0 or later.
Code:
# FolderSwitch.mscr - launches or makes tmail active and sends a
# screen tap to open mail folders.
callTmail = True
current = ActiveProcess()
If ( current eq "tmail.exe" )
callTmail = False
EndIf
If ( callTmail )
Run( "\Windows\tmail.exe" )
Sleep( 5000 )
EndIf
activeWin = ActiveWindow()
MouseClick( activeWin, 10, 10 )
hannip ive noticed the led actavates 50% of the time using keygaurd.
Call comes in then missed.missed call icon apperars keygaurd turns off screen with no led flash.I wait about 2 min wake up screen then led missed call flash starts.
Is there a setting to delay keygaurd from starting giving time for led to start or change in code to speed up led before keylock
UPDATE-It would of helped if I put the MSCR file in the right place
Works perfect
still hit and miss.It may be my treo considering ive been working it to death for the last 5 hours
update 5 sec at 5000 seems to be the keeper Palm always makes it so hard haha
probably need to break up the script. The guts of the while loop needs to be separated out to its own script. That script then would be called in two ways. From a parent script that runs the loop and from the notification queue right before power off. That should catch all cases.
That is your homework assignment. I'll check back in 10 minutes and grade your results.
We have led function in 7 out of 10 test calls.As stated above(needs to be seperated into it,s own loop) will be the answer.PA led comes one 3-5sec after call is missed with screen still on then keygaurd lockdown.Were that comes into play with your build--I dont know What I do know is that my wx is much faster without pa
Update-Question..would it do any good changing to sec 1
Last edited by slingbox; 12/27/2006 at 10:11 PM.
Reason: question
You can try 1 second. It won't hurt anything, tho I'd like to find a better solution. I tried breaking up the scripts, but I'm having trouble setting up the notification queue to run the script before power off. Need to do some research. I'll update once I have it all working.
i'm sorry to be such any *****, but I don't quite understand this script thing. can someone post a link like " scripts for dummies" or something. I would like to better understand it before I start using it.