# Gateway tag change script to play a sound

**URL:** <https://forum.inductiveautomation.com/t/gateway-tag-change-script-to-play-a-sound/22408>\
**Category:** Ignition\
**Created:** [February 7, 2019, 5:03am UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-script-to-play-a-sound/22408 "2019-02-07T05:03:36Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![joshdunstan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/joshdunstan/32/43306_2.png) [@joshdunstan](https://forum.inductiveautomation.com/u/joshdunstan)\
**Post date:** [February 7, 2019, 5:03am UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-script-to-play-a-sound/22408/1 "2019-02-07T05:03:36Z")

</div>

Trying to run a gateway tag change script to play a sound on the gateway only (no client running) at the push of a button on a PLC. The script runs, but the sound doesn’t play, possibly because its running in the background…?

Hopefully this is an easy one.

I’m sure I’ve done something like this before I just can’t find it!

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 7, 2019, 2:42pm UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-script-to-play-a-sound/22408/2 "2019-02-07T14:42:54Z")

</div>

Maybe if you modify the Ignition service so it runs as a different user or runs interactively or something?

---

<div class="post-metadata">

**Author:** ![joshdunstan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/joshdunstan/32/43306_2.png) [@joshdunstan](https://forum.inductiveautomation.com/u/joshdunstan)\
**Post date:** [February 7, 2019, 9:41pm UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-script-to-play-a-sound/22408/3 "2019-02-07T21:41:11Z")

</div>

Thanks Kevin, yes I changed the service to interact with the desktop but no good news…

---

<div class="post-metadata">

**Author:** ![ethomason](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ethomason/32/43338_2.png) [@ethomason](https://forum.inductiveautomation.com/u/ethomason)\
**Post date:** [February 7, 2019, 10:36pm UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-script-to-play-a-sound/22408/4 "2019-02-07T22:36:53Z")

</div>

What does your script look like currently? Also what version of Ignition.

---

<div class="post-metadata">

**Author:** ![joshdunstan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/joshdunstan/32/43306_2.png) [@joshdunstan](https://forum.inductiveautomation.com/u/joshdunstan)\
**Post date:** [February 7, 2019, 11:01pm UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-script-to-play-a-sound/22408/5 "2019-02-07T23:01:14Z")

</div>

It’s some seriously simple stuff… pretty sure its something to do with windows services not being able to play sounds.

```auto
if not initialChange:
	if newValue:
		soundFile = "sound.wav"
		soundPath = "C:\\"
		system.util.playSoundClip("%s%s" % (soundPath, soundFile), 1.0, 1)
		print "i played a sound"
	else:
		print "i didnt play a sound"

```

---

<div class="post-metadata">

**Author:** ![mrogers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mrogers/32/4110_2.png) [@mrogers](https://forum.inductiveautomation.com/u/mrogers)\
**Post date:** [February 7, 2019, 11:04pm UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-script-to-play-a-sound/22408/6 "2019-02-07T23:04:05Z")

</div>

Just a thought if you aren’t able to get it to play from the gateway context - you could have a client running on the gateway with some specific username/role, then you can send a message from the gateway to that client to play the sound.

---

<div class="post-metadata">

**Author:** ![joshdunstan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/joshdunstan/32/43306_2.png) [@joshdunstan](https://forum.inductiveautomation.com/u/joshdunstan)\
**Post date:** [February 7, 2019, 11:06pm UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-script-to-play-a-sound/22408/7 "2019-02-07T23:06:17Z")

</div>

8.0 beta [these words are for 20 char min]

---

<div class="post-metadata">

**Author:** ![joshdunstan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/joshdunstan/32/43306_2.png) [@joshdunstan](https://forum.inductiveautomation.com/u/joshdunstan)\
**Post date:** [February 7, 2019, 11:06pm UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-script-to-play-a-sound/22408/8 "2019-02-07T23:06:51Z")

</div>

was hoping to not run a client at all for this particular install

---

<div class="post-metadata">

**Author:** ![mrogers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mrogers/32/4110_2.png) [@mrogers](https://forum.inductiveautomation.com/u/mrogers)\
**Post date:** [February 7, 2019, 11:08pm UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-script-to-play-a-sound/22408/9 "2019-02-07T23:08:56Z")

</div>

Might want to post this question in the beta forums, then - that, or test your current solution on a 7.x server installed to confirm if its a beta problem or not.
