How to run a script on a client project update?

I’m sure this has been staring me in the face, but how do I create a client script that will run when the client applies an application update?

Thanks
Jesse

Hmm, well, good news is that it’s not staring you in the face - I don’t think there is a way to do this. I’ve never heard anyone want to do this before - can you explain why you’d like to run a script when the client updates?

What I’m trying to do, overall, is create a project that will auto-update its navigation tab bar based on the folder structure of the project. (If there’s a slick way to do this, let me know.)

Basically, I currently have a refresh button that calls the system.gui.getWindowNames() to get a list of all the windows in the project. From there, I parse it into a tree structure and use that to create a dataset that defines tabs based on the top-level folders in the project and the format that was previously set, and put that in to a tab strip to navigate the project.

Currently, when I add or remove a folder from the project window structure, I have to hit the Refresh button to re-enumerate the folders. What I would like to do is have a script fire when the project is updated that would run the refresh script for me. I know I could use a timer script, but it seems like it will either be slow to update or hog a lot of resources, depending on the interval I choose.

I tried using the startup script, but that doesn’t seem to fire on update, only on a fresh start. Another idea I had was to somehow make a client tag have a certain default value that would cause a conditional script to fire, and then reset that tag, but I would have to be able to guarantee that when the project was pushed out to the clients, that tag would have a specific value that was different than what the client had reset it to (if that makes any sense…)

Any ideas?

Try putting the script in the [tt]internalFrameActivated[/tt] event of the window that has the tabs on them. That should fire when the client is updated. It’ll also fire when the window gets focus, but I think that this script won’t take any significant resources to run.

Works great. My problem turned out to be that I had only tried right-clicking on the window in the project browser, and hadn’t gone to the Component menu to find the scripts. Thanks!

How do I use the internalFrameActivated event of a window?

I know I am being daft but I was expecting it to be an event group of a root container, maybe I am misunderstanding its use.

Can you use it via a propertyChange using

if event.source == event.internalFrameActivated:

or something similar?

All I want to do is set the tab strip to show the current tab as the first tab (selectedTab = “Tab1”) on the tab strip window opening.

The internalFrameActivated is a event on the actual window not the root container. Click on the window in the Project Browser and hit Ctrl-J to see it.

In your case you don’t want to use the internalFrameActivated. Just bind the selected tab property of the tab strip to the following expression:"Tab1"So when you open the window tab 1 will be the frist one selected. Property binding is the easiest way to accomplish that.

Thanks - that worked a treat, thats a much better way to do it

Any chance we can have a feature request to add the event handlers to the right click window drop down menu in the project browser?

I looked everywhere for that and because it wasnt on the list I figured it must have been the root container it needed to be done from. Even from the help file I figured it was the window but then thought it must have meant it was the root container in the window because it wasnt on the menu.

It just seems a bit hidden…

Daniel - I recommend posting feature requests as a separate thread in the Ignition Feature Request section of the forum. I recommend being concise about what you want with a quick example or justification. It’s more likely to get noticed there than burried within another design help thread.

We did end up adding the event scripts entry to the right-click menu for windows, should be in 7.3.1.