I have two screens in vision and I want to be able to toggle between them using an OPT touch button (a boolean tag coming from PLC). I wrote the code below in Client event scripts → Tag Change:
val= system.tag.readBlocking('[default]OptTouch').value if val: if system.nav.getCurrentWindow()== "Top": system.nav.swapTo('Bottom') else: system.nav.swapTo('Top')
So now when I launch the project and use the OPT touch button to switch between screens, the screen does not change with the initial change of the OPT button but when I toggle the button for the 2nd time it works! So basically the code does not capture the initial change.
I also tried the Tag event Scripts on a vision client Tags to toggle between screens, but this works only in the designer mode, I do see the screen changes in the designer mode but not when I launch it.
if not initialChange: if currentValue.value: system.nav.swapTo('Bottom') else: system.nav.swapTo('Top')
Any idea how this can be fixed?