This article contains a sample script for exporting only the selected objects.
To run this script:
- Copy the script below, or download the attached BAS file: ExportSelectedOnly.bas.
- In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Surfer 14\Scripter.
- 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.
'ExportSelectedOnly.bas opens a selected SRF file, 'selects a map, and exports the single map to the 'specified export file. Sub Main Dim SurferApp As Object Set SurferApp = CreateObject("Surfer.Application") SurferApp.Visible = True ExportFile = "C:\temp\test.jpg" SRFfilepath = GetFilePath( , "srf",SurferApp.Path+"\samples\","Open SRF File",0) 'Opens the SRF file Dim Plot As Object Set Plot = SurferApp.Documents.Open(SRFfilepath) 'Assigns the 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. Dim MapFrame1 As Object Set MapFrame1 = Plot.Shapes.Item(Index:=2) 'Selects the map MapFrame1.Select 'Exports the selected objects only to the specified ExportFile path Plot.Export(FileName:=ExportFile, SelectionOnly:=True) End Sub
Updated February 13, 2017