Repeating Routines based on sensor signal in ABB Rapid

Hello everyone, I hope you can help me with a problem. I have around 150 routines in a module that I want to execute in a specific order. Whenever a variable changes due to a sensor signal, I want the currently executing routine to repeat after completion. The routine should keep repeating until the sensor signal changes again.

Since I’m completely new to ABB Rapid, I don’t know how to achieve this. Is it possible, for example, to use a for loop for routine calls, call the routine once, and then use a while loop to check the sensor signal? Is something like that possible?

PROC main()

CONST ?routines? RoutineList:=[…];

FOR i FROM 1 TO RoutineList DO

CallRoutine RoutineList[i];

WHILE SensorSignal DO

CallRoutine RoutineList[i];

ENDWHILE

ENDFOR

ENDPROC

I know that this Code won’t work. I just want to give you an example of what i meant.
What would be the best way to do something like that?

What type of signal does this sensor give you? Just simple on or off or does it give a value of some sort?

It’s just a simple on/off signal.

I think that your pseudo code will work. Just a couple things:
CONST string RoutineList [“routine1”, “routine2”, etc.,]:
You might need to have another variable to assign the name from the list array.
stRunJob:= RoutineList[i];
Then call by string variable looks like this:
%stRunJob%;