Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Little Msn Script help
#1
Hello, This is someone elses script but i want to edit it for my personal use. Anyway here is the code;

Code:
function FilterString( str )
{
    var googleMatches = null;
    
    //While a match is found to the regular expression
    while( (googleMatches = str.match( "Google\\(.*?\\)" )) != null )
    {
        //Get string
        var googleString = googleMatches[0];
        Debug.Trace( googleString )
        
        //Get the search text
        var searchText = googleString.substring(7, googleString.length-1);
        
        //Replace all spaces with +'s
        searchText = searchText.replace(' ', '+');
        
        //Make it into it's final form
        searchText = "http://lmgtfy.com/?q=" + searchText;
        
        //Replace
        str = str.replace( googleString, searchText );
    }
    
    //Return
    return str;
}

function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
    return FilterString( Message );
}

What i want to change it instead of it replace the text that i send e.g 'Google(test)'

I want it to send 'Google (test)' then the link.
Thanks for help Smile
Reply
#2
I don't really understand what you want to do.
Please put the code into [ code ] [/ code ] tags (without whitespace)

The code matches Google\\(.*?\\) and then make that into a link and finally it replaces, str = str.replace( googleString, searchText );
Reply
#3
Ok when you put in msn 'Google(Test)'
It will replace the whole text and then send the link instead i want it to send Google(Test) followed by the link on seperate lines?
Reply
#4
Before or after the line,
Code:
var googleMatches = null;

Call the function that sends the message, and let it send the "str" variable... example: sendMessage(str)
I don't know since thats not the whole source....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)