can somebody code a simple script for me? - 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: Scripting (/forumdisplay.php?fid=39)
+----- Thread: can somebody code a simple script for me? (/showthread.php?tid=92706)
can somebody code a simple script for me? by XTRC on 10-27-2009 at 04:41 PM
Hi,
I need a script that sends a message to all contacts online. Can somebody code this?
Willing to pay 2$ via paypal
RE: can somebody code a simple script for me? by tony on 10-27-2009 at 05:04 PM
Only 2$?
RE: can somebody code a simple script for me? by XTRC on 10-27-2009 at 07:10 PM
ok 5$
RE: can somebody code a simple script for me? by MeEtc on 10-27-2009 at 07:15 PM
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.
RE: can somebody code a simple script for me? by matty on 10-27-2009 at 07:22 PM
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 );
}
RE: can somebody code a simple script for me? by XTRC on 10-27-2009 at 07:34 PM
I get /sendall not recognized
RE: can somebody code a simple script for me? by matty on 10-28-2009 at 02:51 PM
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 ) ;
}
|