12.4.23    MCISEND

Description:   Sends an MCI command string to multimedia devices including wave audio, Voice, MIDI, and Video. Downloads MCI file to client, if not found in local client directory.


Tcl:             MCISEND {mci command device arguments}

                  MCISEND "mci command device arguments"

JScript:        MCISEND ("mci command device arguments");              

VB Script:     MCISEND "mci command device arguments"


Argument:     MCI command string

Returns:        none

See Also:      


Examples:      # Tcl example 1 -  play thank you wave file

MCISEND {close wave}

MCISEND {open thankyou.wav type WaveAudio alias wave wait}

MCISEND {play wave}


# Tcl example 2 - open clap wave and play it

MCISEND "open waveaudio!clap.wav alias wave wait"

MCISEND "play wave"


# Tcl example 3 - open and play a MIDI file

MCISEND "open applause.mid type sequencer alias midi wait"

MCISEND "play midi"

MCISEND sends an MCI command string to multimedia devices including wave audio, Voice, MIDI, and Video.  The MCI files should be located in project root directory (not bgr).  The recommended location is:

Media Files requested by the "open" command  will be downloaded to the client if it does not exist in the local client project directory.  The Media file must have a file extension in order for the parser to determine it is a file. (actually, a dot or period is needed by the parser to distinguish the media file name). The source file must be in the project root directory of the SCADA node.

WARNING - large media files can require long time to download and can effectively lock-up your client while the download takes place. Be careful of using large media files.

Device Driver must be installed on Client

The client must have the appropriate Media Player device driver installed.  WebAccess is only sending a command to the media player (and will download the media data file).  For example, to play a sound wave file (*.wav), a sound card and speaker(s) must be installed on the client computer.  WebAccess will not use the default speaker to play wave files (unless the wave audio driver installed on the client supports it).  Similarly, WebAccess will not play MIDI sounds (*.mid) unless a MIDI sequencer and speaker(s) are installed on the client .  Some example device drivers are:

cdaudio        MCICDA.DRV

MMMovie        MCIMMP.DRV

sequencer      MCISEQ.DRV

videodisc      MCIPIONR

waveaudio      MCIWAVE.DRV

Device names supported by MCI command

There are several device types that are supported in the MCI standard. The devices are

cdaudio         - CD Audio player

dat               - Digital audio tape player

digitalvideo    - Digital video in a window, not GDI based

MMMovie       - Multimedia Movie Player

other            - Undefined MCI device

overlay          - Overlay device e.g. analogue video in a window

scanner         - Image scanner

sequencer      - MIDI sequencer

vcr               - Videotape player or recorder

videodisc       - Videodisc player

waveaudio     - Audio device that plays digitized waveform files e.g. soundblaster card.

Example of MCI commands.

A device needs to be opened before it will accept any other commands and it must be closed after you have finished with it. 
A typical use of MCI in a script will have lines similar to the following

# Tcl

MCISEND {open cdaudio}

MCISEND {play cdaudio}

MCISEND {stop cdaudio}

MCISEND {close cdaudio}

Obviously there is a need to have a pause between the first two and the last two commands here!  If the stop command  or close command is issued immediately after the play command, nothing happens.  It is possible to give a device an alias in the open command string and then use this alias in all the other commands, for example:

# Tcl

MCISEND {open applause.wav type WaveAudio alias wave wait}

MCISEND {play wave}

The wait flag

Normally MCI functions return control to the user immediately, even if the command takes several minutes to complete the action e.g. a tape starts to rewind but control is returned before the rewinding finishes which continues in the background. Adding the option wait to a command string tells MCI to wait until the requested action is complete e.g.

# Tcl

MCISend {play z wait}

will play the whole CD before returning control to the application.

Using all as a device name

It is possible to use all as the device name for any command that does not return data. The most common use would probably be:

MCISend {close all}

The MCISEND action command will interact with the <MCISEND> keymacro assigned to pushbuttons on displays. For example, a script might load the MCI file and wait for the pushbutton keymacro to play the MCI file.


See also %TMCIERROR, MCISEND, <MCISEND>,  Play a wav file  catch and display errors.