Input multiple ggb commands

tush shared this question 3 years ago
Answered

Suppose I have a multiple of inputs I want to get into my .ggb file, all of which have a similar form as a command. 

Like those for example:


p_{1}=Point({cos((2π)/(20)*1),sin((2π)/(20)*1)})
p_{2}=Point({cos((2π)/(20)*2),sin((2π)/(20)*2)})
p_{3}=Point({cos((2π)/(20)*3),sin((2π)/(20)*3)})
p_{4}=Point({cos((2π)/(20)*4),sin((2π)/(20)*4)})

etc. up until

p_{20}=Point({cos((2π)/(20)*20),sin((2π)/(20)*20)})

What if I have a txt file with these command ready. (How I get them ready is another thing to be concerned about, nevermind at the moment).

Is there a way to input them as a whole in one click? The example above could be very time consuming, so I am looking for a shortcut.

Any sort of help would be very welcome.

Comments (4)

photo
1

Or just add them to a button (or use the JavaScript API)

photo
1

Could you please elaborate on this suggestion? What do you mean by "add them to a button"?

photo
photo
1

An example with Execute and Button.

Note1: a leading lowercase letter in the label for "points" creates a vector.

Note2: Deleting non-existent objects is no problem

Note3: radius "r" is dynamic but label-boolean is not dynamic (see script in "label")

© 2023 International GeoGebra Institute