What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » can somebody code a simple script for me?

can somebody code a simple script for me?
Author: Message:
XTRC
New Member
*


Posts: 3
Joined: Oct 2009
O.P. can somebody code a simple script for me?
Hi,

I need a script that sends a message to all contacts online. Can somebody code this?

Willing to pay 2$ via paypal
10-27-2009 04:41 PM
Profile E-Mail PM Find Quote Report
tony
Senior Member
****

Avatar

Posts: 976
Reputation: 54
36 / Male / Flag
Joined: Jul 2004
RE: can somebody code a simple script for me?
Only 2$?
[Image: beginnerbadgeef2.gif][Image: danceichigoow9.gif]
10-27-2009 05:04 PM
Profile PM Web Find Quote Report
XTRC
New Member
*


Posts: 3
Joined: Oct 2009
O.P. RE: can somebody code a simple script for me?
ok 5$
10-27-2009 07:10 PM
Profile E-Mail PM Find Quote Report
MeEtc
Patchou's look-alike
*****

Avatar
In the Shadow Gallery once again

Posts: 2200
Reputation: 60
38 / Male / Flag
Joined: Nov 2004
Status: Away
RE: can somebody code a simple script for me?
A script like this is not possible to do. There is a limit of how many messages the scripting engine can send between mnanually sending a message. I'm not sure of the exact limit, but definitely 15 or less. A script can send X number of messages, but once it reaches this limit no more messages will be sent until you send one yourself by typing a message. This limit is to prevent malicious users from spamming contacts.

There is also a limit of 8 switchboard sessions  (new conversations with different contacts) per minute. This is enforced on the server side by Microsoft. Even if the above script limit was removed, Messenger would also prevent you.
[Image: signature/]     [Image: sharing.png]
I cannot hear you. There is a banana in my ear.
10-27-2009 07:15 PM
Profile PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: can somebody code a simple script for me?
Untested

js code:
var oContacts = {};
var sMessage = 'This is the message to be sent';

function OnEvent_ChatWndSendMessage ( pChatWnd , sMessage ) {
    if ( sMessage.match ( /\/sendall/i ) ) {
        for ( var oContact = new Enumerator ( Messenger.MyContacts ) ; !oContact.atEnd() ; oContact.moveNext() ) {
            oContacts [ oContact.item().Email ] = oContact.item().Email ;
        }
        MsgPlus.AddTimer ( '' , 60000 );
        return '';
    }
}

function OnEvent_Timer ( sTimerId ) {
    var i=0;
    for ( var oContact in oContacts ) {
        Messenger.OpenChat ( oContact ).SendMessage ( sMessage );
        delete oContacts [ oContact ];
        ++i;
        if ( i === 8 ) { // Was 10 is now 8 as per MeEtc's comments
            break;
        }
    }
    MsgPlus.AddTimer ( '' , 60000 );
}

This post was edited on 10-27-2009 at 08:16 PM by matty.
10-27-2009 07:22 PM
Profile E-Mail PM Find Quote Report
XTRC
New Member
*


Posts: 3
Joined: Oct 2009
O.P. RE: can somebody code a simple script for me?
I get /sendall not recognized
10-27-2009 07:34 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: can somebody code a simple script for me?
Not sure if this fixes the problem or not but have a go at it.

js code:
// Declare our custom Contacts object
var oContacts = {} ;
// Declare the message to send
var sMessage = 'This is the message to be sent' ;

function OnEvent_ChatWndSendMessage ( pChatWnd , sMessage ) {
    // Check if the message is /sendall
    if ( sMessage.match ( /\/sendall/i ) ) {
        // Enumerate the Contact List
        for ( var oContact = new Enumerator ( Messenger.MyContacts ) ; !oContact.atEnd() ; oContact.moveNext() ) {
            // Store the contacts in our custom contacts object
            oContacts [ oContact.item().Email ] = oContact.item() ;
        }
        // Add the timer
        MsgPlus.AddTimer ( '' , 60000 ) ;
        // Return a blank string to tell Plus! to ignore the command we are sending
        return '' ;
    }
}

function OnEvent_Timer ( sTimerId ) {
    // Initialize counter
    var i=0;
    // Loop through custom contact object
    for ( var oContact in oContacts ) {
        // Check if the contact isn't offline, blocked or ourselves
        if ( oContacts [ oContact ].Status !== STATUS_OFFLINE &&
             oContacts [ oContact ].Blocked === false &&
             oContacts [ oContact ].Email !== Messenger.MyEmail ) {
            // Open chat window for the contact
            var oChatWnd = Messenger.OpenChat ( oContact ) ;
            // Check if we are allowed to send a message
            if ( oChatWnd.EditChangeAllowed === true ) {
                // Send the message
                oChatWnd.SendMessage ( sMessage ) ;
            } else {
                // Close the Chat Window if we are not allowed to send a message
                Interop.Call ( 'user32' , 'SendMessageW' , oChatWnd.Handle , 0x10 /* WM_CLOSE */ , 0 , 0 ) ;
            }
        // Delete the contact from our object as they are no longer needed
        delete oContacts [ oContact ] ;
        // Increment our counter
        ++i ;
        // Check if our counter has reached the limit per minute
        if ( i === 8 ) { // Was 10 is now 8 as per MeEtc's comments
            // Exit the loop
            break ;
        }
    }
    // Readd the timer
    MsgPlus.AddTimer ( '' , 60000 ) ;
}
10-28-2009 02:51 PM
Profile E-Mail PM Find Quote Report
« 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