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.
- 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.
- Change the file path and file name in the Shell line to the installation directory for the desired version of Surfer.
- 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
Comments
0 comments
Please sign in to leave a comment.