This article contains a sample script for saving and exporting an open file to the same file name.
To run this script:
- Copy the script below, or click here to download the BAS file: save and export.BAS
- In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Grapher 13.
- Double click on Scripter.exe to launch Scripter.
- Press Ctrl+A to select all of the existing lines then press Delete.
- 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.
- Click Script | Run to run the script.
- Copy the script below.
- Open Grapher and turn on the Script Manager by clicking View | Display | Script Manager.
- Press Ctrl+A to select all of the existing lines in the Script Manager and then press DELETE.
- Press Ctrl+V to paste it into the Script Manager.
- Click the Start/Resume icon ( ) in the Script Manager.
'Uses the existing open window 'Saves to existing format and exports to PDF and PNG Sub Main 'Create Grapher as an Object Dim Grapher As Object 'Start Grapher Set Grapher = CreateObject("Grapher.Application") 'Make Grapher visible Grapher.Visible = True 'Get the current plot window Set Plot1 = Grapher.Documents.Active 'Save file to existing name Plot1.Save 'Exports file to PDF with same name and location as plot - uses defaults Plot1.Export2(Left(Plot1.FullName,Len(Plot1.FullName)-3) + "pdf",False,"Defaults=0",True,"pdfv") 'Exports file to PNG with same name and location as plot - uses defaults Plot1.Export2(Left(Plot1.FullName,Len(Plot1.FullName)-3) + "png",False,"Defaults=0", True, "png") End Sub
Updated September 24, 2018