RobotStudio event

Put actual routine name in a variable

Hi !  I want to have the actual routine name in a string variable. Does it is possible, if yes how ?

Thanks

Comments

  • What do you need the actual routine name for? Is it for some sort of logging purposes?
  • If the purpose is to call a routine by a string here is an example

    MODULE module1
       
        VAR string routine:="Hello";
        
        PROC main()
            CallByVar routine,1;
            CallByVar routine,2;
        ENDPROC
        
        PROC Hello1()
            TPWrite "Hello 1";
        ENDPROC
        
        PROC Hello2()
            TPWrite "Hello 2";
        ENDPROC
    ENDMODULE
    Per Svensson
    Robotics and Vision Specialist
    Consat Engineering
  • I was for logging. I wanted an universal routine for dataloging.  I did'nt find how to retreive the actual routine name but I used a Pers variable with my routine name for the CallByVar and I call a Datalog routine with the same variable as a parameter. It work well except if i manually launch a routine, in need to pass by the main routine to be sure that the call is do.

    Thanks
  • Call by variable with a string looks like: %Hello1%;  You might be able to concatenate that: %Hello% + NumtoStr(1,0);
    Lee Justice
  • This might be more correct for the second option:  %Hello + NumToStr(1,0)%;
    Lee Justice