Changing screens based on PLC tag

We have a touchscreen being installed in a panel that may not be accessiable by the operators and would like the ability to change screens in the client based on a PLC tag (toggle switch on front of panel - ie; position1=mainscreen, position2=outputs, position3=alerts, etc…). How would I go about this?

We would also like to have a ‘screen saver’ page in the project that will kick on after a timeout; maybe 30 seconds or so…would this be done via a client script?
Thanks in advance!

  1. Read the PLC switch position into an integer SQLTag (here called ‘test1’), then create a Client Tag Change Event Script similar to the following:

    system.tag.write("[Client]inactivity", 30)
    value = system.tag.read('test1').value
    if value==1:
        system.nav.swapTo('Display 1')
    elif value==2:
        system.nav.swapTo('Display 2')
    elif value==3:
        system.nav.swapTo('Display 3')
    

    Because the script will fire on startup, you should not have to set a default window to open on startup.

  2. Create a Client integer tag called ‘inactivity’.

  3. Create a Client Timer Event Script set to run every second like the following:

    inactivity = system.tag.read("[Client]inactivity").value
    inactivity = inactivity - 1
    system.tag.write("[Client]inactivity", inactivity)
    if inactivity <= 0:
        system.nav.swapTo("Screensaver page")
    

Now when a user changes the switch the correct screen will display for 30 seconds before the screensaver page will be displayed. This does mean that is the user wants to display page 1 when the control is already at page 1, they will have to move it to another page and back to page 1 before it will display. A way round this would be to add another button to ‘wake up’ the display.

1 Like

Worked like a charm, thank you sir