# Get current executed Code in PC SDK?

**URL:** <https://tech-community.robotics.abb.com/t/get-current-executed-code-in-pc-sdk/11131>\
**Category:** Developer Tools\
**Created:** [May 22, 2023, 3:16pm UTC](https://tech-community.robotics.abb.com/t/get-current-executed-code-in-pc-sdk/11131 "2023-05-22T15:16:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neuling](https://avatars.discourse-cdn.com/v4/letter/n/53a042/32.png) [@Neuling](https://tech-community.robotics.abb.com/u/Neuling)\
**Post date:** [May 22, 2023, 3:16pm UTC](https://tech-community.robotics.abb.com/t/get-current-executed-code-in-pc-sdk/11131/1 "2023-05-22T15:16:03Z")

</div>

Hello,

I’m new to PC SDK.  
We start a program on the Flexpendant and now we want to get the currently running code via PC SDK. I’ve already tried a lot. I can get all sorts of information about the PC SDK, just not the code that is currently running. Is there a possibility? If yes how?

---

<div class="post-metadata">

**Author:** ![revans](https://avatars.discourse-cdn.com/v4/letter/r/f4b2a3/32.png) [@revans](https://tech-community.robotics.abb.com/u/revans)\
**Post date:** [May 22, 2023, 4:10pm UTC](https://tech-community.robotics.abb.com/t/get-current-executed-code-in-pc-sdk/11131/2 "2023-05-22T16:10:28Z")

</div>

I believe what you may be looking for is something like the following.

strmod=controller.Rapid.GetTask(“”).ProgramPointer.Module;  
strRout=controller.Rapid.GetTask(“”).ProgramPointer.Routine;

This will return the string that shows the current robot module and routine. If you are trying to get the line of code that it is currently on in a text format, it appears you may be best off saving the mod file to the computer using the pcsdk and using controller.Rapid.GetTask(“”).ProgramPointer.Range; to get the exact line of code and reading it from the text file. I hope that is not what you mean as it will change very quickly, and I don’t see how it would be of much use. If you have a use case for it I would be interested as you may be better off using the motion pointer as your reference instead.

---

<div class="post-metadata">

**Author:** ![Tompanhuhu](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/tompanhuhu/32/3366_2.png) [@Tompanhuhu](https://tech-community.robotics.abb.com/u/Tompanhuhu)\
**Post date:** [May 23, 2023, 1:51pm UTC](https://tech-community.robotics.abb.com/t/get-current-executed-code-in-pc-sdk/11131/3 "2023-05-23T13:51:23Z")

</div>

I have made a component that does what you want, so it is fully possible.  
I think it’s useful when running background tasks, as they are not as easy to view in the flexpendant.

![](https://pasteboard.co/dPGaaXW6KEFE.png)  
 ![](https://pasteboard.co/dPGaaXW6KEFE.png)
