Script with parameters not executed (Windows 10)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Script with parameters not executed (Windows 10)

bitli
Any script that has parameter is not executed (including the builtin scripts),
it does not semme to ask or require parameters.
If I inspect the arguments, the array is empty.
Scripts without parameters works fine.
Any clue ?
Reply | Threaded
Open this post in threaded view
|

Re: Script with parameters not executed

bitli
Sorry, I found my mistake, but I leave the explanation just in case it is useful to others.

It was not obvious to me, but the scripts require one more parameter than the described parameters: a point where some object will be created (typically a text for the example scripts).
So if you execute the script "is square ?", you must first select a polygon, then click on a point somewhere else, where a text will appear, in addition to the change of color of the polygon.

Now I look how to create a script that has just side effects but does not create something, if possible at all (or maybe create a hidden object ?).

Reply | Threaded
Open this post in threaded view
|

Re: Script with parameters not executed (Windows 10)

Hilaire Fernandes
Administrator
In reply to this post by bitli
Le 09/01/2021 à 11:20, bitli [via Dr. Geo Forum] a écrit :
Any script that has parameter is not executed (including the builtin scripts),
it does not semme to ask or require parameters.
If I inspect the arguments, the array is empty.
Scripts without parameters works fine.
Any clue ?

You need to select on the sketch the items matching the script parameters.

Let's say you want to use a script defined with two parameters a circle and a point, you need to proceed as follow:

  • Select the script in the script menu or dialog box,
  • In the sketch select a circle then a point,
  • Click in an empty space in the sketch to plugin the script output.
Was this message helpful?
Tell us!
Reply | Threaded
Open this post in threaded view
|

Re: Script with parameters not executed

Hliaire Fernandes
Administrator
In reply to this post by bitli
bitli wrote
Now I look how to create a script that has just side effects but does not create something, if possible at all (or maybe create a hidden object ?).
A script always requires to be plug-in the sketch.
As you wrote it, you can hide it afterwards.