# Get Modbus Signals with the ScriptWriter

**URL:** <https://forum.universal-robots.com/t/get-modbus-signals-with-the-scriptwriter/18114>\
**Category:** URScript\
**Created:** [December 10, 2021, 2:13pm UTC](https://forum.universal-robots.com/t/get-modbus-signals-with-the-scriptwriter/18114 "2021-12-10T14:13:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon87809148](https://avatars.discourse-cdn.com/v4/letter/a/f1d935/32.png) [@anon87809148](https://forum.universal-robots.com/u/anon87809148)\
**Post date:** [December 10, 2021, 2:13pm UTC](https://forum.universal-robots.com/t/get-modbus-signals-with-the-scriptwriter/18114/1 "2021-12-10T14:13:41Z")

</div>

Hello,

I’d like to get a Modbussignal by inserting the Signal-Name as a String variable in the Script-Function. As it is shown below.

![Code](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/9/9c606233ab00b2abf2e702fe051a8e521677bc6b.png)

Unfortunatly this doesn’t work and I get the following message. Although the first Assign-Command without the variable works just fine…

 ![Error Message](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/c/c6a3b5fc9d903541e2352ab56d98415c006ac96d.png)

Is there a way to solve this Problem so I can use String variables to address the Modbussignals?

---

<div class="post-metadata">

**Author:** ![anon32693620](https://avatars.discourse-cdn.com/v4/letter/a/6a8cbe/32.png) [@anon32693620](https://forum.universal-robots.com/u/anon32693620)\
**Post date:** [December 10, 2021, 2:35pm UTC](https://forum.universal-robots.com/t/get-modbus-signals-with-the-scriptwriter/18114/2 "2021-12-10T14:35:22Z")

</div>

try changing it to

```auto
writer.assign(modbus_value, "modbus_get_signal_status(\"" + modbus_1 + "\", False)");

```

where I’ve only added " before and after your modbus\_1 inclusion. This way it gives a String instead of what it believes to be a variable (“MODBUS\_1” instead of MODBUS\_1).
