You would need to be in auto, have a program pointer, have the motors on before this would work. You might consider using System Inputs and outputs, like a PLC would use, to try to implement your program control, it might be simpler and more straight-forward than doing it all programmatically.