Follow

How can I print out a list of all SRF files in my directory in Surfer Scripter?

This article contains a sample script for printing a list of all the SRF files in the specified directory with the path and file name.

To run this script:

  1. Copy the script below, or download the attached BAS file: PrintAllSrf.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.
     

*********

'PrintAllSrf.bas prints all the SRF files in the specified directory
' with the path and file name.

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

Sub Main
	Debug.Print "----- ";Time;" -----"
	Set surf = CreateObject("surfer.application")
	surf.Visible = True
	path1 = "c:\incoming\temp\"
	file1 = Dir (path1+"*.srf")

	While file1 <> ""
		Debug.Print path1+file1
		surf.Documents.Open(path1+file1)
		Set plotdoc1 = surf.ActiveDocument
		file1withslashes = ""
		For i = 1 To Len(path1+file1)
			file1withslashes = file1withslashes + Mid(path1+file1,i,1)
			If Mid(path1+file1,i,1) = "\" Then file1withslashes = file1withslashes + "\"
		Next i
		'Debug.Print file1withslashes
		'Set text1 = plotdoc1.Shapes.AddText(1,1,file1withslashes)
		'text1.Font.Size = 8
		plotdoc1.Shapes.AddText(1,1,file1withslashes).Font.Size = 8
		plotdoc1.PrintOut(srfFitToPage)
		plotdoc1.Close(srfSaveChangesNo)
		file1 = Dir() 'get next file
	Wend
	surf.Quit

End Sub

 

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