This article provides a script snippet for loading a graph with a template and then changing the worksheet for a plot using Grapher's Scripter program.
When loading a template from a script, only one worksheet can be named in the Open command. After the template is opened, each curve can be selected and the worksheet used can be changed. This example shows how to load the template with one worksheet and change the worksheet for one curve. The first curve ("Line/Symbol Plot 1") will still use the worksheet named in the Open command line.
'Opens Template Set Plot = GrapherApp.Documents.Open (c:\path\filename.grt", "c:\path\filename.dat") 'Change worksheet of curve 2 Dim Graph1, Line2 As Object Set Graph1 = Plot.Shapes.Item("Graph 1") Set Line2 = Graph1.Plots.Item("Line/Scatter Plot 2") Line2.worksheet = ("c:\path\filename2.dat")
Updated December 18, 2017