How can I save a grid report when using Surfer Scripter?

This article contains a sample script for gridding a sample data file, creating a Grid Report, and saving the grid report.

To run this script:

  1. Copy the script below, or download the attached BAS file: SaveGridReport.BAS.
  2. In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Surfer 15\Scripter.
  3. Double click on Scripter.exe to launch Scripter.
  4. Press Ctrl+A to select all of the existing lines then press Delete.
  5. 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.
  6. Click Script | Run to run the script.


'This script demonstrates:
'	Grid a sample data file
'	Create a Grid Report
'	Save the grid report

Sub Main
'Declare the variable that will reference the application
	Dim Surf As Object

'Creates an instance of the Surfer Application object
'and assigns it to the variable named "Surf"
	Set Surf = CreateObject("Surfer.Application")

'Makes Surfer Visible
	Surf.Visible = True

'Assigns the location of the data and grid files to the variable "Path"
	path1 = Surf.Path + "\samples\"

'Select the data file to grid
	infile= path1+"demogrid.dat"

'Creates a plot document in Surfer and assigns it to the variable "Plot"
	Dim Plot As Object
	Set Plot = Surf.Documents.Add

'Grid the data and include the Grid Report
	Surf.GridData(infile,ShowReport:=True, OutGrid:=path1+"test.grd")

'Control the Grid Report to save the file
	AppActivate "Surfer - GridDataReport"
	Wait 1
	SendKeys "{Menu}+F+S
	Wait 1
	SendKeys "test.rtf + {Enter}"
	Wait 1
	SendKeys "{Menu}+F+C"

'Exits Surfer

End Sub


Updated October 11, 2017

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Please sign in to leave a comment.