PlaySound - method of object Pm

Playing the *.wav sound file by the Promotic sound server. The system is able to play one sound at a time. Therefore the sound requests are queued into the sound server. The order of the sound requests is based on priority and time of origin.
PlaySound(sSound As String)
Pm.PlaySound sSound
sSound(String) The sound parameters define the way the sound is played. For example: "file:#pmres:Sound/hoot01.wav;repeat:5;".
file:xx; - Sound file. It is recommended to use the PROMOTIC path syntax - see PROMOTIC path to files and folders.

There are some *.wav files located in the Promotic folder ("/Pm/Resource/Sound") that can be used. The link to these files is for example #pmres:Sound/alarm01.wav. The designer can create personal files and place them into the application source folder (see the configurator "Paths to system folders"). For example of the filelink: #appres:MySound1.wav.

repeat:nn; - The number of sound repeat (1 = default, -1 = unlimited).
stop:nn; - Allows to remove the sound requests created by the PlaySound method from the sound queue.
0 (default) - Does nothing.
1 - Removes the sound requests created by the PlaySound method from the sound queue. Other options (file and repeat) are ignored in such case.
- The method is asynchronous, i.e. the impulse for sound playback is generated, but the system does not wait for actual execution of such command (therefore the method does not return the completion report).
- For playing the sound file it is necessary that the system has a functional sound card installed.
The method can also be called in the graphic item events for Web panels. In such case the method has following limitations:
- Each sound playback in the Web panel will terminate the playback of previous sound (the sound server is not present in the Web panels).
- The InternetExplorer browser does not support playback of wav files (Chrome, Firefox support this format). This method on Web supports playback of mp3 files (this format is supported by all browsers), but this format is not supported by local application. Therefore if it is required to have this method working both in InternetExplorer and in local application, then it is necessary to create the sond files in both formats and play one file in local application and the other file on Web. See Example3
The old syntax of this method returned 0 (success) or 1 (error) and had three parameters:
sFile (String) - The file name with the path. If the value is an empty string, then playing the just played sound file is stopped.
nPriority (Long) - Priority (reserved, set to 0).
nFlags (Long) - Flags that identify the way how to play the sound (can be summed).
1 - (NoStop) - The flag causes that the just played sound file won't be interrupted and the method will stop immediately with the error flag (returns 1) (it can be used for testing if there is or isn't played up the sound file).
2 - (Loop) - The flag makes the file playback continue in endless loop. The playback is terminated by opening another sound file.
Playback (queueing into the sound server) of the sound file
VBScriptSelect and copy to clipboard

Pm.PlaySound "file:#pmres:Sound/hoot01.wav;"
Cancelling all requests in the sound server queue, created by the PlaySound method.
VBScriptSelect and copy to clipboard

Pm.PlaySound "stop:1;"
Calling the method in panel that is functional in both local application and on the Web (Chrome, Firefox, Edge, InternetExplorer ..). The application designer has to convert the wav file into mp3 format and save it into the file folder #appres:.
JavaScriptSelect and copy to clipboard

if (1 == pMe.Root.ClientType)
PROMOTIC 8.3.30 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
- Pm
- Abs
- Cos
- E
- Exp
- LN2
- PI
- PlaySound
- Pow
- Sin
- Tan
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice