# How to fetch Gateway Tag Change Script status programmatically

**URL:** <https://forum.inductiveautomation.com/t/how-to-fetch-gateway-tag-change-script-status-programmatically/65056>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [October 11, 2022, 8:48am UTC](https://forum.inductiveautomation.com/t/how-to-fetch-gateway-tag-change-script-status-programmatically/65056 "2022-10-11T08:48:14Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![SARAVANAN\_G](https://avatars.discourse-cdn.com/v4/letter/s/3be4f8/32.png) [@SARAVANAN\_G](https://forum.inductiveautomation.com/u/SARAVANAN_G)\
**Post date:** [October 11, 2022, 8:48am UTC](https://forum.inductiveautomation.com/t/how-to-fetch-gateway-tag-change-script-status-programmatically/65056/1 "2022-10-11T08:48:14Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [October 11, 2022, 4:09pm UTC](https://forum.inductiveautomation.com/t/how-to-fetch-gateway-tag-change-script-status-programmatically/65056/2 "2022-10-11T16:09:09Z")

</div>

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?  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/7/97aa3c20ba22fee542e36743b43a6b17de4d8141.png)

---

<div class="post-metadata">

**Author:** ![SARAVANAN\_G](https://avatars.discourse-cdn.com/v4/letter/s/3be4f8/32.png) [@SARAVANAN\_G](https://forum.inductiveautomation.com/u/SARAVANAN_G)\
**Post date:** [October 12, 2022, 4:04am UTC](https://forum.inductiveautomation.com/t/how-to-fetch-gateway-tag-change-script-status-programmatically/65056/3 "2022-10-12T04:04:31Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/0/30de692f19f6b05405c7a8128ca8432aec940a44.png)

---

<div class="post-metadata">

**Author:** ![kcollins](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kcollins/32/19646_2.png) [@kcollins](https://forum.inductiveautomation.com/u/kcollins)\
**Post date:** [October 12, 2022, 1:14pm UTC](https://forum.inductiveautomation.com/t/how-to-fetch-gateway-tag-change-script-status-programmatically/65056/4 "2022-10-12T13:14:58Z")

</div>

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):

```python
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.

---

<div class="post-metadata">

**Author:** ![SARAVANAN\_G](https://avatars.discourse-cdn.com/v4/letter/s/3be4f8/32.png) [@SARAVANAN\_G](https://forum.inductiveautomation.com/u/SARAVANAN_G)\
**Post date:** [October 13, 2022, 4:40am UTC](https://forum.inductiveautomation.com/t/how-to-fetch-gateway-tag-change-script-status-programmatically/65056/5 "2022-10-13T04:40:45Z")

</div>

I am unable to import IgnitionGateway 🙁

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/6/f673c8064fb507e6d760f2f1c2e69219fb005204.png)

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [October 13, 2022, 5:46am UTC](https://forum.inductiveautomation.com/t/how-to-fetch-gateway-tag-change-script-status-programmatically/65056/6 "2022-10-13T05:46:00Z")

</div>

The script console is designer scope; IgnitionGateway can only be imported from the gateway scope.

> [@How to get "GatewayContext" in Gateway Event (timer) script](https://forum.inductiveautomation.com/t/how-to-get-gatewaycontext-in-gateway-event-timer-script/24668/16):
>
> No, it’s just only accessible in Gateway scope, and you’re in Designer scope in the script console.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [October 13, 2022, 5:57am UTC](https://forum.inductiveautomation.com/t/how-to-fetch-gateway-tag-change-script-status-programmatically/65056/7 "2022-10-13T05:57:47Z")

</div>

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:

> **[Script Console with Gateway Scope | Voters | Inductive Automation](https://inductiveautomation.canny.io/ignition-features-and-ideas/p/script-console-with-gateway-scope)**

It seems like this would be a really handy feature

---

<div class="post-metadata">

**Author:** ![SARAVANAN\_G](https://avatars.discourse-cdn.com/v4/letter/s/3be4f8/32.png) [@SARAVANAN\_G](https://forum.inductiveautomation.com/u/SARAVANAN_G)\
**Post date:** [October 13, 2022, 9:34am UTC](https://forum.inductiveautomation.com/t/how-to-fetch-gateway-tag-change-script-status-programmatically/65056/8 "2022-10-13T09:34:51Z")

</div>

Thanks a lot Kcollins1 🙂...... now i am able fetch the details from the gateway scripts.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 13, 2022, 12:22pm UTC](https://forum.inductiveautomation.com/t/how-to-fetch-gateway-tag-change-script-status-programmatically/65056/9 "2022-10-13T12:22:15Z")

</div>

> [@kcollins](#):
>
> Be advised that this under-the-hood method could change/break with new Ignition versions in the future.

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.

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [October 13, 2022, 12:52pm UTC](https://forum.inductiveautomation.com/t/how-to-fetch-gateway-tag-change-script-status-programmatically/65056/10 "2022-10-13T12:52:14Z")

</div>

I wonder why such status information is required in modules or scripts!
