You need to learn variables, and use 2 of them:
one variable as a trigger (for example, "trigvar=1" when activated and "trigvar=0" when deactivated)
and other variable to keep track of time (on every bar, "barcount=barcount+1")
To stop your process: if "trigvar=1" then check if "barcount > 4" -> if true, "trigvar=0"
It probably looks difficult, but I trust you will find how to do it 










