#include-once ; #FUNCTION# ========================================================================================================= ; Name...........: _AudBox ; Description ...: Creates a notification combination of MsgBox and SoundPlay with volume control ; Syntax.........: _AudBox($flg, $Title, $txt, [$timeout, [$guiHWND, [$Aud, [$wait, [ $Volume]]]]]) ; Requirement(s).: v3.2.12.1 or higher ; Author ........: Wombat ; Example........; No ;===================================================================================================================== Func _AudBox($flg, $Title, $txt, $timeout=0, $guiHWND='', $Aud=1, $wait=0, $Volume=0) Local $auFLAG, $auTITLE, $auTEXT, $auTIMEOUT, $auHWnd=$guiHWND, $auSOUND, $auWAIT, $MsgRet ;Set the flag If $flg='' Then $auFLAG=0 Else $auFLAG=$flg EndIf ;Set the title Switch $Title Case 1 $auTITLE="Windows Notification" Case 2 $auTITLE=@ScriptName & " - Error!" Case 3 $auTITLE=@ScriptName & " - Attention!" Case 4 $auTITLE=@ScriptName & " - Done!" Case 5 $auTITLE=@UserName & ", please contact an administrator!" Case Else If IsString($Title) Then $auTITLE=$Title Else If $Title=Default Then $auTITLE=@ScriptName If $Title='' Then $auTITLE=@ScriptName EndIf EndSwitch ;Set the text If $txt='' Then If Not @Compiled Then ConsoleWriteError("ERROR! - _AudBox() function was not provided with text" & @CRLF) Return SetError(1, 3, "No text provided") Else $auTEXT=$txt EndIf ;Set the timeout If $timeout=Default Then $auTIMEOUT=0 Else $auTIMEOUT=$timeout EndIf ;Set the audio Switch $Aud Case 2 $auSOUND = @WindowsDir & "\Media\Windows Error.wav" Case 3 $auSOUND = @WindowsDir & "\Media\Windows Notify.wav" Case 4 $auSOUND = @WindowsDir & "\Media\Windows Ding.wav" Case 5 $auSOUND = @WindowsDir & "\Media\Windows User Account Control.wav" Case 6 $auSOUND = @WindowsDir & "\Media\Windows Balloon.wav" Case 7 $auSOUND = @WindowsDir & "\Media\Windows Default.wav" Case 8 $auSOUND = @WindowsDir & "\Media\Windows Exclamation.wav" Case 9 $auSOUND = @WindowsDir & "\Media\Windows Navigation Start.wav" Case Else $auSOUND=$Aud EndSwitch ;Set the wait behavior If $wait=Default Then $auWAIT=0 Else $auWAIT=$wait EndIf ;Set volume If $Volume=Default Then SoundSetWaveVolume(15) Else SoundSetWaveVolume($Volume) EndIf SoundPlay($auSOUND, $auWAIT) $MsgRet = MsgBox($auFLAG, $auTITLE, $auTEXT, $auTIMEOUT, $auHWnd) Return $MsgRet EndFunc