Surfer's grid report provides information about a new grid file that is critical to recreating the same results at a later date, if needed. To save the report via automation requires the use of some basic COM automation commands called SendKeys. This sample script below grids a sample data file, creates a Grid Report, and saves the grid report.
To run this script:
- Copy the script below, or download the attached BAS file: SaveGridReport.BAS.
- In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Surfer.
- 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.
- Change the values in the User-defined variables section as desired.
- Click Script | Run to run the script.
'==================================================== 'SaveGridReport.BAS 'This script demonstrates: ' Grid a sample data file ' Create a Grid Report ' Save the grid report '==================================================== Sub Main 'Initializes Surfer Dim Surf, Plot As Object Set Surf = CreateObject("Surfer.Application") Surf.Visible = True Set Plot = Surf.Documents.Add '============================= 'User-defined variables '============================= path1 = Surf.Path + "\samples\" infile= path1+"demogrid.dat" '============================= 'Grid the data and include the Grid Report Surf.GridData(infile,ShowReport:=True, OutGrid:=path1+"test.grd") 'Save the grid report AppActivate "Surfer - GridDataReport" Wait 1 SendKeys "{Menu}+F+S Wait 1 SendKeys "test.rtf + {Enter}" Wait 1 SendKeys "{Menu}+F+C" 'Exit Surfer Surf.Quit End Sub
Updated November 2021
Comments
0 comments
Please sign in to leave a comment.