Can I call a Project Script from a Gateway Timer Script?

Hello,
I am using a Gateway timer script currently to do read/ write a few tags on a daily basis. I need to add functionality on a daily basis that I currently have in a Project Script?
Can I call a Project Script from Inside a Gateway Timer Script? Is there any weird syntax?
My current Gateway Timer script just reads and writes to two tags. My Project Script that I plan to add just reads and a few tags. I did just review my Project script and I read from the following:

“system.tag.read(”[System]Client/User/OSUsername").value"

I have a feeling the above Read might break when I call the Project Script from a Gateway Timer script? Probably need to modify the Project Script with some Try/ Excepts to handle not being able to read the above tag. That’s under the assumption I can call a Project Script from a Gateway Timer script.

Yes, you may call project.script.function() from gateway timer events. In fact, they are usable from any Gateway Event Script present in the “Gateway Event Scripts” dialog. The caveat is that there are no GUI-related functions in system.*, and none of the corresponding java classes can be imported. There are a few other nuances, but you should be fine if you set up a separate project script just for gateway operations. On a related note, this makes Gateway Tag Change Events (from the same dialog) far superior to Tag Events (defined directly on the tag).

1 Like