The best way to learn Scripter and how to write scripts will depend on the individual's particular learning style. I found that the easiest way to learn how to write scripts is to first know what you want to do in the program. Almost anything you can do in the program, you can do in a script, the sequence will be the same. Once you know the sequence of steps you want to perform, the next step is writing the script. For many people, scripting is not something you read about and learn and then perform, the easiest way to learn it is through practice and to delve right in. The best ways to start writing the script are to 1) use the Help menu, and 2) look at example scripts:
1. Using the Help menu
If you click Help | Surfer Automation Help from Scripter, the help file will open. On the Contents page, open the Surfer Automation book. Under this book are two additional books that I frequently use: List of Objects and List of Methods and Properties.
If I want to change something about an object, like changing something about a contour map, open up the Objects book and click on that object (e.g. ContourLayer Object). This shows you everything you can do to that object. If I wanted to do or change anything that is listed there in the Properties or Methods tables, I would just click on the link for the correct syntax and an example to see how to do it. If something I want to do is not listed, like rotating the map, then I need to look above the Properties or below the Methods tables. Above the Properties, I see that it says the ContourLayer object is derived from the Layer object, which is then derived from the Shape object. This means that all the properties and methods that are listed under both the Layer Object and the Shape Object also apply to the ContourLayer Object. If I click on the Shape Object link, you see that Rotation is one of the properties. So you can use this with the ContourLayer object.
However if I want to perform an action, like clicking Home | Grid Data | Grid Data in the program, I would open up List of Methods and Properties and look for something along the lines of "Grid Data" (e.g. GridData3). When I find it, I click on it, and the help topic appears on the right. All the options for GridData3 are here and it gives an example script.
2. Example scripts
Example scripts are also very useful. I usually start with one of the example scripts and then modify it to do the particular actions I need. A number of sample scripts can be found in the \Samples\Scripts\ folder in the Surfer installation directory. You can also find more sample scripts in Surfer Automation knowledge base articles: https://support.goldensoftware.com/hc/en-us/sections/204130857-Surfer-Automation.
- What is the easiest way to learn MapViewer's Scripter? This was written for MapViewer, but the concepts apply to Surfer as well.
- Debugging with Scripter This is a webinar about working with Scripter.
- Scripter and Surfer: Samples, Gridding, Contouring, and Simple Loops This is another webinar about working with Scripter and writing simple scripts.
Updated October 9, 2017