How do I change values of LAB colors in Illustrator using a script?

I am trying to write a script in JS, that will run through all the objects in my file, and change their LAB color values (change L individually, A, and B).

I tried this code:

var doc = app.activeDocument;
                
doc.swatches.getByName("MySwatchName").color.l = 42;
doc.swatches.getByName("MySwatchName").color.a = 40;
doc.swatches.getByName("MySwatchName").color.b = 2;

But it doesn't work. Changing the name of the swatch was possible, but not changing the color values.

I read this article and now I wonder, might it be that what I am trying to do is impossible with the scripting API?

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum