Number Slider and Input parameters

Hi inno!
This is an elegant solution, thank you very much.
But I became interested in your link to the dynamic slider.

It would be cool to be able to automatically set to numeric domain for a min/max values in slider.
The thing is that in my example the curve is not static, it will change its size.
I would like to see in the slider the values ​​in millimeters.

I tried to play with the script, but it does not work for me. 10 years have already passed, and code is presented on the site, which may not be supported.

private void RunScript(object x, double y, ref object A)
  {
    var input = Component.Params.Input[0].Sources[0]; //get the first thing connected to the first input of this component
    var slider = input as Grasshopper.Kernel.Special.GH_NumberSlider; //try to cast that thing as a slider

    if(slider != null) //if the component was successfully cast as a slider
    {
      slider.Slider.Minimum = 0;
      slider.Slider.Maximum = y;
    }
  }

I also saw a topic where you participated in the discussion of a similar issue. In one of the examples, the slider receives data, but within a manually set value range.

Number Slider min and max values.gh (10.9 KB)