Script Editor Window


To create and edit scripts, Mira integrates a Script Editor Window that provides context highlighting as well as full editor functionality such as cut/copy/paste, line numbering, formatting, etc. Context highlighting uses different formatting such as fonts and color, to display different aspects of the script syntax. The related Script Manager is an older feature that is more complicated and less flexible than the Script Editor. Whereas the Script Manager has built-in controls the opening, creating, and saving scripts, the Script Editor uses the familiar Windows File > Open, File > New, and File > Save procedures to accomplish there tasks.

Components of the Script Editor

The picture below shows a typical script displayed in the Script Editor Window. This script shows various elements of a script highlighted in their different fashions. The "Language Syntax" elements are also known as "keywords". The keyword collection may be modified by adding or removing words that will be highlighted (see the Edit Script Keywords command.

The toolbar on the top margin of the Script Editor has buttons for common actions, including for executing the script. These toolbar buttons are commonly used by Windows applications, and they have their usual functions.

Menu Commands

When the Script Editor is the active document window in Mira , it loads its own menu bar containing relevant commands. Many of the commands in these menus are are common to all text editors, such as cut, copy, and paste commands. Other features are described in the following table.

View Menu Commands

Word Wrap

Check this option to wrap long lines to the right Editor margin.

Line Numbers

Check this option to show line numbers in the gray margin on the left edge of the Editor window.

Bookmark Margin

Check this option to show bookmarks in a gray book mark margin on the left edge of the window. This margin is different from the Line Number margin.

Folding Margin

Check this option to show a Text Folding margin on the left edge of the Editor window. This margin shows a special symbol that you can click to toggle between folded text and normal text.Folding allows you to show only the beginning of block structures such as for orwhile loops.

Edit Script Keywords

This command opens a dialog for modifying or resetting the list of language keywords that will be highlighted in the editor. See the Edit Script Keywords command.

Initialize Styles

This command resets default values for all syntax styles (see topic below). This is normally useful only if you have changed all the syntax styles in a way that makes the script unreadable. After initializing the styles you will need to recreate your special styles as described below.

 

Syntax Styles

The elements of a script include regular text for function calls, values, etc., as well as keywords of the Lua language, comments, and strings. Each of these syntax components may be highlighted to make it easier to distinguish from the other components. The Script Editor processes each character you enter and formats it accordingly if it matches one of the syntax rules. For example, when one dash, -, is typed, it appears as regular text. But typing a second dash to make '--' begins a comment, which is immediately highlighted in the comment style. The default for comments uses the Comic Sans font in italic form as shown above. The default settings shown above are described in the table below.

Default Syntax Highlighting

Language keywords

Arial font, blue, normal weight.

Note: The set of keywords highlighted by the editor may be modified using the Edit Script Keywords command.

Normal Text

Arial font, black, normal weight.

Numbers

Same font as Normal Text, bold, yellow background.

Strings

Arial font, red, normal weight.

Comments

Comic Sans font, green, normal weight.

 

Changing the Syntax Format

  1. Move the Editor caret (its cursor) onto an example of the syntax element you want to change. You can do this using the mouse or arrow keys.

  2. Right click inside the editor window to open its Context Menu.

  3. In the central section of the context menu, under Set Current Style:, click on Font, Color, or Background to change that element. The change will appear immediately in this Editor window.

  4. Changes you make are saved and will also apply to all future Script Editor windows.

Printing Scripts

To print a script, use the standard method of File > Print or the button. Scripts print in the normal way you print other text from any Windows application software. However, there are two very useful options in the View menu that are described in the following table.

Script Printing Options

Print Syntax Styles

This option controls how your font and color styles will print:

  • Check this option to include the current syntax coloring in your printed script.

  • Uncheck this option to print the entire script in black.

If checked and you print on a non-color printer, the syntax coloring is converted to gray shades.

Print Wrapped Lines

This option controls how long lines are handled by the printer:

  • Check this option to wrap long lines to the printing margins.

  • Uncheck this option to allow long lines to extend beyond the right page margin.

This setting does not affect the view in the Script Editor window.

 

Related Topics

Working with Scripts

Edit Script Keywords

Script Manager

File Event Scripting

 


Mira Pro x64 User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.