What is proper syntax to pass a memory variable into a component script for page navigation

I have a Vision project created with a Main Window and a single button. I also have a second Main Window in a sub folder. (ie subFolder/subMenu).

I want to use a Memory variable memVar to hold the name of what screen is open. I will use scripting then to track what page I am on. My script on the button is the following:

someTag = 'subFolder/subMenu'
system.nav.closeWindow([default]memVar)
system.tag.write("[default]memVar", someTag)
system.nav.openWindow("[default]memVar")

However on lines 2 and 4 the syntax error ‘no viable alternative at memVar’ appears. I have checked that my memory tag is type string and that system.tag.write does work by itself.

Any suggestions are greatly appreciated. Also if there is a better way or more proper way to track what page the user is on I’d appreciate it.

You have to read the value of your memory tag to use the value in a close or open window operation.

window = system.tag.read("[default]memVar").value
system.nav.closeWindow(window)
1 Like

Thank you, this was the solution I needed and implemented.