Gateway tag change script to play a sound

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!

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

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

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

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

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"

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.

8.0 beta [these words are for 20 char min]

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

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.

2 Likes