Follow

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\Golden Software\Surfer 16.
  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. Change the file path and file name in the Shell line to the installation directory for the desired version of Surfer.
  7. 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

'Initializes Surfer
	Dim SurferApp, Plot, MapFrame As Object
	Set SurferApp = GetObject(,"Surfer.Application")
	SurferApp.Visible = True
	Set Plot = SurferApp.ActiveDocument

'Prints what version of Surfer is open
	Debug.Print SurferApp.Version

'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 November 6, 2018

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.