Send script toolbar


I am trying to send a (modbus) signal to an external device via the toolbar without the program running. I tried the code from this article for this, but it doesn’t seem to work.

I have taken over the scriptSender and the scriptCommand from JBM without changing anything here. I expect this is where the error is, but it is not clear to me whether or not I should change anything. As soon as I change the ip address to the ip address of my external device ursim crashes.

This is my code in the toolbar contribution

Is there anyone who can tell me what I am doing wrong or how to do this?

Kind regards,


Usually if your simulator freezes/crashes when sending scripts like that, it’s because you’ve got a small typo in the String. I can’t tell you how many times I’ve crashed my sim because I forgot a ).

Easiest way to double check is to print the command you’re sending before you send it.


Add that and take a close look at the printout to verify it’s sending EXACTLY what you want it to send

Hi @eric.feldmann,

Thank you for your quick response! I worked on it and did find and eliminate a bug. Unfortunately, that was not the fix that makes the program work…

The signal itself does work at runtime, but not yet outside of it. I have put everything into a try and catch and in that everything seems to work fine as well. The signal is also stored properly in the variable.

Is that the exact code that works at runtime? According to the manual you’re missing an argument:


The set output signal function takes a String and 2 booleans. Looks like you’re only sending it one of those bools.

1 Like

@eric.feldmann Yeah I used the exact same code in the scriptwriter and then it is working. But I tried it to be sure and it helped! Sometimes the solutions can be so easy.
Thankyou for your time and help again.