Investment Studio > Views > Macros > Editing

When a macro package is selected in the Macro view's package list, the contents of the package are displayed in the editor panel's first page:

The corresponding (leftmost) page tab (above the text window) shows the name of the selected package file, including the filename extension (in the picture above, "resynth.vbs"). If the file has been modified since it was last saved, the filename is followed by an asterisk (as in "resynth.vbs*"). The "Active macros" page shows the contents of all active packages and is read only; you can copy text from it, but not modify its contents (other than indirectly, by modifying an active package).

The status bar below the text window shows the edit cursor's position in row:column form, whether it's in insert or overwrite mode (click Ins to toggle mode) and the selected engine's status (connected and idle, as in the picture, is normal).

The editor panel can be vertically resized by dragging the empty space which separates it from the spreadsheet panel below it. It can be horizontally resized by dragging the empty space which separates it from the package list.

The text window

The text window works much like the text window in an ordinary Notes object. To move around the text, you can use the scroll bars, the mouse (click to place the edit cursor; drag to select a text section) and the following keystrokes:

Up Arrow Move edit cursor up one row.
Down Arrow Move edit cursor down one row.
Left Arrow Move edit cursor left one character.
Right Arrow Move edit cursor right one character.
PgUp Scroll up one frame. Move edit cursor to corresponding position in new frame.
PgDown Scroll down one frame. Move edit cursor to corresponding position in new frame.
Home Move edit cursor to start of row.
End Move edit cursor to end of row.
Ctrl+Up Arrow Scroll up one row unless edit cursor would end up outside frame.
Ctrl+Down Arrow Scroll down one row unless edit cursor would end up outside frame.
Ctrl+Left Arrow Move edit cursor left one word.
Ctrl+Right Arrow Move edit cursor right one word.
Ctrl+PgUp Move edit cursor to top row in frame.
Ctrl+PgDown Move edit cursor to bottom row in frame.
Ctrl+Home Move edit cursor at and scroll to start of file.
Ctrl+End Move edit cursor at and scroll to end of file.

To find and replace, use the pop-up menu's Search section or the following keystrokes:

Ctrl+F Opens a standard Windows Find dialog. Search for a string from the current edit cursor position in specified direction. If a match is found, it's highlighted and (if necessary) brought into view by scrolling the text window.
Ctrl+R Opens a standard Windows Replace dialog. Search (forward) for and replace a string from the current edit cursor position.
F3 Repeat the latest Ctrl+F search.

To cut, delete, copy and paste text, you can use the pop-up menu's Edit section and the following keystrokes:

Ins Toggle between insert and overwrite mode. The current mode is displayed in the status bar.
Del Delete character at current edit cursor position.
Backspace Delete character preceding current edit cursor position.
Ctrl+A Select all text.
Ctrl+X Cut selected text (copy to clipboard, delete from editor).
Ctrl+Y Delete row.
Ctrl+C Copy selected text to clipboard.
Ctrl+V Paste text from clipboard to current edit cursor position.

To undo/redo edits, you can use the pop-up menu's Edit section or the following keystrokes:

Ctrl+Z Undo last edit(s). Uninterrupted sequences of the same kind of operation (e.g. five deletes) are considered a single operation; the entire sequence is undone by pressing Ctrl+Z. You can undo up to ten operations.
Shift+Ctrl+Z Redo, i.e. undo the latest undo. You can redo up to ten undos.

Edits are automatically saved (and the modified file reloaded into the selected engine, if the package is active) whenever the editor loses input focus.

To force a save while editing, click the page tab above the text window.

Syntax highlighting

The most notable difference between the macro editor and ordinary Notes objects is syntax highlighting. If the selected ActiveX Scripting engine supports this feature, the editor will display code elements (identifiers, operators, constants etc., as identified by the engine) according to the font settings specified with the pop-up menu's Setup > Engines > Fonts section:

Clicking any of the entries in the Fonts menu will open a standard Windows font dialog, where you can specify how the editor should display the corresponding code elements.

Note that not all ActiveX Scripting engines support this feature. Since the editor is language-neutral, it must rely on the engine to tell it what's an operator, what's a constant and so on, and not all engines provide this information.