Prev: Compiling m Scripts
The Editor
To write or edit an m script or module, you can use the editor:
To edit an existing script, open it from the script list, then
| Series 60: | Choose . |
| UIQ: | Press the button. |
To edit an existing module, simply open it from the script list.
Only one file can be edited at a time: when loading a file, a previously edited file will be saved.
As an example, open the Partytime script and load it into the editor, as explained above.
 | |  |
| Series 60 sample screen | | UIQ sample screen |
Now replace the text "The party starts at 8pm!" by "Sorry, no party tonight!".
You can start the modified script directly from the editor by
| Series 60: | choosing |
| UIQ: | pressing the button. |
Note that on S60, the confirm button inserts a new line when in the editor.
The editor offers the following menu options:
| Save the file and run the script. |
| Save the file and compile the script. |
| Save the file (optionally changing the name), but stay in the editor. |
| Save the file, and return to the script list. |
| Save the file, then send it (e.g. via Bluetooth or as an e-mail attachment). |
| Discard any changes, and return to the script list. |
| Discard any changes, and delete the file. |
| Rename the file. |
| (S60 only): toggle the view size, showing or hiding the title pane. |
The menu is the same as in the console.
Scrolling
On
S60, clicking the the shift (select) button once enters
pagewise mode: the up and down keys scroll backwards and forward one page at a time. Pressing any other key or clicking the shift button again returns to linewise mode.
On UIQ, the editor offers a vertical scroll bar to quickly move to another part of the source text.
Find and Replace
The editor has a simple find/replace mechanism: opens a dialog where find/replace arguments can be entered. The arguments are:
| Find | The text to search for. |
| Replace | The text to replace the search text with. |
| Find Up | Select whether the initial search direction is up (backwards) or down (forward). |
| Case s. | Select whether the search is case sensitive. |
| Whole w. | Select whether the search only considers whole word matches, ignoring substrings. |
|
To replace all occurences of variable n by variable id in the Partytime script, choose in the editor, then enter the search arguments. Select Whole w., as we only want to find isolated instances of the letter n, not n as part of another word.
 | |  |
| Series 60 sample screen | | UIQ sample screen |
Press to find the first occurence of n. After starting the search, finding the first occurence and selecting it, the editor enters find mode, indicated by the
icon. In find mode, three keys have a special meaning:
| S60 Key | UIQ Key | Meaning |
| Arrow Up | Jog Dial Up | Search backwards for the next occurrence of the find string. |
| Arrow Down | Jog Dial Down | Search forward for the next occurrence of the find string. |
| Confirm | Jog Dial Press | Replace this occurrence, then search for the next occurrence of the find string in the same direction as before. |
|
All other keys leave find mode. Find mode is also left if the find string does not occur in the given direction.
Hence, to replace the next occurence of n by id and search the next occurence,
| Series 60: | press the confirm button. |
| UIQ: | press the Jog Dial. |
 | |  |
| Series 60 sample screen | | UIQ sample screen |
Next: The Properties Dialog© 2004-2011 airbit AG, CH-8008 Zürich
Document AB-M-TUT-887