Update Project Programmatically

I have a project that is set to “Notify” users of an update instead of “Push”. This was done because we have multiple people working on the same project with each one publishing their own updates at different times. With so many publishes occurring it becomes a headache for the operators using the HMI if the update mode is set to Push, especially when looking at graphs, alarm status tables, etc. The one issue I have with using “Notify” is that we have some display TVs at our office that are used to show the project and, since no one uses them directly, they aren’t get updated very often.

Long story short, I’ve been trying to figure out if there is a way to automatically update projects based on the user name or role that is logged into the project. That way I can automatically update the TV displays while still allowing the Operators to update when they are ready. Is there any way to do this?

Thanks in advance,

1 Like

You could most likely use system.util.retarget and point the client back to the same app.
Then have a script that watches for the application version to change and call the function based on the IP address of the clients or the logged in user name.

docs.inductiveautomation.com/di … l.retarget

1 Like

Perfect! Thanks MMaynardUSG!

I ended up creating a Client Event Timer Script that checks the “[System]Client/System/EditCount” tag and compares it to a memory tag with last EditCount value. If the two don’t match and the TV display username is logged in, the script will update the last EditCount tag, retrieve project name from “[System]Client/System/ProjectName” (in case the name ever changes) and then retargets to the same project. Works like a charm. Thanks again!

P.S. - For anyone else trying this, I originally tried to do a Client Event Tag Change Script on the “[System]Client/System/EditCount” tag, instead of a timer script. For some reason the script would not consistently trigger (more often than not), so I ended up going with a timer script.

1 Like