Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Archived:Getting started with the m language

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

M on Symbian is not maintained and may not run on current Symbian versions. All M articles have been archived.

Article Metadata
Featured Article
10 May
2009

Contents

Introduction

This article is a tutorial that explains how to start developing mobile applications using the m programming language.

m, a scripting language designed specifically for portable devices, is available for Symbian OS through mShell, an application that serves as a virtual machine and an interface for running scripts.

Installation

mShell is available for download here in the form of both a Windows installer (EXE) and a ZIP archive.

Installing the EXE practically extracts the same files available in the ZIP to the installation path. The most relevant files are:

  • library.pdf - documents all the modules and functions that can be used in m
  • reference.pdf - provides an overview of the m language, explains how to make standalone applications and describes how platform security influences development
  • supervisor.pdf - explains how to use the m supervisor and viewer
  • tutorial.pdf - basic information about getting started, installation instructions and a detailed description of the mShell application
  • mShell-S60-3rd.sis or mShell-S60-2nd.sis - the actual shell and runtime
  • mEnvironment-S60-2nd.sis or mEnvironment-S60-3rd.sis - just the runtime
  • mShell-S60-3rd-OS.sis and mShell-S60-3rd-DC.sis - just the unsigned shell without the runtime; OS stands for Open Signed and DC stands for DevCert
  • mEnvironment-S60-3rd-OS.sis and mEnvironment-S60-3rd-DC.sis - just the unsigned runtime; again, OS stands for Open Signed and DC stands for DevCert


Install mShell-S60-3rd.sis or mShell-S60-2nd.sis on your device and you will see the icon in the phone's applications folder, as shown in the following image:

M icon.jpg

Creating and running your first script

m scripts are simple text files saved with the M extension. A common text editor such as Notepad can be used to create such files. When saving such files, in the "Save as type:" option choose "All Files" and save them with the M extension.

m scripts can also be written on the phone, in the mShell. To do this, open mShell, select mShell -> New Script, give your script a name and start writing the code. To save the script, select File -> Save As.

Here are the steps to create and run a classic "Hello, world!" script:

1. In a text editor, write the following code:

print "Hello, world!"

2. Save the file as hello_world.m, for example.
3. Transfer it to your phone.
4. Open mShell and navigate to your m script (hello_world.m) and open it. Select Process -> Go.

The message is displayed, as illustrated in the following screenshot:

M hello world.jpg

Creating a standalone application

Here are the steps for creating a simple SIS file from your script:
1. Open the script in mShell.
2. Select Process -> Compile. An m executable (MEX) file will be generated.
3. Go to http://www.m-shell.net/make-sis.aspx and submit the MEX file. Click the Add Files button and add the information you feel is required (for the purpose of this simple tutorial, we will leave those fields unmodified).
4. Click the Create SIS button.
5. Download and install the SIS file.

Using the console functionality

The mShell comes with a console interface designed for quick tests. It can be accessed through mShell -> New Shell and is illustrated in the following image:

M shell.jpg

Setting permissions

Certain operations are considered delicate and thus require that certain permissions be enabled by the user. This can be done by opening mShell, selecting mShell -> View -> Permissions and setting the necessary permissions to "Yes".

Additional information

The primary source of information about m and mShell is the m-shell website. There you can find complete online documentation (the same information that is in the PDF documents that are downloaded with the package).

This page was last modified on 30 May 2013, at 02:44.
416 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×