# Internal frame activated timing

**URL:** <https://forum.inductiveautomation.com/t/internal-frame-activated-timing/38687>\
**Category:** Ignition\
**Tags:** ignition80, scripting\
**Created:** [September 15, 2020, 12:50pm UTC](https://forum.inductiveautomation.com/t/internal-frame-activated-timing/38687 "2020-09-15T12:50:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![andreas](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andreas/32/18981_2.png) [@andreas](https://forum.inductiveautomation.com/u/andreas)\
**Post date:** [September 15, 2020, 12:50pm UTC](https://forum.inductiveautomation.com/t/internal-frame-activated-timing/38687/1 "2020-09-15T12:50:33Z")

</div>

Hi all,

I have a project where I open a header, main window and a navigation strip on startup.  
In my header I have several dynamic sparkline charts that display different trends for the last 24 hours. When I open a different window, the sparklines changes to some relevant trends for that specific window.

With the “internalFrameActivated” I use the following code snippet to change the tagpath to the sparkline charts:  
`
desktop = system.gui.getCurrentDesktop()
window = system.gui.desktop(desktop).getWindow(‘Screens/Header’)
window.getRootContainer().getComponent(“Group”).getComponent(“Sparkline Chart”).tagPath = “tagpathToSomeTag”
`

The sparkline charts updates fine. But it seems to be some kind of timing issue by doing it like this. When I save my project and press the “Project update available”-strip, I get a script evaluation error popup explaining me that “The window “Screens/Header” is not currently open”. Despite it is set to open on startup, and is clearly already open.

Is the “internalFrameActivated” event firing before the windows are opened on startup?

Anyone knows how to avoid this error to keep showing?

Ignition version 8.0.9  
Win 10

---

<div class="post-metadata">

**Author:** ![code\_skin](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@code\_skin](https://forum.inductiveautomation.com/u/code_skin)\
**Post date:** [September 15, 2020, 1:10pm UTC](https://forum.inductiveautomation.com/t/internal-frame-activated-timing/38687/2 "2020-09-15T13:10:30Z")

</div>

Is it possible for you to remove the entire internalFrameActivated script and use a Indirect Tag Binding on the Sparkline Charts’ _tagPath_ property?

---

<div class="post-metadata">

**Author:** ![andreas](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andreas/32/18981_2.png) [@andreas](https://forum.inductiveautomation.com/u/andreas)\
**Post date:** [September 15, 2020, 1:31pm UTC](https://forum.inductiveautomation.com/t/internal-frame-activated-timing/38687/3 "2020-09-15T13:31:03Z")

</div>

In such case, how am I going to change the sparkline tagPaths when changing windows? The internalFrameActivated is triggered each time a window is opened, and is why I used it to send new tagpaths to the different sparklines.

---

<div class="post-metadata">

**Author:** ![code\_skin](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@code\_skin](https://forum.inductiveautomation.com/u/code_skin)\
**Post date:** [September 15, 2020, 1:33pm UTC](https://forum.inductiveautomation.com/t/internal-frame-activated-timing/38687/4 "2020-09-15T13:33:44Z")

</div>

I see your point. I know I’m avoiding your original question but is it possible to pass in a tagPath to your sparkline chart windows and just use a binding this way?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [September 16, 2020, 12:27pm UTC](https://forum.inductiveautomation.com/t/internal-frame-activated-timing/38687/5 "2020-09-16T12:27:48Z")

</div>

You can wrap it in a try/except block. This example will just ignore the error, but it does give the option of doing something in case of an exception.

```python
try:
	desktop = system.gui.getCurrentDesktop()
	window = system.gui.desktop(desktop).getWindow('Screens/Header')
	window.getRootContainer().getComponent('Group').getComponent('Sparkline Chart').tagPath = 'tagpathToSomeTag'
except:
	pass

```

---

<div class="post-metadata">

**Author:** ![andreas](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andreas/32/18981_2.png) [@andreas](https://forum.inductiveautomation.com/u/andreas)\
**Post date:** [September 16, 2020, 12:54pm UTC](https://forum.inductiveautomation.com/t/internal-frame-activated-timing/38687/6 "2020-09-16T12:54:47Z")

</div>

The strange thing is that the sparkline charts gets updated every time we open a new window despite the error popping up saying the header is not currently open.  
The try/except block prevents the error to pop up on the clients.

Works great, thanks! 🙂
