Finding progress of Point along Line

I am trying to find a value represented from 0.0 - 1.0 of a points position along a line segment. This image shows an example of what i'm trying to find:

If the point is outside of the lines range so to speak it should return something like 1.5 or -1.1 respectively

The lines are represented as: x1, y1 and x2, y2 and the point is represented as x3, y3

If the points are $A = (x_1, y_1)$ and $B = (x_2, y_2)$ then the line between them contains the points $$P = \lambda P_1 + (1-\lambda P_2) = (\lambda x_1 + (1-\lambda) x_2, \lambda y_1 + (1-\lambda) y_2)$$ for all possible values of $\lambda$. The points on that line between $A$ and $B$ correspond to values of $\lambda$ between $0$ and $1$. If $\lambda < 0$ or $\lambda >1$ you get the other points on the line outside the interval.
You need to find the value of $\lambda$ for the intersection of line $AB$ and the perpendicular to the point $(x_3, y_3)$. To figure it out, solve the equation $$(\lambda x_1 + (1-\lambda) x_2 - x_3)(x_2 - x_1) = -(\lambda y_1 + (1-\lambda) y_2 - y_3)(y_2 - y_1)$$ for the unknown value of $\lambda$.
• Please edit the question to show us/me how much algebra you know, so we can help better. How are you describing the points $A$ and $B$? Is this for use in a computer program? What is "Point"? The more context you provide the better we can understand what you need. (Note: I will probably not respond again tonight, but perhaps someone else will provide and answer, or edit mine.) Commented Feb 17, 2018 at 1:17