Navigation:  How do I ...? > Data Files >

How do I save a collection of files to a different file format?

Print this Topic Previous pageReturn to chapter overviewNext page

You can create a macro to perform one or more operations on each file that matches a file specification:

1)Select the Macro command on the File menu.
2)Under Macro Name, enter a name for the macro youre about to create. The name should be something that youll recognize a week from now when you want to perform this operation again.
3)Click Edit/Create. This will bring up the Macro Editor window.
4)Type the following, replacing bold entries with the appropriate values. Each line is explained below.







Directorysets the default directory (folder). All subsequent file specifications will be relative to this path.
FileTypetells DPlot what format the input files are. File type codes are given here. In this example this command is redundant, since DPlot will quickly determine on its own that the .grf files are DPlot files.
ForFilesInallows you to loop through one or more operations on several files matching the given file specification. In the above example, DPlot will open (one at a time) all files with an extension of .grf in the folder c:\mydata. All ForFilesIn commands must have a matching NextFile command, which terminates the loop. Alternative to providing a file specification, you can tell DPlot to read a list of files from an ASCII text file by using an "@" prefix for the argument. For more information click here.
FileSaveAssaves the open document to a new filename in a different format. In the context of a ForFilesIn loop, only the file extension is used. The 4096 in the above example tells DPlot to save the document as a Windows metafile, with the default extension of .wmf. For more examples click here.
FileCloseCloses the file opened by the ForFilesIn command.
NextFileTerminates the ForFilesIn loop.
5)Click the Run button in the Macro Editor, then close the Macro Editor.

The ForFilesIn command can of course be used for many other operations that you want to perform on multiple files. You might, for example, want to use it to loop through a list of files and change the line and symbol styles in each document before resaving the document. For a complete list of all valid macro commands click here.


Page url: