What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Request] Alert on specific message

[Request] Alert on specific message
Author: Message:
markee
Veteran Member
*****

Avatar

Posts: 1622
Reputation: 50
36 / Male / Flag
Joined: Jan 2006
RE: [Request] Alert on specific message
quote:
Originally posted by roflmao456
:banana:Welcome to the forum!:banana:
code:
var word = new Array(
"your",
"words",
"here"
);

function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind){
if(Origin != Messenger.MyName){
for(i=0;i<word.length;i++){
if(Message.search(word[i]) != -1){
MsgPlus.PlaySound("path\\to\\sound\\file");
}
}
}
}

i'm not sure if that will work but you can try.

btw, for a single backslash ( \ ) you have to put two. so

\\

will result in a single backslash ;)
Your code can be made a little better, the use of a regular expression means that you only have to make the one if statement rather than 2 and the for statement.  Also you might want to look at using things other than a search method because it doesn't give much that you can work with after (I know there was nothing in this case but it can be useful later and a good habit to get into).
code:
var word = new Array(
"your",
"words",
"here"
);
var re = RegExp("\b"+word.join("\b|\b")+"\b","i");

function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind){
if(Origin != Messenger.MyName && re.test(Message)){
MsgPlus.PlaySound("path\\to\\sound\\file");
}
}

This code does exactly the same as roflmao456's code anyway, I think the problem might be in the path that you are making.  Please make sure that you use the \\ and that you start from the drive letter and double check that the file exists where you are looking.

If that doesn't work then please try this code:
code:
MsgPlus.PlaySound("path\\to\\sound\\file");
This is just to make sure that the sound file is work and that you have the right path to it.  It should make the sound when you save the script.  I advise you to get rid of this once it has worked or else every time you start messenger then you will hear the sound.

If you keep having troubles can you please copy and paste the path that you are using to the file so that we can just double check you are doing it correctly and also make sure that you have your sound on (you'd be amazed at how many people don't think of the little things).
[Image: markee.png]
07-18-2007 04:45 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[Request] Alert on specific message - by glargle on 07-17-2007 at 11:51 PM
RE: [Request] Alert on specific message - by roflmao456 on 07-18-2007 at 12:25 AM
RE: [Request] Alert on specific message - by glargle on 07-18-2007 at 12:44 AM
RE: [Request] Alert on specific message - by roflmao456 on 07-18-2007 at 01:32 AM
RE: [Request] Alert on specific message - by glargle on 07-18-2007 at 01:45 AM
RE: [Request] Alert on specific message - by roflmao456 on 07-18-2007 at 02:30 AM
RE: [Request] Alert on specific message - by glargle on 07-18-2007 at 03:10 AM
RE: [Request] Alert on specific message - by roflmao456 on 07-18-2007 at 03:42 AM
RE: [Request] Alert on specific message - by glargle on 07-18-2007 at 04:33 AM
RE: [Request] Alert on specific message - by markee on 07-18-2007 at 04:45 AM
RE: [Request] Alert on specific message - by glargle on 07-18-2007 at 04:58 AM
RE: RE: [Request] Alert on specific message - by davidpolitis on 07-18-2007 at 06:39 AM
RE: RE: RE: [Request] Alert on specific message - by CookieRevised on 07-18-2007 at 10:46 PM
RE: [Request] Alert on specific message - by Spunky on 07-18-2007 at 12:25 PM
RE: RE: [Request] Alert on specific message - by davidpolitis on 07-18-2007 at 01:36 PM
RE: [Request] Alert on specific message - by glargle on 07-18-2007 at 02:50 PM
RE: [Request] Alert on specific message - by Spunky on 07-18-2007 at 03:47 PM
RE: [Request] Alert on specific message - by glargle on 07-18-2007 at 04:00 PM
RE: [Request] Alert on specific message - by Spunky on 07-18-2007 at 04:20 PM
RE: [Request] Alert on specific message - by glargle on 07-18-2007 at 04:28 PM
RE: [Request] Alert on specific message - by Spunky on 07-18-2007 at 05:14 PM
RE: [Request] Alert on specific message - by glargle on 07-18-2007 at 05:35 PM
RE: [Request] Alert on specific message - by Spunky on 07-19-2007 at 12:27 AM
RE: [Request] Alert on specific message - by glargle on 07-19-2007 at 01:14 AM
RE: [Request] Alert on specific message - by CookieRevised on 07-19-2007 at 09:47 AM
RE: [Request] Alert on specific message - by markee on 07-19-2007 at 01:08 PM
RE: [Request] Alert on specific message - by CookieRevised on 07-19-2007 at 03:20 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On