# Sending and running a script through tcp/ip connection

**URL:** <https://forum.universal-robots.com/t/sending-and-running-a-script-through-tcp-ip-connection/10627>\
**Category:** Robot Communication\
**Created:** [December 8, 2020, 3:59pm UTC](https://forum.universal-robots.com/t/sending-and-running-a-script-through-tcp-ip-connection/10627 "2020-12-08T15:59:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon41246015](https://avatars.discourse-cdn.com/v4/letter/a/d78d45/32.png) [@anon41246015](https://forum.universal-robots.com/u/anon41246015)\
**Post date:** [December 8, 2020, 3:59pm UTC](https://forum.universal-robots.com/t/sending-and-running-a-script-through-tcp-ip-connection/10627/1 "2020-12-08T15:59:14Z")

</div>

Hi guys,

I am looking into generating a .script file containing some urscript on a computer and having an e-series cobot run this. I know it is possible to send individual commands to the primary, secondary and real-time sockets, but I can’t find any documentation on sending a complete script.  
If this is not possible out of the box, I was considering running a deamon that accepts some urscript, saves this data as a .script file and then find some way to run this. That brings me to my second question, is it possible to start a script file from a tcp/ip connection? Would the only way to run this file be to open a “Script” urcap, load the script in there, and then run the program, or is there a way to run a script without this step?

Thanks in advance,

Jona

---

<div class="post-metadata">

**Author:** ![anon19565564](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@anon19565564](https://forum.universal-robots.com/u/anon19565564)\
**Post date:** [December 8, 2020, 9:28pm UTC](https://forum.universal-robots.com/t/sending-and-running-a-script-through-tcp-ip-connection/10627/2 "2020-12-08T21:28:12Z")

</div>

You can make an .urp file that calls a .script file. You can upload/overwrite the .script file via the sFTP, and the send command to the robot o run it via dashboard at 29999. ( You can send the .urp file via sFTP too)

---

<div class="post-metadata">

**Author:** ![ajp](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/ajp/32/471_2.png) [@ajp](https://forum.universal-robots.com/u/ajp)\
**Post date:** [December 9, 2020, 3:55am UTC](https://forum.universal-robots.com/t/sending-and-running-a-script-through-tcp-ip-connection/10627/3 "2020-12-09T03:55:23Z")

</div>

Entirely possible to send a whole script to the robot client interfaces for execution. You just need to wrap the whole thing in a function definition, the controller will wait until it receives the “end” of that function then executes.

How are you trying to do it? Is it not working?

---

<div class="post-metadata">

**Author:** ![anon41246015](https://avatars.discourse-cdn.com/v4/letter/a/d78d45/32.png) [@anon41246015](https://forum.universal-robots.com/u/anon41246015)\
**Post date:** [December 9, 2020, 9:24am UTC](https://forum.universal-robots.com/t/sending-and-running-a-script-through-tcp-ip-connection/10627/5 "2020-12-09T09:24:38Z")

</div>

Ah, that makes sense. I have not had the oppertunity to test anything yet because I’m working from home a lot, so I am currently researching some possible methods to test when I have access to a cobot again.

Thank you for your suggestion!

---

<div class="post-metadata">

**Author:** ![ajp](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/ajp/32/471_2.png) [@ajp](https://forum.universal-robots.com/u/ajp)\
**Post date:** [December 9, 2020, 12:04pm UTC](https://forum.universal-robots.com/t/sending-and-running-a-script-through-tcp-ip-connection/10627/6 "2020-12-09T12:04:37Z")

</div>

You’re welcome. All of the client interfaces are running in URSIM so you can also test this without access to a real robot.

---

<div class="post-metadata">

**Author:** ![mbush](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/mbush/32/76_2.png) [@mbush](https://forum.universal-robots.com/u/mbush)\
**Post date:** [December 9, 2020, 12:17pm UTC](https://forum.universal-robots.com/t/sending-and-running-a-script-through-tcp-ip-connection/10627/7 "2020-12-09T12:17:46Z")

</div>

One thing to know is indentation is important on this. The body of the script has to be indented two spaces from the definition line and the end line. I believe you can then have additional indentation as needed but it’s not required.
