Script Editor

Use Script Editor to edit, compile and run scripts. Also it should be used to debug simple scripts or automate single use tasks, when you don't wish to make special menu item or toolbar button. In addition, you may explore DM2003 object model and dispatch objects.

Script Editor window

How to use Script Editor?

At a glance, Script Editor window is a "mini-IDE" which has following main elements:

  1. Object Tree - selected object from the Object Tree may be inspected, that is, you may interactively change its properties and invoke its methods with the Dispatch dialog box (Script|Dispatch menu item). Script Editor object represents variables and functions from the script in the Editor (script need to be compiled).

  2. Editor - this is where you edit script code. Use items from the File, Search and Edit menus just like in any text editor. For your convenience, several frequently used commands have appropriate toolbar buttons. Editor implements syntax highlighting features, drag-n-drop editing and has a lot of special keyboard shortcuts.

    Before you will be able to run procedures, you must compile script from the editor (Script|Compile menu command). Also use Script menu to select script language if it is not detected automatically by the file extension (*.js for JScript, *.vbs for VBScript). You may use Action Wizard dialog box (Help|Wizards|Action Wizard) to add code for Scripter.dll Action object (see example for more details).

  3. Procedures drop-down list - click "Run" button (or appropriate menu item) to run selected procedure (only procedures w/o parameters are added to this list on compilation). In addition, you may use "Evaluate" command to inspect global variable or call function. Set timeout (Script|Timeout menu item) to limit total script execution time.

Installing Script Editor

In DM2003, Script Editor is implemented as a separate Action Provider (DMEditor.dll). Keep in mind that Script Editor may be not installed with DM2003 and its installation may require some additional step. Namely, you should create user actions for displaying this window and, optionally, running script and dispatching objects. Invoke New Action dialog box and select "Script Editor provider for DM2003" from the list of installed action providers, then select available actions from the Actions list. After you finish with actions, create appropriate user interface elements (e.g. menu items).

Debugging scripts

Although you can inspect variables and run code, as well as get comprehensive compilation and runtime error diagnostics, Script Editor doesn't support full set of debugging features like breakpoints, step-by-step execution and so on. Instead, you can easily use powerful professional-quality script debuggers available from Microsoft (both free stand-alone Script Debugger utility and Script Editor integrated in the VSE and Microsoft Office). Read documentation on these products how to attach debugger to the DM2003.EXE process and debug script blocks. There's a couple of hints:

Working with HTML

In some cases you may find convenient to use Script Editor for editing HTML code. Click File|New menu item, then select Empty HTML or HTML Applet Wizard to create new HTML document, or just open existing HTML file. Use File|Browse command to copy the contents of the editor directly into DM2003 Browser Window (this command doesn't work until Browser Window have loaded any HTML document, and some HTML features like cookies and linked files are not supported).

Productivity features

Although the development of Script Editor was focused on characteristic features of Data Master 2003 software and does not duplicate existing development tools like MSE/VSE, it includes several functions that help you write your script applications for DM2003. A set of wizards available in Help|Wizards menu assist you with creation of User Actions, event hanldlers, HTML code of ActiveX objects and application templates. Another cool feature is Code Completion (you can activate it by pressing Ctrl+Space somewhere in the editor).

Notice: Code Completion now is in the beta phase, so it is more limited than IntellisenseTM features in VSE. Keep in mind that script languages are typeless, and as a result, it is impossible to determine whether some variable is an object with a set of members or not. Currently static table of identifiers is supported (properties of DM2003 objects that return other objects + table of constants). However, the list of members created dynamically. Future versions of Script Editor will involve "true" source code analyzer so that IdTable will include real set of variables.