We strongly recommend keeping only the most recent version of Surfer that you are licensed for installed. However, if a workflow requires you to have multiple versions installed, you can call a specific version via automation.
In most cases, if you have more than one version of Surfer installed, the script will run in the version of Surfer was last opened with administrator rights. So if you have Surfer 12 and Surfer 22 installed, you can open Surfer 12 as administrator, close it, run the script and it will run in Surfer 12. Then open Surfer 22 as administrator, close it, run the script and it will run in Surfer 22.
In some cases, Windows configuration problems will prevent a script from running in one version or the other. In this case, you can try one of these methods:
- Uninstall one of the versions, so you just have one version on the computer.
- Try repairing the installation for the version you want the script to run in.
- Call Surfer using GetObject instead of CreateObject, and it will use whichever version of Surfer is opened on the computer.
- Unregister the version that is being called, and then register the version you want to use. For example,
- Click the Windows Start button and in the Run box enter the filepath to the version of Surfer you want to unregister in quotes, followed by /Unregister. For example: "c:\program files (x86)\golden software\surfer8\surfer.exe" /Unregister
- Then register the version you do want to run by clicking the Windows Start button and in the Run box entering the filepath to the version of Surfer you want to register in quotes, followed by /Register. For example:"c:\program files\golden software\surfer 16\surfer.exe" /Register
You can also use the Shell command in the script to specifically state which version of Surfer to open. For a full script example, see below.
To run this script:
- Copy the script below, or download the attached BAS file: RegisterSurfer.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.
- Press Ctrl+V to paste the script into Scripter.
- Click Script | Run to run the script.
*********
Sub Main 'Open Surfer 16 and use that instance to run the script Shell "c:\program files\golden software\Surfer 16\Surfer.exe" Wait 4 Dim SurferApp, Plot, MapFrame As Object Set SurferApp = GetObject(,"Surfer.Application") SurferApp.Visible = True Set Plot = SurferApp.ActiveDocument '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 2021
Comments
Please sign in to leave a comment.