Hi,
I want to fetch gateway tag change script status in ignition. How can i get that?
is there any functions to get the status?
I'm not sure that I understand the question. Are you looking for a way to programmatically obtain any or all of the Boolean values depicted below?
Hi,
Thanks for your response.
actually i have asked for fetching the status of tag change script from gateway. Please find the below screenshots for your reference.
We don't have a "supported" method for programmatically accessing this information. However, you can currently get it via scripting from the IgnitionProjectManager using something like below (in gateway scope):
from com.inductiveautomation.ignition.gateway import IgnitionGateway
from com.inductiveautomation.ignition.common.script import ProjectScriptDiagnostic
project_name = "Test"
logger = system.util.getLogger("com.example.diagnostics")
# Get a reference to the IgnitionProjectManager
gateway = IgnitionGateway.get()
project_manager = gateway.getProjectManager()
# Retrieve a list of ProjectScriptDiagnostic objects for Tag Change scripts for a specific project
diagnostics_list = project_manager.getProjectScriptDiagnostics(project_name, ProjectScriptDiagnostic.DiagnosticType.TAG_CHANGE)
# Iterate through the ProjectScriptDiagnostic results for each tag change script.
for diagnostics in diagnostics_list:
logger.info("Script name: %s" % diagnostics.getName())
last_execution = system.date.fromMillis(diagnostics.getLastExecution())
logger.info("Last execution: %s" % system.date.format(last_execution, "YYYY-MM-dd HH:mm:ss.SSS"))
error_message = diagnostics.getErrorMessage()
# error_message will be null/None if script has not run or if there is no error
if error_message is not None:
logger.warn("Error message: %s" % error_message)
Be advised that this under-the-hood method could change/break with new Ignition versions in the future.
The script console is designer scope; IgnitionGateway can only be imported from the gateway scope.
There is an open feature request to allow the script console to have the option of gateway scope if you would like to upvote it:
It seems like this would be a really handy feature
Thanks a lot Kcollins1 ...... now i am able fetch the details from the gateway scripts.
Most IA employees around here won't even show a script with an IgnitionGateway
import. They make 'em work for it with hints and semi-evasive comments. To emphasize how dangerous this is.
I wonder why such status information is required in modules or scripts!