Command Import

Since Data Master 2003 software is, in fact, application development framework, you may extend basic set of its operations. After you create new functions (as a script or action provider), you need to add new items to the DM2003 user interface. Although users can manually reconfigure menu and toolbars by means of special dialog box, there's two cases where it's highly desirable to automate this process:

The feature that implements required functionality is named Command Import.

How to use Command Import feature?

Let's suppose that you have created new script file (named, for example, applets.vbs) that contains code of some actions and you wish to make setup with appropriate user interface. The process involves following steps:

1.   First, you need to copy this file during installation (e.g. into the <INSTALLDIR>\APPLETS subfolder) and create appropriate registry entry for scripter.dll unit:

[HKEY_CURRENT_USER\Software\RRR\DM2003\Scripter]
[HKEY_CURRENT_USER\Software\RRR\DM2003\Scripter\Files]
"My Actions"="C:\\PROGRA~1\\RRR\\DM2003\\APPLETS\\applets.vbs"

2.   Second, you prepare and include in the installation special file (named, for example, applets.ini) that describes required user interface items. This file may contain following records:

;----------------------------------------------
; New actions from applets.vbs

[Actions]
0=Test1UserAction
1=Test2UserAction

[Test1UserAction]
Provider={673A9FB8-9A0B-11D4-B2A4-FD6847C75367}
ID=TEST1
ImageIndex=2
Category=MyCategory

[Test2UserAction]
Provider={673A9FB8-9A0B-11D4-B2A4-FD6847C75367}
ID=TEST2
Category=File

;----------------------------------------------
; New Custom ToolBar

[ToolBar_0]
Name=CustomToolBar
Caption=Custom ToolBar

;----------------------------------------------
; Main Menu items

[ActionBarItem_0]
ActionBar=ActionMainMenuBar
Caption=Test 1
Action=Test1UserAction
Position=13
RootMenu=File

;----------------------------------------------
; Test submenu

[ActionBarItem_1]
ActionBar=ActionMainMenuBar
Caption=Test
Position=2
RootMenu=Options

[ActionBarItem_2]
ActionBar=ActionMainMenuBar
Caption=Test 1
Action=Test1UserAction
Position=0
RootMenu=Test

[ActionBarItem_3]
ActionBar=ActionMainMenuBar
Caption=-
Position=1
RootMenu=Test

[ActionBarItem_4]
ActionBar=ActionMainMenuBar
Caption=Test 2
Action=Test2UserAction
Position=2
RootMenu=Test

;----------------------------------------------
; Custom ToolBar items

[ActionBarItem_5]
ActionBar=CustomToolBar
Caption=Test 1
Action=Test1UserAction
Position=0

[ActionBarItem_6]
ActionBar=CustomToolBar
Caption=Test 2
ImageIndex=2
Action=Test2UserAction
Position=1

3.   Finally, you need to register this INI file for use by DM2003. Install special registry key as shown below:

[HKEY_CURRENT_USER\Software\RRR\DM2003]
[HKEY_CURRENT_USER\Software\RRR\DM2003\Data Master]
[HKEY_CURRENT_USER\Software\RRR\DM2003\Data Master\ImportCommands]
"0"="C:\\PROGRA~1\\RRR\\DM2003\\APPLETS\\applets.ini"

Every time when DM2003 starts, it looks for user interface settings remembered in the %AppData%\RRR\DM2003\config.bin file. If this file not found, DM2003 will add contents of applets.ini to the default user interface elements. Keep in mind that you can also register applets.ini under ImportCommandsOnce key; in this scenario, DM2003 will import commands even if config.bin successfully loaded, but the key will be deleted immediately after import. This feature allows you to add new actions programmatically, for example, by visiting special web site.

Notice that if registry value for INI file have no path, installation path will be used. As of build #315, this path also may be an URL. In the build #350 and later, several new possibilities are available: new items may be added to the context (popup) menus, and standard actions may be replaced or deleted using new ImportCommandsAlways key. This key references a set of files which are processed at every startup before all other import files, and its entries affect basic UI infrastructure elements that are not remembered in the config.bin file. Two latter features allow to completely replace standard action provider (scripter.dll) with user-defined implementations. Separate UI items as well as whole menus may be deleted from ActionBars and popup menus. See also some examples below:

;----------------------------------------------
; Notes Toolbar

[ActionBarItem_19]
ActionBar=NotesActionToolBar
Caption=Insert Time
Action=InsertTimeUserAction
Position=8

;----------------------------------------------
; Notes Popup

[PopupMenuItem_2]
ActionBar=NotesFormPopupActionBarEx
Caption=Insert Caption
Action=InsertWindowCaptionUserAction
Position=10

;----------------------------------------------
; DeleteActions

[DeleteActions]
0=CopyAction

;----------------------------------------------
; ReplaceActions

[ReplaceActions]
0=DeleteAction

[DeleteAction]
Provider={673A9FB7-9A0B-11D4-B2A4-FD6847C75367}
ID=ScriptEditor
Category=Script
ImageIndex=8

;----------------------------------------------
; Delete UI items from ActionBars 
; (processed in ImportCommands)

[_ActionBarItem_0]
ActionBar=NotesActionToolBar
Position=0

[_ActionBarItem_1]
ActionBar=MainActionToolBar
Position=1

[_ActionBarItem_2]
ActionBar=ActionMainMenuBar
Position=1

[_ActionBarItem_3]
ActionBar=ActionMainMenuBar
RootMenu=View
Position=5

;----------------------------------------------
; Delete UI items from popup menus 
; (processed in ImportCommandsAlways)

[_PopupMenuItem_0]
ActionBar=NotesFormPopupActionBarEx
Position=1

Also you can ignore information from config.bin (do not load and save it) if you start DM2003.EXE with command line parameter /nouseconfig. Parameter /noloadconfig prevents only load config.bin at startup, as if this file was not found. You may use this parameter to recreate corrupted UI configuration.