This article contains a sample script for selecting all plots or all axes in the open Grapher window and changing visibility. Prompts for plot or axes and visible or invisible.
To run this script:
- Copy the script below, or click here to download the BAS file:Select all plots or axes and change visibility.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.
Sub Main 'Create Grapher as an Object Dim Grapher As Object 'Start Grapher Set Grapher = CreateObject("Grapher.Application") 'Make Grapher visible Grapher.Visible = True 'Use the existing plot Set Plot1 = Grapher.Documents.Active 'Prompt for axes or plots Begin Dialog UserDialog 350,203 ' %GRID:10,7,1,1 Text 20,14,330,21,"Do you want to select all axes or all plots?",.Text1 OptionGroup .Group1 OptionButton 70,49,90,14,"Axes",.OptionButton1 OptionButton 180,49,90,14,"Plots",.OptionButton2 Text 20,91,270,21,"Turn object visibility on or off?",.Text2 OptionGroup .Group2 OptionButton 70,126,90,14,"On",.OptionButton3 OptionButton 170,126,90,14,"Off",.OptionButton4 CancelButton 130,154,90,21 OKButton 20,154,90,21 End Dialog Dim dlg As UserDialog Dialog dlg 'What was selected in dialog? If dlg.Group1 = 0 Then 'This would be Axes selected 'Change visibility of all axes For i = 1 To Plot1.Shapes.Count If Plot1.Shapes.Item(i).Type = grfShapeGraph Then For j = 1 To Plot1.Shapes.Item(i).Axes.Count If dlg.Group2 = 0 Then 'This would be turn visibility on Plot1.Shapes.Item(i).Axes.Item(j).Visible = True End If If dlg.Group2 = 1 Then ' this would be turn visibility off Plot1.Shapes.Item(i).Axes.Item(j).Visible = False End If Next End If Next End If If dlg.Group1 = 1 Then 'This would be Plots selected 'Select all plots For i = 1 To Plot1.Shapes.Count If Plot1.Shapes.Item(i).Type = grfShapeGraph Then For k = 1 To Plot1.Shapes.Item(i).Plots.Count If dlg.Group2 = 0 Then 'This would be turn visibility on Plot1.Shapes.Item(i).Plots.Item(k).Visible = True End If If dlg.Group2 = 1 Then ' this would be turn visibility off Plot1.Shapes.Item(i).Plots.Item(k).Visible = False End If Next End If Next End If End Sub
Updated September 24, 2018