Movements overlaps in remote control

While sending moveP, moveL or moveJ through Primary/Secondary/RealTime ports, I have no way to detect if the command was concludes, thus by sending multiple commands, in sequence, they overlaps, So the current movement never finishes.

How to solve that, is that a way to send mutliples moves at once? If not, if I need to handshake it, how to detect when to send a command before the robot stops?

Send lines of URScript like this:
def myProg():
here lines of URScript code
end