Navigation:  Programmer's Reference > Executing DPlot commands from another application >

FileSaveAs 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 or character strings; character string parameters are always bound by double quotation marks.

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.


 

[FileSaveAs(type,"filename")]
or
[FileSaveAs("Plugin Description","filename")

JR   Viewer

Saves the document to filename as:

Type

 

Format

1

 

DPlot file

2

 

ASCII data, selected curve only

4

 

Comma-separated values

5

 

Unformatted data, selected curve only

14

 

Tab-separated values

15

 

Compressed DPlot file

4096

 

Windows metafile

4097

 

Windows enhanced metafile

For more information on the file types see the description of the Save As menu command. If the "Plugin Description" form is used, the descriptive string must exactly match the description shown in the File Format dialog box, e.g. "BMP Picture".

Default Filename

If the "filename" argument is left blank or is a filename extension only, the plot title (w/o filename extension) will be used instead. For example, if this macro command:

FileSaveAs("Portable Network Graphics",".png")

 

is used and the plot title (the text appearing in the title bar) is "ex01.grf", then a PNG file named ex01.png will be saved.

Replaceable Parameters
Starting with version 1.9.2.9, the filename may include replaceable parameters that are replaced at runtime by one of the title lines from the plot. |TITLE1| is replaced by the first title line, |TITLE2| by the 2nd, and |TITLE3| by the 3rd. These parameters must be in uppercase. For example, this sequence:

FileOpen("ex01.grf")
FileSaveAs(1,"c:\mydata\|TITLE1|.grf")

Saves the first example plot to the filename "Bicycling Caloric Expenditures.grf" to the c:\mydata folder.

Characters from the replacement string that would be illegal for usage in a filename (\/:*?"<>|) are replaced with an underscore character (_).

Within a macro only, if saving a file that was opened with a FileOpen command (as opposed to ForFilesIn), the filename may include replaceable parameters |PATH|, |FILENAME|, and |EXT|. These will be replaced at runtime by the corresponding elements from the last file opened via FileOpen. For example, this sequence:

FileOpen("sinewave.csv")

FFT()

Activate("FFT")

FileSaveAs(2,"|FILENAME|FFT|EXT|")

reads the file sinewave.csv, performs an FFT on the data and places the results in a new document, activates that new document, then saves the results to the file sinewaveFFT.csv.

Macros Only

If placed in a ForFilesIn... NextFile loop, then only a filename extension, preceded by a dot, is used. Exception: if the file specification contains a | (pipe) symbol (see Replaceable Parameters above), then the entire filename is passed to DPlot as is and the filename extension (if any) should be included.
The filename used to save the document will be identical to the original filename but with the extension specified. If omitted, an extension dependent on the type code is automatically selected:

Type

 

Extension

1

 

.GRF

2

 

.ASC

5

 

.BIN

15

 

.GRFZ

4096

 

.WMF

4097

 

.EMF

Filename extensions must be specified if the "Plugin Description" form is used.

Example:

ForFilesIn("ex*.grf")

       FileSaveAs(4096,"")

       FileSaveAs(1,".new")

       FileSaveAs("BMP Picture",".bmp")

       FileClose()

NextFile

Saves all of the files matching the specification "ex*.grf" as Windows metafiles with the filename extension ".wmf", as DPlot files with the extension ".new", and (if the BMP File Export plugin is present) as RLE-encoded bitmaps with the extension ".bmp".

Example:

ForFilesIn("ex*.grf")

       FileSaveAs("BMP Picture","c:\temp\|TITLE1|.bmp")

       FileClose()

NextFile

Saves all of the files matching the specification "ex*.grf" as RLE-encoded bitmaps in the c:\temp folder with filename equal to the plot title and a ".bmp" extension.

The dimensions and resolution of bitmap image files ("BMP Picture", "JPEG Picture", etc.) may be specified with the SetPluginImageDims command

 

 


Page url: http://www.dplot.com/help/index.htm?filesaveascommand.htm