Multiple sounds played from a single bit and scripting flashing

I’m new to ignition but have used other scada programs in the past. there are two things I want to be implemented but i’m having trouble implementing them

  1. I’m trying to make multiple sounds play from a single multi-state button.
    i have two states open and close. When I push open on the button it should play the opening sound and when I push closed it should play the closing sound. Currently I have tried to script around the problem but it either doesn’t play the sound at all (has an error that it can’t find the file) or plays both at once.
  2. I have various labels that display values read in from a plc. I need to have these labels flash (or even just change the color) if they are below a set-point that can be changed at anytime in the client from a numeric text field. I did achieve changing the color of the text in the label but it didn’t function reliably.

in both cases above I was using if statements to check if the required needs where met.
i.e in the first case:

if control value = 1:
    play opening sound
else
    play closing sound

or in the second case I was using:

if setpoint > labelValue:
change color to red
else
change color to blue

is my logic wrong or is there any better way to implement this?

Try do something like this for your first issue:

#check if the event that has fired is the IndicatorValue and also that the IndicatorValue has changed
if event.propertyName == 'IndicatorValue' and event.newValue != event.oldValue:
	
	#list of cases
	if event.newValue == 0:
		system.util.playSoundClip('path/to/the/first/wav/file.wav')
	elif event.newValue == 1:
		system.util.playSoundClip('path/to/the/second/wav/file.wav')
	elif event.newValue == 2:
		system.util.playSoundClip('path/to/the/wav/file.wav')

About your second issue you can do like this:

-Select the label you want to change color
-Click on the “Database” Icon of property “Backgorund Color” or “Foreground Color”
-Select Property
-Link the selected property to your “Value” of the Numeric Text Field
-You will see a table that says Number to color translation
-Here you can set at what number the selected property has to change color
-Click OK

Hope this can help you :slight_smile: