This article contains a sample script for opening an SRF file and selecting a map for editing.
To run this script:
- Copy the script below, or download the attached file: Open SRF Select Map.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.
'Open SRF Select Map.bas demonstrates how to open an SRF file and select a map for editing. '================================ Sub Main 'Declare the variable that will reference the application Dim SurferApp As Object Set SurferApp = CreateObject("Surfer.Application") SurferApp.Visible = True 'Declares Plot as an object and opens an SRF file Dim Plot As Object Set Plot = SurferApp.Documents.Open(FileName:=SurferApp.Path+"\Samples\Surface.srf") 'Assigns the desired map in the SRF file to the variable "MapFrame1" 'You may need to change the Index number so that the map in the SRF file is selected. 'Count from the bottom in the Contents Window up to the map you want to get the correct Index number of the map. Dim MapFrame1 As Object Set MapFrame1 = Plot.Shapes.Item(Index:=1) 'Changes the tilt for the map MapFrame1.ViewTilt = 16 MapFrame1.ViewRotation = 90 End Sub
Updated November 12, 2018