This article contains a sample script for copying a currently open graph to another Grapher window and resizing the graph in the new window.
To run this script:
- Open the Grapher file containing the graph(s) you wish to resize.
- Copy the script below, or download the attached BAS file: Resize Graph.BAS.
- In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Grapher 12\Scripter.
- 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.
'Resize selected objects Sub Main 'Create Grapher as an Object Dim Grapher As Object 'Start Grapher Set Grapher = CreateObject("Grapher.Application") Grapher.Visible = True 'Create a new document window Set Plot = Grapher.Documents.Active 'Set the Shapes object -- this will be used to count the number of objects later Set Shapes = Plot.Shapes 'Loop through all objects on the page looking for a graph For i = 1 To Shapes.Count If Shapes.Item(i).Type = grfShapeGraph Then 'If it finds a graph, change the width and height 'To set a different size, change the numbers in () after .width and .height Shapes.Item(i).width(5) Shapes.Item(i).height(10) End If 'Go to next object Next i 'All graphs have now been changed End Sub
Updated April 14, 2017