KB-17370: Playing a sound file whenever alarm is active.

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.
Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *