Call subprog with string

Hi everybody,
sorry for my english.
I need to call some sub program. But i want call it using a string. Like this:

call “name of sub program”

Is possible?

Elettrotec_AC14,
I don’t think its possible because of the way the Program gets compiled when you save it.

When a Sub program is added into an Main program it gets incorporated into one file when saved.
(If you look at the txt file that gets created when you save a program you’ll see all the lines of code for your sub program too)!!
You would have to have a Case for each program and call the sub program like that.
This of course makes the program Massive if you have lots of sub programs you may want to call. which may cause the Robot controller to slowdown or even fall over.

(Its probably the most annoying feature with the UR Robot)

I’ve already created a wish list pos for this feature

sorry, I explained myself badly. I created a def in which I would like to pass the subprogram name string as an argument.

The subprogram is already saved on scripts code.

example: def … (“name subprogram”)
and inside the def call the instruction call “name subprogram”. It is not possible?

Sorry for the mis understanding.
Yes you can definitely pass the String onto a Script file routine

in your main Polyscope Prog call your def routine

e.g. sub_prog(“name subprogram”)

in your def you need to add an argument name

e.g. def sub_prog (sub_prog_name):
if sub_prog = “name subprogram”
do something
end #Endif
end# End sub_prog

sub_prog_name will now be = "name subprogram

Hope this is what your looking for

Somthig lije this, but in my def i want call another sub_program named like the string that i pass to first def

ex.:

def call_substring(string):
string for call the subprogram
end

subprogram called “pippo”

with call call_substring(“pippo”)
i want execute subprogram called pippo

Elettrotec,
It’s not possible to call a sub prog with a String, as you want to.
you can pass the String “pippo” into you def and compare it in an if statement to then call your subprogram.

This Works!

This doesn’t!