Investment Studio > Views > Downloads > Downloader > Script editor
The downloader's script editor is opened by clicking
in
the single item editor. When you do this, several pieces of data are
passed from the item editor to the script editor:
| If an ActiveX Scripting engine is selected in the item editor, the script editor attempts to connect to that engine. If no engine is selected, the script editor tries to connect to the engine used in the previous session. | |
| If a script file is specified in the item editor, the script editor attempts to load it. | |
| If a method name is specified in the item editor, it becomes the script editor's default method name (see below). | |
| Any arguments specified in the item editor become available to the script and to the script editor through the downloader's ActiveX interface. |
Overview
The screenshot below shows a typical editor view at startup:

| The script file's full path is displayed in the window's title bar (here truncated for size reasons). Making changes will cause an asterisk to be appended to the filename until you save your work (to save, press Ctrl+S or use File > Save, File > Save As in the menu). | |
| The default method's name ("Yahoo_URL") is shown in the combo box below the menu bar. Clicking the arrow next to the box will cause this method to be executed. For good measure, you can also run the default method using Engine > Run in the menu, by pressing F9, by double-clicking the method name in the method box or by pressing Enter when the method box has input focus. Click the spin button in the mthod box for a list of recently executed method names. | |
| The script file is loaded and ready to be modified in the text window below the method box. You can open additional files using File > Open in the menu, or create new ones using File > New. Recently lopened files can also be selected at the bottom of the File menu. Each open file gets its own tabsheet, labeled with the filename. Here too, modifying the file causes an asterisk to be appended to the filename ("YAHOO SHARES.JS*") until the file is saved. Use File > Close in the menu to close files and remove tabsheets which you're done with. | |
| 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 scripting engine's status. The fourth panel in the status bar is used to display miscellaneous information about code execution. | |
| The name of the ActiveX Scripting engine ("JScript") is displayed below the text window, as part of a command-line prompt. Enter expressions for interactive execution and evaluation here (just type your expression after the prompt and press Enter). This can be a very useful debugging tool. Among other things, it allows you to query the downloader's ActiveX interface properties and to execute its interface methods. | |
| Note that the command-line field can be resized by dragging the bar which separates it from the text window. When you start using interactive execution, you will probably want to see more lines than the single one shown in the picture. |
The text window works much like the text window in the macros editor. 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 Search menu 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 Edit menu 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 Edit menu 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. |
The Engine menu
With the exception of syntax highlighting, all editor functions related to ActiveX Scripting engines are accessed from the Engine menu:

The top items list all ActiveX Scripting engines known to Investment Studio. The engine being used by the editor (if any) is marked. Clicking another item in this list causes the current engine to be disconnected and a new connection to be established to the selected engine.
Since the engine is responsible for maintaining runtime status information, including variables (but excluding the downloader's ActiveX interface objects, which are maintained by the downloader itself), selecting a new engine also causes an implied Reset. Click Reset to clear all runtime status information (again, except for the downloader's ActiveX interface objects) without switching to a new engine. Note that this also causes the command-line box below the text window to be cleared.
The last command in the menu (Run, with equivalent keystroke F9) is used to execute the default method to be executed.
The three menu items above Run should be handled with care. They are used to Add, Edit and Delete records in Investment Studio's list of available scripting engines.
Use Delete
to disconnect the currently selected engine (marked at
the top of the menu) and remove it from the list of
available engines.
Note that this command does not cause the engine to be uninstalled from Windows. It just causes Investment Studio to forget all about it. |
||
| Use Edit
to modify the currently selected engine's
record. Note that syntax highlighting is controlled separately, from the Fonts menu (see below). |
||
| Use Add to tell Investment Studio about a new engine. |
The Fonts menu (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 settings specified in the Fonts menu:

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.
Occasionally, the engine might get confused when you're editing a piece of code. If the syntax highlighting starts looking funny, click Edit > Highlight in the menu or press Ctrl-H to force a refresh.