"On routine end" event

Hey Visual Components team I was wondering if there was an event similar to the

OnProgramFinished

event of vcExecutor.

but for routines… so something like OnRoutineFinished.
I cant seem to find an event like this anywhere. Is there such a thing or will I have to write some logic myself to get similar functionality.

Its not that simple, because with scripting you can make the executor jump to any statement within any routine and keep jumping around as long as you wish. What exactly would actually constitute a routine ending?

@TSy

hey thanks for the quick response.
image
So as an example here I have a pick routine and a drop routine. The OnRoutineFinished event would trigger when the pick routine finishes, and again when the drop routine finishes depending which routine you pass it.

by the sounds of it it seems like there is not such an event. So I was thinking maybe I can grab the last statement of each routine and then use the

OnPostExecuteStatement event

and pass in the last statement of each routine… That might work.

what do you think?

You can simply register event handler to vcExecutor.OnPreExecuteStatement and check whether the next statement is in a different routine from previous one.

To do this you’ll need to store the previously executed statement, check that it is not a “Call Sequence” statement, and compare the statement ParentRoutine properties.

Thanks TSy yeah I had though of couple ways to achieve this but was wondering if there was already an event handler for it that somehow I just couldn’t find but good to know there is not and now I will implement a solution checking the executed statements as you suggested