Simple MortScript Programming for Windows Mobile Smartphones
As a proud owner of Sprint's new Palm Treo 800w, I regularly subscribe to the treo|central forum for my phone. Now, there is a common sentiment expressed in PDA/Smartphone forums - not just the one I read. "Is there a one-[touch/button/tap/click] approach I can do to [some function]?" This potential function could be toggling the GPS, killing the current application, terminating all open programs, toggling PowerVision/EVDO/GPRS/EDGE/UMTS/HSDPA, soft resetting, etc. If you're lucky, someone knows of a for-pay program that contains the requested function hidden in an obscure menu. But usually, the bulletin board thread ends with … silence (crickets chirping).
But don't concede yet! Once in a blue moon, if there is a high enough demand, somebody benevolently writes a program and releases it to the forum community. But why wait for that person? "Ask not what the hacker community can do for you. Ask what you can do for the hacker community!" Why not be that benevolent person? If there is not a way, make a way. Program it yourself!
The Keyword is Easy
Now before a reader hits the "X" button in defeat and intimidation, hear (or read) me out. The coding I am referring to is easy! It's even simpler than any variation of BASIC! Plus, when you learn this skill, you'll be able to do so much more with your phone. You'll be able to program for all other phones using Windows Mobile and even computers with nearly every modern version of Windows!
MortScript
Okay, I lied just a little. The language I'm referring to is technically not a programming language. It's more like a glorified batch script. For the web programmers out there, think of it as a hybrid between PHP and a DOS-based batch file. Similar to PHP and DOS, you don’t even compile the code. This code is called "MortScript."
Basically, you download the MortScript interpreter and associate the *.mort and *.mortrun extensions. This is usually done automatically. Write a MortScript with the appropriate file extension and double click – or just plain tap for SmartPhones – the file.
Learning, Observing, and Applying the Skill
"Now how do I learn to code this allegedly simple script?" Like PHP, you read the manual. And – again like PHP – you'll find the manual is so easy to understand with many functions. Also, read the official treo|central Standards/Best Practices for MortScriptMortScript.
If you need inspiration or guidance, I've included a bunch of MortScripts that I personally wrote and use. Use them and assign them to a hardware button so you'll have a one-button access to that script.
Toggle PowerVision/EVDO/GPRS/EDGE/UMTS/HSDPA On:
-
Connect("The Internet")
Toggle PowerVision/EVDO/GPRS/EDGE/UMTS/HSDPA Off:
-
# NOTE: This requires WrlsMgr.exe and may only work with Palm phones.
-
Run( "\Windows\WrlsMgr.exe")
-
SleepMessage(1,"Waiting to Wireless Manager to Open")
-
SendRightSoft
-
SendCR
-
Close(ActiveWindow())
Open the Alarm Program:
-
Run("\Windows\ctlpnl.exe","cplmain.cpl,16,2")
Close the Program on Top:
-
Close(ActiveWindow())
Soft Reset the Phone:
-
# NOTE: This is definitely convenient when the only way to reset is to pull the battery!
-
Reset
Toggle the GPS (Location) On/Off:
-
# NOTE: This may only work with the Palm Treo 800w.
-
Run("\Windows\ctlpnl.exe","cplmain.cpl,20")
-
SleepMessage(2,"Wating on Phone Settings to Open")
-
SendUp
-
SendRight
-
SendDown
-
SendDown
-
SendDown
-
SendCR
-
SendDown
-
SendCR
-
SleepMessage(2,"Wating on Disclaimer to Display")
-
SendLeftSoft
-
SleepMessage(2,"Wating on Disclaimer to Close")
-
SendOK
-
SleepMessage(1,"Wating on Location to Close")
-
SendOK
I'd love to know if any readers know of a better way to do the functions my scripts do. I know most of them utilize a Rube-Golberg-type approach. Also, if you have any questions, remarks, or if you just want to share your MortScript creations, please leave a comment below!