Universal Robots Forum

Call a Subroutine

Hello everyone,

I want to create a Call to a Subroutine with Java code.
But I’m not sure or it is possible. Has somone done that before or nows if it is possible or not?

With regards,

Dvoortman

What do you want to achieve by calling a subroutine? What does the subroutine do? Just sending the subroutine is feasible. If you try to get something back, it needs some workaround.

We just like to write a script line ‘call subroutineA’ where subroutineA is an exisiting subroutine in the current program where the URCAP action is called. We like to use rather subroutines instead of generate a lot of script lines including whiles / sets / loops etc since this set of code is fixed

I found some workaround also now. Just create a function (via script beforehand in the (template) program or via scriptwriter) and via script writer add a line : "VarA=FunctionX()’. This will simple execute the functionX.