Turning off an output to a motor when it reaches the end

So I am working on a project that uses a DC motor controller and a mega 2560 (amongst other parts) and I am using 2 of the 2560 analog outputs as the forward and reverse buttons. So I am literally cutting the wires off at each of the buttons and connecting one wire to to coordinating analog out (say forward is 5, reverse is 6), and the other to GND, and then when I want the motor to go forward I just write output 5 to high. Now the thing is, this motor runs a linear actuator and when I connect the 2 motor wires (in either polarity), the motor runs in the proper direction but when it hits the end of its travel it just clicks off and stops, despite having it still connected. So if that were on the Mega 2560 I could keep that pin high all day, once it reaches its limit, that's it. But I don't want to keep it high all day. In fact, I want it to read when the limit has been reached and then go low. Without installing any additional hardware, is there a way that I can do this?

Here is all the info on the motor/actuator that I have

It sounds like the actuator has an internal limit switches. If so, it is OK for power to the actuator to be maintained as the motor will not be powered once it reaches the end

If there are no external connections to the limit switches then you could just run the motor for a fixed time longer than the maximum travel time before cutting the power

I did not understand your explanation of how the Mega, buttons and the actuator are connected. Please post a schematic of your circuit and the code that you are using

More information on the actuator

It does have internal limit switches

If there is no feeback from the actuator there is no way the Mega can know the actuator has reached the limit.

If you monitor current from the power supply you can know if any motor is running.

Assuming you are driving a motor and the current goes to 0 you can assume it reached the limit

That's pretty much what I figured. The internal limit switch was the only explanation for the system behaving the way that it does. I wish my brother hadn't bought that particular unit. Either way, creating a timed switch to low command or monitoring the current draw on the output of the DC motor controller are the only ways to make this puppy bark. Thanks guys. I'm going to see if I can dig up a simple pre-fabricated current monitoring pcb.