This article contains a sample script for specifying what version of Surfer to use to run a script. By default, Surfer will use whichever version was opened last on the computer.
To run this script:
- Copy the script below, or download the attached BAS file: Which Surfer Version.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.
'Which Surfer Version.bas shows how to specify which version of Surfer to use to run the script. 'By default, Surfer will use whichever version was opened last on the computer. '================================== Sub Main 'Open Surfer 12 and use that instance to run the script Shell "c:\program files\golden software\Surfer 12\Surfer.exe" Wait 4 Dim SurferApp As Object Set SurferApp = GetObject(,"Surfer.Application") SurferApp.Visible = True Dim Plot As Object Set Plot = SurferApp.ActiveDocument 'Declares MapFrame as Object Dim MapFrame As Object 'Creates a contour map and assigns the map frame to the variable "MapFrame" Set MapFrame = Plot.Shapes.AddContourMap(GridFileName:=SurferApp.Path+"\Samples\demogrid.grd") End Sub
Updated February 13, 2017