SoundSetMute

Changes a mute setting of a sound device.

SoundSetMute NewSetting , Component, Device

Parameters

NewSetting

Type: Integer

One of the following values:

Component

Type: String or Integer

If blank or omitted, it defaults to the master mute setting. Otherwise, specify the component's display name and/or index, e.g. 1, "Line in" or "Line in:2".

For further details, see Component (Sound Functions).

Device

Type: String or Integer

If blank or omitted, it defaults to the system's default device for playback (which is not necessarily device 1). Otherwise, specify the device's display name and/or index, e.g. 1, "Speakers", "Speakers:2" or "Speakers (Example HD Audio)".

For further details, see Device (Sound Functions).

Error Handling

A TargetError is thrown if the device or component could not be found or if the component does not support this control type. Otherwise, an OSError is thrown on failure.

Remarks

An alternative way to toggle the master mute setting of the default playback device is to have the script send a keystroke, such as in the example below:

Send "{Volume_Mute}"  ; Mute/unmute the master volume.

To discover the capabilities of the sound devices installed on the system -- such as the names and available components -- run the soundcard analysis script.

Use SoundGetMute to retrieve the current mute setting.

Sound Functions

Examples

Turns on the master mute.

SoundSetMute true

Turns off the master mute.

SoundSetMute false

Toggles the master mute (sets it to the opposite of its current state).

SoundSetMute -1

Mutes Line In.

SoundSetMute true, "Line In"

Mutes microphone recording.

SoundSetMute true,, "Microphone"