Follow

I have different versions of Surfer installed. How do I know which version my script will use?

If you have more than one version of Surfer installed, the script will usually use whichever version of Surfer was last opened with administrator rights. So if you have Surfer 8 and Surfer 15 installed, you can open Surfer 8 as administrator, close it, run the script and it will run in Surfer 8. Then open Surfer 15 as administrator, close it, run the script and it will run in Surfer 15.
 

In some cases, Windows configuration problems will prevent a script from running in one version of the other. In this case, you can try one of these methods:

  1. Uninstall one of the versions, so you just have one version on the computer.
  2. Try repairing the installation for the version you want the script to run in.
  3. Call Surfer using GetObject instead of CreateObject, and it will use whichever version of Surfer is opened on the computer.
  4. Unregister the version that is being called, and then register the version you want to use. For example,
    1. 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
    2. 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 15\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:

  1. Copy the script below.
  2. In a Windows Explorer window, navigate to C:\Program Files\Golden Software\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. Press Ctrl+V to paste the script into Scripter. 
  6. Click Script | Run to run the script.
     

*********

Sub Main 
'Open Surfer 15 and use that instance to run the script
Shell "c:\program files\golden software\Surfer 15\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 October 9, 2017

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.