The script is good. I like that you can select two points on different paths and rotate the text along the virtual line. Only it doesn't define the selected segment of a path if the user hasn't selected anchor points.
Toshiyuki TAKAHASHI has a script that can define a mouse-selected segment of a path without the user selecting the segment's endpoints
https://github.com/gau/adjust-text-angle-to-segment. This would be a good addition to your script.

The script is good. I like that you can select two points on different paths and rotate the text along the virtual line. Only it doesn't define the selected segment of a path if the user hasn't selected anchor points.
Toshiyuki TAKAHASHI has a script that can define a mouse-selected segment of a path without the user selecting the segment's endpoints
https://github.com/gau/adjust-text-angle-to-segment. This would be a good addition to your script.