Follow

How can I copy a map into a new plot document in Surfer Scripter?

This article contains a sample script for copying a map from one plot document window and pasting into another.


To run this script:

  1. Copy the script below, or download the attached BAS file: CopyPasteMaps.bas.
  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. 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. Click Script | Run to run the script.
     

*********

'CopyPasteMaps.bas shows how to copy a map from one
'plot document window and paste into another.

'=============================

Sub Main

'Declare the variable that will reference the application
	Dim SurferApp As Object
	Set SurferApp = CreateObject("Surfer.Application")
	SurferApp.Visible = True

'Declares Plot as an object
	Dim Plot As Object
	Set Plot = SurferApp.Documents.Add

'Creates a contour map and assigns the map frame to the variable "MapFrame"
	Set MapFrame1 = Plot.Shapes.AddContourMap(GridFileName:=SurferApp.Path+"\samples\demogrid.grd")

'Selects MapFrame 1
	MapFrame1.Select

'Copies the selection
	Plot.Selection.Copy

'Declares Plot as an object
	Dim Plot2 As Object
	Set Plot2 = SurferApp.Documents.Add

'Creates a contour map and assigns the map frame to the variable "MapFrame"
	Set MapFrame2 = Plot2.Shapes.AddContourMap(GridFileName:=SurferApp.Path+"\samples\demogrid.grd")

'Positions MapFrame2 on the page
	MapFrame2.Left = 1
	MapFrame2.Top = 5.5

'Pastes the contents of the clipboard and assigns it to the variable "MapFrame3"
	Dim MapFrame3 As Object
	Set MapFrame3 = Plot2.Shapes.Paste(Format:=srfPasteBest)

'Positions the copied MapFrame3 on the page
	MapFrame3.Left = 1
	MapFrame3.Top = 10.75

End Sub

 

Updated October 10, 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.