What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » getting a message and a sound together

Pages: (2): « First [ 1 ] 2 » Last »
getting a message and a sound together
Author: Message:
OmarNajdi
New Member
*


Posts: 7
Joined: Nov 2010
O.P. getting a message and a sound together
hi
how can i use a sound when i write a message?

for example when i write (Please) it plays a sound
i really need this code ( It's my school project )
thx
11-11-2010 03:12 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
37 / Male / Flag
Joined: Dec 2002
Status: Away
RE: getting a message and a sound together
Do you mean how do you play a sound on your local computer when you type a message or are you wanting to play a sound on your contact's computer when you type a specific message?

The first one is possible the second one both would need the script.

You will need to give us more details on how this is supposed to work so we can point you in the correct direction.
11-11-2010 04:37 PM
Profile E-Mail PM Find Quote Report
OmarNajdi
New Member
*


Posts: 7
Joined: Nov 2010
O.P. RE: getting a message and a sound together
first, thanks for trying to help , i wish you continue with me

OK I didn't understand if the second one isn't possible
I wish to know each one how I can do it if it's possible

and here is the code
code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message){
    switch (Message){
        case "/sstart":
            sEnabled = true
            return '';
        case "/sstop":
            sEnabled = false;
            return '';
        default:
            if (sEnabled = true){
                Message = Message.replace(/that/gi,"­Št");
                return "" +Message;
        }


OK i need the letter in red to be spoken after i send it
where should I write the code and how

thanks a lot,
Omar
11-11-2010 07:51 PM
Profile E-Mail PM Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
RE: getting a message and a sound together
You still need to tell us a bit more about what exactly you want to achieve here.
  • What exactly do you want to be played?  Do you want the message to be read out, or a specific sound?
  • Do you want to hear the sound, or do you want the contact to hear it?
JScript code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
    switch (Message)
    {
        case "/sstart":
            sEnabled = true;
            return "";
        case "/sstop":
            sEnabled = false;
            return "";
        default:
            if (sEnabled)
            {
                Message = Message.replace(/that/gi, "­Št");                return Message;
            }
            break;
    }
}

  • What is the replace line for?  Do you want to play the sound if the replacement occurs in the message?
Also, you should use [code=js] for syntax highlighting when posting your code here.  ;)
11-11-2010 08:38 PM
Profile E-Mail PM Find Quote Report
OmarNajdi
New Member
*


Posts: 7
Joined: Nov 2010
O.P. RE: getting a message and a sound together
sry about the code cuz I'm new

OK, i need the word (that) to be played for the one who I'm talking with after i write it
I wish it could be the message I've written, but there's no problem to be a specific sound that I've recorded
the replace line is for replacing the word to another word, the same word i need to hear

thank you.
11-12-2010 01:23 AM
Profile E-Mail PM Find Quote Report
ryxdp
Senior Member
****


Posts: 804
Reputation: 16
27 / Male / Flag
Joined: Jun 2006
RE: getting a message and a sound together
If you're talking about text-to-speech, I've written a script to do just that, using Windows's default TTS engine. It narrates your contact's messages with the option of saying display names as well as your own messages. Hopefully this'll help, but as it's for your school project it might not be the best of solutions. Still, you can take a look through the code if you want and adapt it to how you like, just ask and I can send it to you :P

This post was edited on 11-12-2010 at 11:40 AM by ryxdp.
11-12-2010 11:39 AM
Profile PM Find Quote Report
OmarNajdi
New Member
*


Posts: 7
Joined: Nov 2010
O.P. RE: getting a message and a sound together
that's exactly what I want
it's not necessary to be my school project , it's just an idea
please send it to me , I'll me so grateful
sorry for the delay
and I'm waiting
11-15-2010 11:59 AM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: getting a message and a sound together
Some basic (and a bit more advanced) examples of using the Windows Speech API in JScript:
JScript code:
var oVoice = new ActiveXObject("SAPI.SpVoice");
 
with (oVoice) {
    Voice = GetVoices()[0];
    Volume = 100;
 
    // basic example
    Rate = 1;
    Speak("Hello. This is a basic example of the speech Windows API");
 
    // XML example, changing pitch
    Rate = -2;
    Speak('<pitch middle="-25">Hello, I am a robot</pitch>' ,8);
 
    // XML example, using some other tags
    Rate = 0;
    Speak('<pitch absmiddle="30"><rate absspeed="-2">Now I\'m going to use a whining voice to spell the word: school<silence msec="500"/><rate speed="-3"><spell>school</spell></rate></rate></pitch>', 8);
 
    // XML example, difference in pronunciations
    Rate = 0;
    Speak('Did you <partofsp part="verb">record</partofsp> that <partofsp part="noun">record</partofsp>?',8);
}

You can do a lot more though.
The SAPI help file (sapi.chm) can be downloaded from:
http://www.microsoft.com/downloads/en/details.asp...-B0EE-6583171B4530

This post was edited on 11-15-2010 at 06:30 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
11-15-2010 06:25 PM
Profile PM Find Quote Report
OmarNajdi
New Member
*


Posts: 7
Joined: Nov 2010
O.P. RE: getting a message and a sound together
sorry for my late answer

now how can I get this sound when I type it ?
where should I put the code ?
11-18-2010 02:05 AM
Profile E-Mail PM Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
RE: getting a message and a sound together
You should use the OnEvent_ChatWndReceiveMessage() function.  Define the ActiveX object globally (outside any functions).  Then you can pass the Message parameter to oVoice.Speak() within the message event.
11-18-2010 10:22 AM
Profile E-Mail PM Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


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