A general outline: Gather everything which constitutes the actuation sequence and put it in a finite state machine.
Start with just one button push initiating one cycle. To finish, put together a loop which counts how many cycles have been done. If not done continue initiating cycles.