copy colour of object with command

János Losonczi shared this question 1 week ago
Answered

Dear All,

I'd like to copy the colour of an object to another object (like Copy Visual Style) with command(s) in a GG script.

Do you have ideas?

Best regards,

JL

Comments (15)

photo
1

With the attachment you are able to implement a new GGB script command into your applet.

He is called with Execute(copyColor,<fromObject>, <toObject>).

photo
1

See new version here.

photo
photo
1

Unfortunately I got error message:

Command SetColor:

Illegal argument: Text "#006400"

Issuing SetColor(d, "#006400") command I got the same message.

photo
1

Please update to the current version

photo
photo
1

Oh .. ! Sorry,

This will be difficult because I can't test all the possibilities of GGB implementation in my environment.

(I mean it has too many with too many differences/restrictions)

But I want to try.

.some questions:

1. Does it work with the following link (GeoGebraTube)? https://www.geogebra.org/m/pfz3zgvd

2. Which system do you use? (Microsoft, Andoroid, Unix, IOS)

3. Which Browser? (Chrome, Firefox, Safari)

4. Which version (one of the .....Calculators, Geometry, Classic )

5. Which location (local installation, yes/no)

6. Which release (5.0.564 / 6.0.564 / 7.xxxx )

photo
1

I changed the conception of my script, to get a workaround.

This way my problem is resolved.

These are the answers to your question, they may useful in the future:

1. -

2. macOS High Sierra v.: 10.13.6

3. Safari v.: 13.0.3, Firefox v.: 70.0.1

4. Classic

5. no

6. 5.0.426.0-d

As far as you mentioned higher releases than mine, I suppose this should be the cause of the error message.

Thank you for your help, and I'm sorry for your waste of time.

photo
1

Yes, I can reproduce the error with 5.0.414. You need to install a higher/actual release.

(By the way to point 5: GGB 5.0 is always installed locally. So 5=yes)

.

BUT:

In the meantime I have looked at your work in GGTube. (interesting challenge!)


Perhaps instead of the GGB script "copyColor" the following procedure is more efficient:

Collect the same basic objects with a certain logic (symmetry, rotation etc.) in a list.

Then you can assign (with GGB-Scripts) different color combinations to the different lists.

photo
1

I upgraded to GG Classic 6.

Your app works exactly.

Best regards,

JL

photo
1

Everything can't be perfect.

As I mentioned above I upgraded to GG Classic 6.

Now I can't open my old GG 5 files.

When I choose my old GG 5 file in the Open menu, the result is an empty GG Classic 6 screen, without my old GG 5 file.

What to do?

photo
1

First and the most important: Save the file in the form when it worked with GGB5.0.414.

----------------------------------------------------------------------------------------------------

Only as idea:

  • Change first to the new GGB 5.0.564
  • open the old GGB-files with GGB 5.0.564
  • Menue / File / Sav as / new File-name (important: so the old file is not destroyed)
  • for test: open https://www.geogebra.org/classic open the new file with name above
  • now you can change again to GGB 6.0.564

-----------------------------------------------

Alternatively or If above not works send the ggb-file.

I think for the actual GGB (5 or 6) the exist file is corupted. Maybe I can overcome that with old GGB versions.


----------------------------------------------------------------------------------------------------------------

supplement

Your applet https://www.geogebra.org/m/GkvYaS2t is corrupt.

The downloaded version cannot be opened (5 or 6)

and the applet has the following error message (in GGTube):

.

Response time from GeoGebra's server to this applet is more than 1 minute. With default settings you may receive an Unresponsive script warning from Firefox. I've set the value of dom.max_script_run_time from 10 to 100 (Firefox 48.0.2) and it works well. See: https://support.mozilla.org...

.

Maybe this error message is also wrong/misleading because I wanted to open the applet with chrome..

photo
1

Thank you for your observation, I replaced my applet with a working one.

The message you mentioned is not an error one. It is my remark to my applet to help those users who get the "Unresponsive script" warning from Firefox.

photo
1

I could download release 5.0.568 instead of 5.0.564, that's why I tested the procedure you recommended with 5.0.568. Unfortunately I was unsuccessful with both tests (this, and the https://www.geogebra.org/classic) as well.

I will continue writing of my applet with 5.0.568, and I will change to GG 6 when I begin new work.

photo
1

The problem occurred when copying the Java scripts.

Initially the receiving editor area is set to ggb script.

If you now copy a JS into the editor area, GGB automatically switches the GGB commands to the local language (but this is unwanted here).

workaround:

Variant1: Change the option "Language" to US (both in source and target) (tested)

Variant2: switch from GGB script to Java script before copying the JS in the receiving editor area

photo
1

New version of copyColor with

- adapted description of the installation

- cosmetic changes in JS (onUpdate)

photo
1

Used Example for demonstrate copyColor in the attachment.

Note1: check first the JS onClick in the point COL01 (the 2 variants)

(works with 5.0 local, 6.0 local, 6.0 WEB)

© 2019 International GeoGebra Institute