swapTo variable window

Hi.
I’m trying to navigate through buttons on a docked window with script like the following:
system.nav.swapTo(“Main/”+[client]NextWin)
where all the main windows are under the “Main” folder, and the NextWin string tag gets populated when each main window is opened.
The swapTo function won’t accept the NextWin value.
Where is my error?
Thanks.

You can’t just insert a tag name in a script. And curly braces are a binding tool, not a jython feature. Tags aren’t automatically injected into jython as variables, and their syntax isn’t python-compatible, anyways. You need to use one of the system.tag.read*() script functions to retrieve the values. Read the manual carefully so you know what to do with the QualifiedValue objects you get from those.

OK, so my error was missing the .value extension for the window variable.
So it now looks more like:
wind = system.tag.read("[client]NextWin").value
system.nav.swapTo(“Main/”+wind)
I assume this is the cleanest way to do it.

3 Likes