Multi-State Indicator mouse click read-write tag to toggle state

I'm attempting to make it so when there is a mouse click on a multi-state indicator it toggles the state between 0-1 and writes this change to the tag.

I bound the state of the multistate indicator to 'tagPath' and used this script in the mousePressed event handler script. It seems to accomplish your goal.

system.tag.writeBlocking(['tagPath'],[not event.source.state])

You might also consider using a "Multi-State Button." I find these to be clearer for HMI users than a toggle. With toggles it's not always obvious that the button has an on-click behavior.

I tried that script but it is giving me a Parse Error.

Parse Error

Post a screenshot of the script.

The tagpath should be quoted. That may be your problem.

1 Like

Putting the quotes was in fact the issue. Thank you

1 Like