I can see nothing wrong with
theforce= distance(ball.X, ball.Y, Touch.X, Touch.Y)
if theforce>500 then theforce=500
apply theforce at angle
sort of thing
But if you want it in 1 event then something like
apply ( (distance(ball.X, ball.Y, Touch.X, Touch.Y)<500)*( distance(ball.X, ball.Y, Touch.X, Touch.Y)))+( ( distance(ball.X, ball.Y, Touch.X, Touch.Y)>=500)*500) at angle
(I think the first method would probably run faster and is easier to read.)