Shape key driven by position on a curve

I have a mesh (a light pulse) with a follow curve constraint, and the light pulse has a shape key. I want the shape key to be driven by the position of the pulse on the curve. That is when the pulse is between say 70% and 75% of the length of the curve I want the shape key to be at 1, and otherwise at 0.

If I only had a few I’d just animate it by hand, but I’ll have several hundred so I hope i can find a better solution.

I put a video on youtube so you can see what I mean. Basically when the light hits the right side of the big rectangle I want the shape key to be set to 0: