Yes, you can write a script for looping through the process of gridding, contouring, and printing out separate data files that are saved with consecutive names (i.e. datafile1.dat, datafile2.dat, etc). A sample script demonstrating this is shown below.
To run this script:
- Copy the script below, or download the attached BAS file: Loop-ConsecutiveDataFileName.bas.
- In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Surfer 16.
- Double click on Scripter.exe to launch Scripter.
- Press Ctrl+A to select all of the existing lines then press Delete.
- If you copied this script, press Ctrl+V to paste it into Scripter. If you downloaded it, click File | Open, select the BAS file from your downloads directory, and click Open.
- Click Script | Run to run the script.
Sub Main Dim SurferApp As Object Set SurferApp = CreateObject("Surfer.Application") SurferApp.Visible = True 'This starts a loop to grid, contour, and print out 5 separate data files 'that have consecutive names such as datafile1.dat, datafile2.dat, etc. For i = 1 To 3 'Opens a new plot document Dim Plot As Object Set Plot = SurferApp.Documents.Add 'Specifies the path to the data file Path = "c:\temp\SAMPLE"+Format(i) 'Create a grid from the data file SurferApp.GridData(DataFile:=Path+".DAT", OutGrid:=Path+".grd") 'Creates a contour map from the grid file Dim Map As Object Set Map = Plot.Shapes.AddContourMap(GridFileName:=Path+".grd") 'Prints the plot document Plot.PrintOut Next i End Sub
Updated March 20, 2018