What's the easiest way to run a script?

scampsd shared this question 4 years ago
Needs Answer

Good morning,

I can imagine this question to be quite surprising, but let me explain the situation: I'm working on a computer program, which should display a ring on screen, and is doing this drawing horizontal lines (from the inner part to the outer part of the ring).

I'm debugging the program, entering lines like:

  1. printf("Segment[Point[{%d,%d}], Point[{%d,%d}]]\n", x1, y1, x2, y2);

The output becomes a whole bunch of lines, like:

  1. Segment[Point[{296,6}], Point[{317,6}]]
  2. Segment[Point[{296,7}], Point[{328,7}]]
  3. Segment[Point[{296,8}], Point[{335,8}]]

... (some hundreds of them)

The idea is to put those lines in a script, and then use GeoGebra's display routines in order to see the graphical outcome of those lines.

At this moment I'm using a button to do this: I add a button to Geogebra's graphical view, I fill in the name, and in the scripting part, I copy/paste the mentioned output (you can imagine that the "Input" single line is far too limited for handling that large amount of scripting lines). When I click on "Ok", I have the impression that Geogebra is first verifying the object properties of the button, and as such verifying the whole scripting part, which easily takes several minutes to complete.

Is there an easier way to launch a script, without needing to pass by the script verification (at least, that's what I think is going on)?

Thanks in advance

Comments (3)


Idea: Import only the points and create lists instead named-objects

I test this with 2600 point-pairs


1. create in your programm a string in the following format in a txt-file (no return, no new line etc.):


2 create a new ggb-applet

3.Open the txt-file from point 1 mark the text and ctrl-C

3.create a button

. type in the header: create list

. ctrl_V in the editor-area wait 20 sec until the cursor is at end of text

. click OK (wait 20 sec)

4.click the new button -> create (immediatly) list1

5.write in Input-Line

. Zip[Segment[Element[L, 1], Element[L, 2]], L, list1]


now you can see the ring in GGB


Thanks for your quick reply, but I'm just wondering: do I always need to pass via a button or so in order to launch a script? Is there no script editor within Geogebra from where I can launch it?


you can edit the xml-file of ggb

A ggb-file is a renamed zip-file.

Open the ggb-file with a zip programm

There exist a file geogebra.xml. Open this with an editor (I use Notepad++)

create an list-element as following:


<expression label ="list1" exp="{{(-0.37403, 6.99), (0.37403, 6.99)}, {(-0.52877, 6.98), (0.52877, 6.98)}, {(-0.64738, 6.97), (0.64738, 6.97)}, {(-0.74726, 6.96), (0.74726, 6.96)}, {(-1.85405, 6.75), (1.85405, 6.75)}, {(-1.89008, 6.74), (1.89008, 6.74)}, .......


(0.91455, -6.94)}, {(-0.83516, -6.95), (0.83516, -6.95)}, {(-0.74726, -6.96), (0.74726, -6.96)}, {(-0.64738, -6.97), (0.64738, -6.97)}, {(-0.52877, -6.98), (0.52877, -6.98)}, {(-0.37403, -6.99), (0.37403, -6.99)}}"></expression>

<element type="list" label="list1">

<show object="false" label="true"></show>

<objColor r="0" g="100" b="0" alpha="0.0"></objColor>

<bgColor r="255" g="255" b="255" alpha="255"></bgColor>

<layer val="0"></layer>

<labelMode val="0"></labelMode>

<animation step="1" speed="1" type="0" playing="false"></animation>

<isShape val="false"></isShape>

<lineStyle thickness="2" type="0" typeHidden="1"></lineStyle>

<pointSize val="5"></pointSize>

<pointStyle val="-1"></pointStyle>



Alternatively you can create a button including his script in this way.


Whatever you do: latest when you open the file ggb evaluate all (!) objects.

This is also the reason to work with lists (is much more quick then named-objects)


© 2021 International GeoGebra Institute