RobotStudio event

Is it possible to return current Proc/Function name as a string?

Options
I'd like to be able to reference the name of the currently executing Proc/Func/Trap with a simple call (see example below). Is there a function similar to "ArgName" that will work in this manner?

ex:
    PROC TestProcName()
        VAR string name;
        
        name:=CurProcName();
        TPWrite "Current Proc is "+name;
        !rest of code
    ENDPROC

Expected on pendant: "Current Proc is TestProcName"


Answers

  • Hi jjwempe2,

    I don't know of anything built into RAPID, could you store the name in a global variable? 
    This implementation would require re-work of every function you use, which is probably extensive.
    It would also require careful thought of error handling, error handling with long jump etc. 

    Do you just need to print the current function to the screen? 

    Regards,

    Harry
  • Tompanhuhu
    Options
    What's the point of this instruction?

    Is this done to make it easier to copy and paste the code, even if it might increase CPU usage?

    It's not like the line:
    TPWrite "Current Proc is "+name; 

    can move to a different routine at runtime? 
    Systemintegrator - Web / C# / Rapid / Robotstudio

    If I helped, please press Vote Up  :smile:
  • jmf
    Options
    You can also try a Screenmaker Screen if you are using IRC5. You will have to modify/add variables to your system to get this screen working as you want it.

    This is what I have done on my system to make my life a bit easier. 

    https://imgur.com/Xo0c32k
    https://imgur.com/AK1LO9Y 

    There are other ways but this one seems to be working good enough for me.