I have multiple versions of Surfer installed. How can I specify in my script which version to use?

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:

  1. Copy the script below, or download the attached BAS file: Which Surfer Version.bas.
  2. In a Windows Explorer window, navigate to C:\Program Files\GoldenSoftware\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.  


'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 September 13, 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.