Websites Navigation: Airbit | Shop | m-shell.net
Languages: EN | DE

A Sample Script

Once m has been activated, it will show you the list of installed scripts and modules.

   
Series 60 sample screen
UIQ sample screen

A script is like an application you can run. As an example, let's open the Partytime script:

Series 60:Navigate to Partytime and press the confirm button.
UIQ:Select Partytime with the pen.

This will show the script's empty console. To start the script:

Series 60:Press the confirm button again.
UIQ:Press the button.

   
Series 60 sample screen
UIQ sample screen

The script runs and prints Waiting... on the console. Now have a friend send you an SMS with the text "party". After a few seconds she should automatically receive a reply from you, sent from the Partytime script. In fact, the script acts as a very simple automatic SMS service.

Stop the script by selecting Process→Stop. You have just successfully used your first m script!

You can look at the script by selecting Process→Edit Source.

   
Series 60 sample screen
UIQ sample screen

If you want to change the reply message, or the text triggering the reply, simply edit the script. File→Save & Go will start the script again, with your changes. See section * () for details.

For your convenience, the complete script is printed here, with comments added:

/*
  A very simple m SMS service:
  anybody sending the keyword "party"
  will get a standard reply.
*/
use sms                            // we need it
r="The party starts at 8pm!";      // our standard reply
while true do                      // loop forever
  print "Waiting...";              // let the user know
  n=sms.receive(); m=sms.get(n);   // get the next msg
  t=lower(trim(m["text"]));        // isolate the word
  if t="party" then                // if it's party,
    sms.send(m["sender"], r);      // send the reply
    print "Replied to",m["sender"] // and log it
  end
end


© 2004-2010 airbit AG, CH-8008 Zürich
Document AB-M-TUT-869
mShell Home  > Documentation  > Manuals