I have read all the responses and I think I have it figured out. Just don't have the time to write. Maybe someone else can.
Steps (all done via lisp).
1. Select the trim boundaries (as you point out they will all be closed polylines).
2. Select the line to trim.
3. Find all the intersection points.
4. Sort the points by distance from the furthest left to right (or bottom to top)
5a. Trim the line at a point between each pair of intersections.
OR
5b. Entmake a new set of lnes in place of the original. Entdel the original of course.
This presumes that the polyline boxes will provide only two intersections each, so we can deal with pairs.
We will have to watch out for if the line starts or ends inside of the first or last polyline box.
Okay, @ВeekeeCZ, @Kent1Cooper, @RanjitSingh, @SeeM67, put it to music.