ResNullius Posted August 11, 2007 Posted August 11, 2007 (edited) After helping out on this thread http://www.autoitscript.com/forum/index.ph...=50966&st=0I decided to make a few changes and now you can call any of the standard message boxes that AutoIt can create and assign your choice of wav sounds to be played. If you omit the parameter $sSound then the deafult sound is used. To have a silent MsgBox, then pass $sSound as "".MsgBox(32, "Hey...", "What's that?") _MsgBoxSound(32 + 4, "", "Aren't you going to answer the phone", 0,@WindowsDir & "\MEDIA\ringout.wav") _MsgBoxSound(32, "Well...", "Who was it?",0, "") ; no sound MsgBox(32,"Huh...","What do you meany you can't hear me?") Func _MsgBoxSound($iFlag, $sTitle, $sText, $nTime = 0, $sSound = "default") Local $aEventSounds[3][5] = [[0, 16, 32, 48, 64], [".DEFAULT", "SystemHand", "SystemQuestion", "SystemExclamation", "SystemAsterisk"], ["", "", "", ""]] If StringLower($sSound) = "default" Or Not FileExists($sSound) AND $sSound <> "" Then Return MsgBox($iFlag, $sTitle, $sText, $nTime) Else For $iFlagIndex = 64 To 0 Step - 16 If BitAND($iFlag, $iFlagIndex) = $iFlagIndex Then Local $iEventIndex = $iFlagIndex / 16 $aEventSounds[2][$iEventIndex] = RegRead("HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\" & $aEventSounds[1][$iEventIndex] & "\.Current", "") RegWrite("HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\" & $aEventSounds[1][$iEventIndex] & "\.Current", "", "REG_EXPAND_SZ", $sSound) Local $nMsgBox = MsgBox($iFlag, $sTitle, $sText, $nTime) RegWrite("HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\" & $aEventSounds[1][$iEventIndex] & "\.Current", "", "REG_EXPAND_SZ", $aEventSounds[2][$iEventIndex]) Return $nMsgBox EndIf Next EndIf EndFunc ;==>_MsgBoxSoundedit: thanks also (as usual) to SmOke_N whose code in the earlier mentioned thread formed the basis of the udf's core Edited August 11, 2007 by ResNullius
RazerM Posted August 11, 2007 Posted August 11, 2007 Nice function, although whilst the second msgbox is open, and another msgbox from a different app opens up with same flags, it will also have phone sound. My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
ResNullius Posted August 11, 2007 Author Posted August 11, 2007 Nice function, although whilst the second msgbox is open, and another msgbox from a different app opens up with same flags, it will also have phone sound.True, but I'm not smart enough to do whatever custom dll calls you'd need to make to do it any other way, if it's possible. Of course you can always program you own GUI msgbox and play a sound on its appearance, but I just thought this would be simple for some folk to use...
Skizmata Posted August 14, 2007 Posted August 14, 2007 Very good work, useful and allot can be learned from it. Thanks! AutoIt changed my life.
mrbond007 Posted August 14, 2007 Posted August 14, 2007 @ResNullius Nice you can also create a customized gui and use SoundPlay with it, instead of creating a MsgBox and modifiying the registry Projects : Space Regain - Memory Fusion - PWGT - Chip-ITGames : BrainPain - BrainPain Director's Cut - ProSpeed Games Pack (New)Vista vs XP : the forbidden fight
ResNullius Posted August 14, 2007 Author Posted August 14, 2007 @ResNulliusNice you can also create a customized gui and use SoundPlay with it, instead of creating a MsgBox and modifiying the registry I know, see my last post 2 posts back:Of course you can always program you own GUI msgbox and play a sound on its appearance, but I just thought this would be simple for some folk to use...
jennico Posted November 7, 2008 Posted November 7, 2008 very cheeky what you're doing ! very nice. thanks a lot. another way to manipulate sounds would be to temporarily rename the files themselves. but i have no idea which method would be faster or more secure. j. Spoiler I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Don't forget this IP: 213.251.145.96
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now