The ScriptBuilderThe ScriptBuilder is used to create, modify, execute and save GSL Scripts. The File menu has options to clear the ScriptBuilder (New) to open an old file (Open) and to dismiss the ScriptBuilder (Close). The Gsharp Script Language (GSL) is a very versatile but simple language which can be used to create plots, to read and process data, to print and output plots and to create menu and dialogs. Read more ... The most popular uses of the ScriptBuilder are described below: Command LoggingWhen command logging is switched on, Gsharp will add to the ScriptBuilder the GSL commands of any changes that you make to your plot. For example, should you move a viewport, then commands similar to the following would be added to the ScriptBuilder: set page_1.viewport_1 ( XuNfirstDiagonalPoint = (30.8368,7.32087) %, XuNsecondDiagonalPoint = (41.737,14.5898) % ); repaint; Generate SnippetGenerate Snippet allows you to generate the GSL command to modify a single object. The command is added to the bottom of the ScriptBuilder and your existing GSL commands are not affected. For example, let's imagine that you have created a viewport interactively and have then generated the following GSL commands: create Viewport page_1.viewport_1 ( XuNfirstDiagonalPoint = (17.475,79.595) %, XuNsecondDiagonalPoint = (85.689,9.605) %, XuNframeWidth = 0.1 mm ); You've now modified the generated GSL by hand to make a function to create this viewport: function MakeViewport() if exists(page_1.viewport_1) destroy page_1.viewport_1; create Viewport page_1.viewport_1 ( XuNfirstDiagonalPoint = (17.475,79.595) %, XuNsecondDiagonalPoint = (85.689,9.605) %, XuNframeWidth = 0.1 mm ); endfunction MakeViewport(); You decide that you would also like to set the background color. You can't remember the exact syntax for this resource and so you have two options. Find it in the documentation of the Viewport object or use Generate Snippet/Viewport. When the Generate Snippet dialog appears, set the background color and then click on OK. The following code is added to the bottom of the ScriptBuilder: set viewport ( XuNbackgroundColor = 59 ); You can now cut the line that you need and paste it into your function to make the following: function MakeViewport() if exists(page_1.viewport_1) destroy page_1.viewport_1; create Viewport page_1.viewport_1 ( XuNfirstDiagonalPoint = (17.475,79.595) %, XuNsecondDiagonalPoint = (85.689,9.605) %, XuNbackgroundColor = 59, XuNframeWidth = 0.1 mm ); endfunction MakeViewport(); The more resources that you need to add - the more beneficial Generate Snippet becomes.
Return to Gsharp Reference Manual. |