Skip to main content

Play Sound

Octory PRO
Element type: Dictionary

Play a system or a custom sound (MP3, MP4, WAV). You can find the system sounds list at /System/Library/Sounds/.

Keys

NameTypePossible valuesRequired
TypeStringPlaySoundRequired
SoundNameOrFilePathString-Required
ConditionDictionary (Condition)-

Detail

Type Required

Type: String
Explanation: The type of the action has to be PlaySound.

SoundNameOrFilePath Required

Type: String
Explanation: The system name of the sound to play (wihtout .aiff), or a path to a sound file to play. Empty value will play system sound “Hero”.

Condition

Type: Dictionary (Condition)
Explanation: Allows launch the action only based on a boolean expression.

Example

Play a custom sound in the file path ${Resources}/Sounds/welcome-user.mp3. Note the usage of the custom variable “Resources”.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- ... -->
<key>ActionSets</key>
<array>
<dict>
<key>Type</key>
<string>Parallel</string>
<key>Triggers</key>
<array>
<string>NextButtonClick</string>
</array>
<key>Actions</key>
<array>
<dict>
<key>Type</key>
<string>PlaySound</string>
<key>SoundNameOrFilePath<key>
<string>${Resources}/Sounds/welcome-user.mp3</string>
</dict>
</array>
</dict>
</array>
<!-- ... -->
</dict>
</plist>

Play the system sound named “Bottle”.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- ... -->
<key>ActionSets</key>
<array>
<dict>
<key>Type</key>
<string>Parallel</string>
<key>Triggers</key>
<array>
<string>NextButtonClick</string>
</array>
<key>Actions</key>
<array>
<dict>
<key>Type</key>
<string>PlaySound</string>
<key>SoundNameOrFilePath<key>
<string>Bottle</string>
</dict>
</array>
</dict>
</array>
<!-- ... -->
</dict>
</plist>