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

GetPreferences 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.


 

[GetPreferences("filename")]

JR   Viewer

Reads a preferences file (saved with the File>Save Preferences menu command or a SavePreferences macro command). If a path is not specified, the default preferences folder is assumed (%APPDATA%\DPlot\Preferences on Windows 2000 and all newer Windows versions). If a filename extension is not included, ".set" is appended.

|DOCNAME|

If filename contains the text |DOCNAME| (including the enclosing pipe symbol |, and must be uppercase), |DOCNAME| will be replaced by the name appearing in the title bar of the document, minus any filename extension if present. Generally the document title is the name of the first file opened for the document or the name of a DPlot file if you save the document to that format, or Plot1, Plot2, etc. if a file has not been opened or saved. The document title may be changed with a Caption command.

For example if the document caption is [mydata.csv], then:

"|DOCNAME|" will be replaced with "%APPDATA%\DPlot\Preferences\mydata.set"

"c:\folder\|DOCNAME|" will be replaced with "c:\folder\mydata.set"

"c:\folder\|DOCNAME|.pref" will be replaced with "c:\folder\mydata.pref"

 


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];
strcpy(arg,"myfile.grf");
sprintf(cmd,"[FileOpen(\"%s\")]",arg);
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

Radius=6"

 


 

 

 


Page url: https://www.dplot.com/help/index.htm?getpreferencescommand.htm