To develop scripts within DIAdem you must have either DIAdem Advanced or Professional versions. If you have DIAdem Base you can only run scripts from within the DIAdem environment. You can use scripts to automate processes within DIAdem, create custom DataPlugins for your data, build interactive user dialog boxes, add custom analysis functionality, and even modify the appearance of DIAdem. The DIAdem script editor uses a built-in VBScript host . You can either manually write a program in the script editor or you can use the recording mode to capture your actions in DIAdem which will then generate the script automatically.
Using the recording mode is the easiest way to create a script. DIAdem records the commands for each interactive step you execute. You can edit, test, and extend the recorded script. To record a script, click the Enable Recording Mode button ( ) on the toolbar. In the recording mode, your actions are recorded in the script editor. Common actions are loading data, executing calculations, populating a report template with data and exporting the report to share with colleagues. After you have finished your routine you wish to automate, you end the recording by clicking the Disable Recording Mode button ().
VBScript is a full scripting language developed by Microsoft. VBScript can handle commonly used programming constructs such as control structures, procedures, variables, etc. The script will be color coded to help distinguish between comments, commands and variables.
DIAdem has many features to help as you develop your script. You can use functions such as CodeCompletion, bookmarks, restoring, and find and replace, to make script editing easier. If you enter the name of an object and complete the entry with a dot, the script editor offers the properties, and methods that are available for this object as seen in the figure below. As DIAdem 2012 all the panels are object-oriented and the methods and properties are accessible this way.
|Start Script From File|| Expand Groups|
| Enable Recording Mode|
Disable Recording Mode
| Create User Dialog|| Debug|
| Find and Replace |
Go To Line
| Bookmarks On/Off |
*Debugging tools are not included with DIAdem install. You must install the Microsoft Windows Script Debugger to activate the debugging tools. See Debugging Scripts section for more details.
If you finish typing a command and open a parenthesis or position the cursor on a command, variable, or property of an object, the SmartInfo displays the parameters of the command. Click Display Help on This Subject… in the SmartInfo to call the detailed help which goes into full detail about the parameter inputs and return values.
After completing a script that will be used often, you can save even more time by setting up a shortcut key. You can do this on any panel by selecting the DIAdem script icon from the group bar. Here are twelve areas where you can assign scripts to a shortcut key. Right-click on the shortcut key you want and select Predefined Setting and navigate to the completed script. To activate the script while DIAdem is open and the active window press the Shift Key followed by the function key you assign your script to.
DIAdem has integrated debugging tools that allow you to step through your program and catch syntax errors. However, to utilize this functionality, you must first install the Microsoft Windows Script Debugger. If the Microsoft Script Debugger is not installed, the debugging icons on the toolbar will be grayed out. To download the necessary software, go to the Microsoft Download Page and search for Microsoft Script Debugger.
One caveat of the integrated DIAdem debugging tools is that you cannot debug user dialog boxes and DataPlugins. However, you can debug user dialog boxes and DataPlugins with the Microsoft Script Editor by following the steps outlined in this tutorial: Using the Microsoft Script Editor to Debug DIAdem User Dialog Boxes (SUD) and DIAdem DataPlugins.
In some instances you want the end user to interact with DIAdem, to enter certain parameters that may change on each run. To use scriptable user dialog boxes (SUD) you must have DIAdem Advanced or Professional. The SUD utilizes controls such as buttons, entry fields, selection lists or graphics. These controls have unlimited uses which can include loading files, requesting entries, configuring your analysis function(s), etc.
To get started in programming a scriptable user dialog box you can select the Create User Dialog Box toolbar button (). This will bring up the Dialog Editor where you can customize the look and functionality of the dialog box.
1 – Control Toolbar. Select how you want the user to interact with the dialog box.
2 – Dialog Box. Customize the design of your dialog box
3 – Toolbar. Preview and test the SUD in DIAdem and format the dialog box.
4 – Control Properties Configuration Box. Set up events, variables, and customize look of control
Once you have your dialog box you can add call the SUD from the script editor. For tutorials and additional information on how to accomplish this, look at the DIAdem help for Creating User Dialog Boxes.