A macro is a series of DPlot commands that you can group together to automate certain tasks. Macros are especially useful in performing common operations on a group of files. The macro editing window is shown below:
The name of the macro currently displayed in the text box is shown at the top of the window.
The text box shows a series of macro commands. Macro commands may be preceded by one or more spaces or tabs. (To enter a tab in the text box, press CTRL+TAB). Each line may contain only one macro command.
Comments may be included in a macro by preceding the text with an apostrophe. DPlot ignores comments when the macro is run. If the first non-space, non-tab character in a line is an apostrophe, or if the first 3 characters are "REM", the entire line is ignored. End-of-line comments are allowed using a leading apostrophe. Blank lines or lines consisting entirely of spaces and/or tabs are ignored.
|Select the Run button to send the macro commands to DPlot.|
|Select the Step button to single-step through a macro, pausing after each command is processed. This feature might be useful for debugging a macro.|
|Select the Stop button to terminate macro processing. Note: Most macros are completed in such a short time that the Stop button will usually be ineffective unless you are single-stepping through a macro with the Step button.|
|The Save button is used to save the contents of the macro to a file, and to update the contents of DPlot's settings file so that it will be aware of the location and filename for the macro. Filenames are automatically generated by the macro editor, and the macro files are placed in the \MACROS folder below the Application Data\DPlot folder.|
It is not necessary to save a macro in order to run it from the Macro editor. However, if you want to use the macro in the future, you must save it.
If you make changes to a macro, the editor will prompt you to save it before opening a new macro or exiting the macro editor.
|Select the Print button to print the contents of the text box to the default printer (set with Control Panel).|
|Select the Cut button to remove selected text and put it on the Clipboard.|
|Select the Copy button to copy the selected text to the Clipboard.|
|The Paste button inserts a copy of the Clipboard contents at the insertion point, replacing the selection (if any) with the text on the Clipboard|
|Select the Find button to search the text box for a word or phrase.|
|Select the Help button to display Help for the macro command found at the insertion point. If the insertion point is not at a macro command, selecting the Help button (or pressing F1) brings up this Help topic.|
The Shortcut list box allows you to select a keystroke combination which will automatically run the macro from within DPlot. Before saving the macro, the editor checks the selected shortcut against any existing shortcuts for other macros, and displays an error message if a conflict exists.
To copy all or a portion of one macro to another:
|•||Select the text of the source macro, either by pressing the Shift key in combination with the arrow keys, or by dragging the mouse over the text you want to copy.|
|•||Press Ctrl+C or click on the Copy button.|
|•||Switch to DPlot and select the Macro command from the File menu. Enter a name for a new macro or select an existing macro to edit.|
|•||Click on the Edit/Create button, launching the Macro Editor.|
|•||In the Macro Editor window, move the cursor to the desired location, then press Ctrl+V or click on the Paste button.|
The mechanism used to run macro commands is very similar in function to the methods outlined in Sending data to DPlot from another application. Both methods use Dynamic Data Exchange (DDE) to send commands to DPlot. Macros have the following advantages over the "another application" method:
|•||Macros do not require the user to possess a programming language that supports DDE (such as Visual Basic) or a third party application that allows DDE commands (e.g. Microsoft Word or Microsoft Excel).|
|•||Macros can be activated by shortcut keys.|
|•||Online Help is more readily available for macros.|
However, the Visual Basic environment, as well as that of other DDE-aware applications, may provide you with features that are not possible to implement in macros. For example, it is relatively easy to build a Visual Basic application which generates data points and to then send those data values to DPlot.
For a list of all available macro commands, see Executing DPlot commands from another application.