|
12/27/2006, 02:29 AM
|
#1 (permalink)
|
|
Member
Join Date: Jan 2006
Location: Northern Virginia
Posts: 4,362
Thanks: 11
Thanked 88 Times in 33 Posts
|
Fun with MortScript
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.
There is a new version 4.0 available here.
http://www.sto-helit.de/index.php?mo...st&category=17
Documentations is here.
http://www.sto-helit.de/downloads/po...4.0-Manual.pdf
Example:
Code:
#
# 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 02:17 AM.
Reason: point to released MortScript 4.0
|
|
|
12/27/2006, 01:05 PM
|
#2 (permalink)
|
|
Member
Join Date: Jan 2006
Location: Northern Virginia
Posts: 4,362
Thanks: 11
Thanked 88 Times in 33 Posts
|
RunAIM.mscr
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" )
|
|
|
12/27/2006, 04:30 PM
|
#3 (permalink)
|
|
Member
Join Date: Dec 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
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?
|
|
|
12/27/2006, 04:59 PM
|
#4 (permalink)
|
|
Member
Join Date: Jan 2006
Location: Northern Virginia
Posts: 4,362
Thanks: 11
Thanked 88 Times in 33 Posts
|
Sure, but I'm curious why you want to disconnect? EVDO in a dormant state shouldn't eat up the battery.
|
|
|
12/27/2006, 05:05 PM
|
#5 (permalink)
|
|
Member
Join Date: Jan 2006
Location: Northern Virginia
Posts: 4,362
Thanks: 11
Thanked 88 Times in 33 Posts
|
Poutlook folder switching
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 )
|
|
|
12/27/2006, 05:17 PM
|
#6 (permalink)
|
|
Member
Join Date: Oct 2006
Posts: 2,101
Thanks: 17
Thanked 3 Times in 3 Posts
|
hmmm will this find make the BT hack possible for that pretty sound of VC and media player in the moto HS850 headset
|
|
|
12/27/2006, 05:25 PM
|
#7 (permalink)
|
|
Member
Join Date: Jan 2006
Location: Northern Virginia
Posts: 4,362
Thanks: 11
Thanked 88 Times in 33 Posts
|
Quote:
Originally Posted by slingbox
hmmm will this find make the BT hack possible for that pretty sound of VC and media player in the moto HS850 headset
|
No, but Bad Sector over at ppcgeeks is working on this solution.
http://www.ppcgeeks.com/transfer-cal...set-t1559.html
|
|
|
12/27/2006, 05:29 PM
|
#8 (permalink)
|
|
Member
Join Date: Oct 2006
Posts: 2,101
Thanks: 17
Thanked 3 Times in 3 Posts
|
cool.Get ready to be over run with request hannip.I posted a link in ppcgeeks.This thread is going to be pretty long
|
|
|
12/27/2006, 05:53 PM
|
#9 (permalink)
|
|
Member
Join Date: Dec 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
Quote:
Originally Posted by hannip
Sure, but I'm curious why you want to disconnect? EVDO in a dormant state shouldn't eat up the battery.
|
I don't want to chance something else running in the background throwing the EVDO active and eating up battery  Does that make sense?
|
|
|
12/27/2006, 05:58 PM
|
#10 (permalink)
|
|
Member
Join Date: Jan 2006
Location: Long Island, NY
Posts: 6,045
Thanks: 43
Thanked 107 Times in 78 Posts
|
Quote:
Originally Posted by isurus
I don't want to chance something else running in the background throwing the EVDO active and eating up battery  Does that make sense?
|
you'll probably waste more battery/cpu usage having to reconnect/sign in than forcing disconnect. leaving data in dormant uses no battery.
__________________
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
WMExperts: To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. , To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. & To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. + To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|
|
12/27/2006, 07:56 PM
|
#11 (permalink)
|
|
Member
Join Date: Oct 2006
Posts: 2,101
Thanks: 17
Thanked 3 Times in 3 Posts
|
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
Last edited by slingbox; 12/27/2006 at 08:46 PM.
|
|
|
12/27/2006, 08:44 PM
|
#12 (permalink)
|
|
Member
Join Date: Jan 2006
Location: Northern Virginia
Posts: 4,362
Thanks: 11
Thanked 88 Times in 33 Posts
|
Try lowering the sleep from 15000 to 10000 to see if that works better.
|
|
|
12/27/2006, 09:00 PM
|
#13 (permalink)
|
|
Member
Join Date: Oct 2006
Posts: 2,101
Thanks: 17
Thanked 3 Times in 3 Posts
|
Quote:
Originally Posted by hannip
Try lowering the sleep from 15000 to 10000 to see if that works better.
|
after reinstalling file it did the same thing.I will lower the sleep and see what happens
|
|
|
12/27/2006, 09:20 PM
|
#14 (permalink)
|
|
Member
Join Date: Jan 2006
Location: Northern Virginia
Posts: 4,362
Thanks: 11
Thanked 88 Times in 33 Posts
|
5000 seems to work well with keyguard on.
|
|
|
12/27/2006, 10:10 PM
|
#15 (permalink)
|
|
Member
Join Date: Oct 2006
Posts: 2,101
Thanks: 17
Thanked 3 Times in 3 Posts
|
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
Last edited by slingbox; 12/27/2006 at 10:28 PM.
|
|
|
12/27/2006, 10:28 PM
|
#16 (permalink)
|
|
Member
Join Date: Jan 2006
Location: Northern Virginia
Posts: 4,362
Thanks: 11
Thanked 88 Times in 33 Posts
|
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.
|
|
|
12/27/2006, 10:50 PM
|
#17 (permalink)
|
|
Member
Join Date: Oct 2006
Posts: 2,101
Thanks: 17
Thanked 3 Times in 3 Posts
|
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 11:11 PM.
Reason: question
|
|
|
12/27/2006, 11:53 PM
|
#18 (permalink)
|
|
Member
Join Date: Jan 2006
Location: Northern Virginia
Posts: 4,362
Thanks: 11
Thanked 88 Times in 33 Posts
|
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.
|
|
|
12/28/2006, 12:15 AM
|
#19 (permalink)
|
|
Member
Join Date: Oct 2006
Posts: 2,101
Thanks: 17
Thanked 3 Times in 3 Posts
|
1 sec made no diffrence 
Must Have Sleep
Great work hannip  Catch you tommrow
Last edited by slingbox; 12/28/2006 at 12:47 AM.
|
|
|
12/28/2006, 09:22 AM
|
#20 (permalink)
|
|
Member
Join Date: May 2006
Location: Kansas City, Missouri
Posts: 2,806
Thanks: 6
Thanked 46 Times in 14 Posts
|
i'm sorry to be such any idiot, 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.
thanks, cody
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
All times are GMT -4. The time now is 12:51 AM.
|
|