Shoutbox

Play sound effect upon program launch. - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: WLM Plus! Help (/forumdisplay.php?fid=12)
+----- Thread: Play sound effect upon program launch. (/showthread.php?tid=98554)

Play sound effect upon program launch. by malovon on 11-14-2011 at 10:41 AM

Hello, i have been trying to figure out if it's possible to add a sound effect when you start MSN messenger, so far it seems not likely, but i thought I'd try asking here if anyone know.
I know you can add a sound effect through windows when you launch any program, but that's just a little too much spam, and it also doesn't work all the time.   Anyway, thanks in advance.


RE: Play sound effect upon program launch. by matty on 11-14-2011 at 11:36 AM

A script could be written to do so when you sign in...


RE: Play sound effect upon program launch. by malovon on 11-14-2011 at 11:46 AM

Well, i don't know much about writing scripts, practically nothing really.


RE: Play sound effect upon program launch. by CookieRevised on 11-14-2011 at 01:05 PM

This script will play a sound when Messenger starts:

Javascript code:
var sSoundFile = "C:\\directory\\sound.mp3";
function OnEvent_Initialize(bMessengerStart) {
    if (bMessengerStart) {
        MsgPlus.PlaySound("\\" + sSoundFile);
    }
}


- Open the scripting editor in Plus!
  (Plus! > Preferences & Options > Plugins > Plus! Plugins)
- Click on "create new..."
- Fill in the name of the new script.
- In the editor copy/paste the code above
- Change the path and file name to the sound (mp3, wav, voc, au, ... but not wma files) you want.
- Press "Save All"

If you want to learn scripting in Plus! you can read the documentation here or download it here.
RE: Play sound effect upon program launch. by malovon on 11-14-2011 at 01:13 PM

Hey, thanks a lot!
This works perfectly.


RE: Play sound effect upon program launch. by CookieRevised on 11-14-2011 at 03:07 PM

PS: Another method you can use, for any program you want, is to make a small batch file/Windows script which you need to run instead of the program itself:

VBScript code:
sSoundFile = "C:\directory\sound.mp3"
sProgramFile = "C:\Program Files\Windows Live\Messenger\msnmsgr.exe"
'Don't forget to update the proper paths in above variables

Set oWshShell = CreateObject("Wscript.Shell")
oWshShell.Run Chr(34) & sProgramFile & Chr(34)

Set oMCI = CreateObject("MCI.MMcontrol")
oMCI.Command = "Close all"
oMCI.FileName = sSoundFile
oMCI.Command = "Open"
oMCI.Wait = True
oMCI.Command = "Play"

Set oWshShell = Nothing
Set oMCI = Nothing
Save that as a file named "whatever.vbs" (the file extension VBS is important!) and start this instead of Messenger itself.

More about VBScript can be found here.