Scripting Overview

ActiveX scripting is a key technology in the Data Master 2003. This software utilizes scripts to implement its standard functionality as well as to add new user-defined features. In fact, a simple mathematical operation or data acquisition application requires several dozens of lines of easy-to-understand VB code and may be created in hours even if you are not a professional programmer. At once, this technology has virtually no restrictions. With additional ActiveX controls accessed from scripts your application may be as complex as you need. DM2003 software supports standard language engines preinstalled with any copy of Windows operating system or Internet Explorer browser.

Features based on scripting technology:

VBScript or JavaScript?

Frankly speaking, this paragraph should be titled "Why VBScript?". Although two standard language engines, namely vbscript.dll and jscript.dll are installed on any Windows system, in fact, DM2003 uses VBScript as a primary scripting language. There's a nice article on the MSDN that discusses advantages and shortcomings of every language. In particular for DM2003, following VBScript features tip the scales:

User Action Example

1. Use Help|Wizards|Action Wizard in the Script Editor to create following code:

'//////// MyTestAction Action /////////

const MyTestAction_Caption="My Test Action"
const MyTestAction_Hint="Displays active document caption"

sub MyTestAction_OnExecute
  '<put sub body here>
  MsgBox Server.ActiveDocument.WindowCaption
end sub

function MyTestAction_OnUpdate
  MyTestAction_OnUpdate=dmuaVisible '<-modify this code
  if Server.DocumentCount>0 then
  end if
end function

2. Now save script to the disk file (or place it somewhere on the web) and bring up New Action dialog box as described in the help on Customize Menu and Toolbars dialog box.

3. Select "HTML/Scripting action provider" and click "Configure selected provider" button. On the "User Files" tab, click "Add" button and select script file. Click "OK" to save changes.

4. Restart DM2003 and bring up New Action dialog box again. Select "HTML/Scripting action provider" and select MYTESTACTION action from the list of Action IDs. You may also set image and category. Click "OK" to add new action.

5. Drag "My Test Action" from the list of actions ("Actions" tab) onto the toolbar or menu and close dialog.

That's all job! If you made no errors, new menu item (or toolbar button) will display caption of active data window or will be disabled if there's no data windows.

What to do if there's errors in the script file and you see script compilation error message at startup? You can't remove this file until you load into DM2003! Just rename or move the file - if DM2003 couldn't find it, it will be ignored.