Universal Robots Forum

Secondary Client Issue


I would appreciate some help with sending multiple lines of script from a button in our URCap. We can send a single line like a popup or setting an output but multiple lines are not working. We are using the “ClientSendScript” class. To try and find the problem I am simply sending two lines of script within the def end statement but only the second line works. When I’ve tried more than two lines it is still only the last line that is executed.

In the screenshot below you can see the command that is sent each time the button is pressed in the terminal and the effect on the output state in Polyscope. What am I doing wrong? I’m sure it must be something simple but I’ve been trying for hours without luck.

I can see from here

that others have had this issue but using a def statement should be the answer but it’s not working

Here is the method that produces the string that goes to the script sending class


And here is the sending function


Thank you for your time



You shouldn’t use writeUTF function - according to documentation it adds lenght before string. You should use


Also remember about indentation rules when you send scripts directly to the socket. You can find these in latest URScript documentation in section 1.2.


Thank you very much. That worked very well