Example Code

DIAdem - Using scripting to perform File Dialog, User Interaction, using Frame Cursor data, and much more!

Code and Documents

Attachment

Introduction

This vbs file is designed to show how DIAdem scripting can be used to do a number of different tasks.

These tasks include

  • Creating a file dialog popup to load .tdm file
  • Allowing User Interaction
  • Using frame cursor data points (X1, Y1) and (X2, Y2)
  • Creating new channels
  • Plotting a vector line connecting the two cursors
  • Creating a file dialog popup to save a new .tdm file

Steps to Complete and run

1) Save the .vbs file and .tdv into the same file location.

2) Load the script file into DIAdem and run the script.

3) Change line 14 to be the folder location where the .vbs and .tdv files are located.

$55F3A8EA6295CED8.jpg

4) Run the script file.

5) Select a .tdm file when the File Dialog popup appears.

6) The view panel shall be displayed.

7) Select channel data, and drag these onto the View Panel. At this point, the data shall be displayed.

😎 Select two cursor positions within the data.

9) Click the end iteraction button under File > End Interaction, or by clicking the hand with the red stop.

red hand.jpg

10) This will produce a messagebox popup that contains the gradient (dY/dX) between the two cursors, (X1, Y1) cursor positions, (X2, Y2) cursor positions

popup.jpg

11) Two new channels are created, storing this cursor data.

12) A new dialog popup will appear to ask you to save the new .tdm file.

screenshot.jpg

Additional Notes

This script was produced in DIAdem 11.0. Have fun!

Ashish Naik
Automotive Business Development Manager
National Instruments UK

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors