# Toggle bit based on any event occurence in a window

**URL:** <https://forum.inductiveautomation.com/t/toggle-bit-based-on-any-event-occurence-in-a-window/3215>\
**Category:** Ignition\
**Created:** [August 24, 2011, 2:53pm UTC](https://forum.inductiveautomation.com/t/toggle-bit-based-on-any-event-occurence-in-a-window/3215 "2011-08-24T14:53:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rooks](https://avatars.discourse-cdn.com/v4/letter/r/ce7236/32.png) [@rooks](https://forum.inductiveautomation.com/u/rooks)\
**Post date:** [August 24, 2011, 2:53pm UTC](https://forum.inductiveautomation.com/t/toggle-bit-based-on-any-event-occurence-in-a-window/3215/1 "2011-08-24T14:53:36Z")

</div>

I have a popup window with various containers and components that control a remote site. Whenever a setpoint or bit is I changed on SCADA, I need to toggle a “Write to remote PLC” bit. Is there a way to do this using the “event” object or some other means?

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [August 24, 2011, 3:47pm UTC](https://forum.inductiveautomation.com/t/toggle-bit-based-on-any-event-occurence-in-a-window/3215/2 "2011-08-24T15:47:17Z")

</div>

Yes, you can do it with a simple tag change script on the gateway. So when you write to the setpoint can toggle the “Write to remote PLC”. Take a look at tag change scripts here:

[inductiveautomation.com/supp … cripts.htm](http://www.inductiveautomation.com/support/usermanuals/ignition/tag_change_scripts.htm)

Make sure it is a gateway tag change so it only happens in one location. Your script would look something like:`value = newValue.value
if value == 1:
    system.tag.writeToTag("Another/Tag/Path", AnotherValue)`
