Question:
How can I play a sound file whenever the alarm is active?
Solution:
To do so, you must create a new event in the Viewer with this property/expression: AlarmServer1.ActiveNACKAlarms <> 0
Select “Whenever the expression is true” as the triggering event and check the option “Repeat Event every 1000 ms”. In the script, execute the PlaySound function.
Example:
Application.Playsound("Alarm.wav")
Notes regarding the sound file:
- It must be in Windows sound format (.WAV extension).
- If the file is in the project (added via Insert resource command), the name of the file must be between brackets. For example:
Application.PlaySound("[ringin.wav]")
- If a folder was created in the project and the file was added via Insert resource command, the file must be set between quotation marks. For example:
"Folder\ringing.wav"
- If the file is in the local folder, quotation marks will not be necessary, only the direct path.