Navigation:  Programmer's Reference > Sending data to DPlot from another application >

Directory macro command

Print this Topic Previous pageReturn to chapter overviewNext page

Macro commands may be used either in macros or by sending the commands to DPlot via dynamic data exchange (DDE). Some commands are valid only in macros (noted by Macros Only). Commands sent to DPlot via DDE must be enclosed by square brackets [     ]. Macro commands should not include the brackets.

Command parameters shown in the descriptions below are placeholders for the actual values. Command parameters are either numeric values, equations that evaluate to numbers, or character strings. Character string parameters are always bound by double quotation marks. Equations must be preceded by an equals sign (=).

The pipe symbol (|) in the command syntax indicates that a parameter is optional, and should not be included in your macro unless otherwise noted.

All indices into arrays are 1-based, e.g. Curve1=1 refers to the first curve in a plot.

A 0x prefix for numbers in the descriptions below indicates hexadecimal notation; e.g. 0x0010 = 16.

JR/Viewer indicates that the command is supported by DPlot Jr or DPlot Viewer.
JR/Viewer indicates that the command is NOT supported by DPlot Jr or DPlot Viewer.


Directory("dir")] or

JR   Viewer

Sets the directory for all subsequent FileOpen and FileSaveAs operations. If the filenames used in a FileOpen or FileSaveAs command begin with a drive letter or backslash (\), the Directory entry is ignored. You can specify a relative path in FileOpen and FileSaveAs commands by including the desired relative path, but not a leading backslash. For example:

Directory("c:\my data")


will save the current plot to the file c:\my data\test123\gage001.grf, assuming the test123 subdirectory exists.

Valid code's are:

0        Set to My Documents\DPlot

1        Set to the last folder that was used in a manual File>Open or File>Append menu command.

2        Set to the last folder that was used in a manual File>Save As menu command.

If the "dir" entry is two consecutive quotation marks, as in Directory(""), or completely omitted (Directory()) the default directory is set to My Documents\DPlot.

Please note: This setting persists only during the current DDE conversation, and will be reset to the previous default folder on subsequent conversations. All commands in a single macro are executed during the same conversation. But DPLOTLIB's DPlot_Command function starts a new conversation on each call. So this:

DPlot_Command("[Directory(\"c:\\my data\")]");


will save the file to <default folder>\test123\gage001.grf.

The dir parameter may include the shortcuts |DPLOTDRIVE|, |DPLOTPATH|, or |DPLOTDOCS| to set the working directory to the drive or full path where DPlot is installed or, for |DPLOTDOCS|, to My Documents\DPlot. All forms must be uppercase and be surrounded by the pipe symbol (|) or will be ignored. Please note that the |DPLOTPATH| destination folder may not be acceptable for output with non-admin accounts on Windows XP and all accounts on Windows Vista and newer versions, depending on where DPlot is installed.

For example:


sets the working directory to the path where dplot.exe (or dplotjr.exe or dplotvu.exe) are installed.

The trailing colon will be included with |DPLOTDRIVE|; similarly the trailing backslash will be included with |DPLOTPATH| and |DPLOTDOCS|. The drive letter and colon are included in |DPLOTPATH|; there is no need to use, for example, "|DPLOTDRIVE||DPLOTPATH|".


Please note:

Character string arguments require a bit of care, depending on your development environment. Character string arguments in all DPlot commands are always enclosed by double quotation marks. In some environments (Visual Basic and all flavors of C, for example), double quotation marks are also used to delineate all character strings (including the command itself). The following example will always cause a syntax error in Visual Basic:

ret = DPlot_Command(docnum,"[FileOpen("myfile.grf")]")

Instead, use:

ret = DPlot_Command(docnum,"[FileOpen(""myfile.grf"")]")

in C, C++, C# you'd accomplish the same thing with:

ret = DPlot_Command(docnum,"[FileOpen(\"myfile.grf\")]");

If a character string argument is a variable, as in (VB):

Dim arg as string
arg = "myfile.grf"

... then you can build the command in VB as:

ret = DPlot_Command(docnum,"[FileOpen(" & chr$(34) & arg & chr$(34) & ")]")

In all flavors of C, the same can be accomplished with

char arg[256];
char cmd[512];
ret = DPlot_Command(docnum,cmd);

This does not apply to the DPlot macro editor, in which each line is by definition a character string and does not require delineators, nor to FORTRAN and possibly other languages, in which the delineator for character strings is a single quote, e.g. '[FileOpen("...")]'

To embed a double quotation mark within a character string which is itself delineated by double quotation marks, use the Symbol font equivalent instead. For example, "Radius=6{\s²}" inches will be processed as





Page url: