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 ) ;
}