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 you’re about to create. The name should be something that you’ll 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. |
Directory("c:\mydata")
FileType(1)
ForFilesIn("*.grf")
FileSaveAs(4096,"")
FileClose()
NextFile
Directory | sets the default directory (folder). All subsequent file specifications will be relative to this path. |
FileType | tells 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. |
ForFilesIn | allows 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. |
FileSaveAs | saves 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. |
FileClose | Closes the file opened by the ForFilesIn command. |
NextFile | Terminates 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:
https://www.dplot.com/help/index.htm?how_macrosave.htm