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

**URL:** <https://forum.inductiveautomation.com/t/what-is-proper-syntax-to-pass-a-memory-variable-into-a-component-script-for-page-navigation/27814>\
**Category:** Ignition\
**Created:** [August 27, 2019, 9:53pm UTC](https://forum.inductiveautomation.com/t/what-is-proper-syntax-to-pass-a-memory-variable-into-a-component-script-for-page-navigation/27814 "2019-08-27T21:53:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [August 27, 2019, 9:53pm UTC](https://forum.inductiveautomation.com/t/what-is-proper-syntax-to-pass-a-memory-variable-into-a-component-script-for-page-navigation/27814/1 "2019-08-27T21:53:23Z")

</div>

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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![JGJohnson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jgjohnson/32/29582_2.png) [@JGJohnson](https://forum.inductiveautomation.com/u/JGJohnson)\
**Post date:** [August 27, 2019, 10:15pm UTC](https://forum.inductiveautomation.com/t/what-is-proper-syntax-to-pass-a-memory-variable-into-a-component-script-for-page-navigation/27814/2 "2019-08-27T22:15:36Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [August 28, 2019, 3:16pm UTC](https://forum.inductiveautomation.com/t/what-is-proper-syntax-to-pass-a-memory-variable-into-a-component-script-for-page-navigation/27814/3 "2019-08-28T15:16:49Z")

</div>

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