This type of stuff is fun to build. Enclosed is how I would do it. Place the following script inside of a shared script, like shared.nav
from com.inductiveautomation.ignition.common.model import ApplicationScope
PATH_SEPARATOR = "/"
DIR_UP_CHAR = ".."
PARENT_DIR_CHAR = "."
SCOPE = ApplicationScope.toCode(ApplicationScope.getGlobalScope())
def swapWindow(window1,window2,params = {}):
if SCOPE in ("C","D"):
pathParts = []
wp1 = window1.split("/")
wp2 = window2.split("/")
if wp2[0] not in (DIR_UP_CHAR, PARENT_DIR_CHAR):
pathPaths = wp2
elif wp2[0] == DIR_UP_CHAR:
pathParts = wp1[:-2] + wp2[1:]
elif wp2[0] == PARENT_DIR_CHAR:
pathParts = wp1[:-1] + wp2[1:]
window = []
for part in pathParts:
if part == DIR_UP_CHAR and len(window):
window = window[:-1]
elif part == PARENT_DIR_CHAR:
pass
else:
window.append(part)
windowPath = "/".join(window)
system.nav.swapWindow(window1,windowPath,params)
Then, instead of using system.nav.swapWindow, use shared.nav.swapWindow
swapWindow("Hello/This/Is/My/Path","../OtherWindow",{"someId":"alf"})```