Shoutbox

script for open all contacts window - 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: script for open all contacts window (/showthread.php?tid=91995)

script for open all contacts window by texhk on 08-25-2009 at 05:25 PM

script for open all contacts window!

please give me a help!


RE: script for open all contacts window by matty on 08-25-2009 at 05:49 PM

To open chat windows? That is a very dangerous and memory intensive operation... nonetheless...

Javascript code:
for ( var oContact = new Enumerator ( Messenger.MyContacts ); !oContact.atEnd(); oContact.moveNext() ) {
    Messenger.OpenChat ( oContact.item() );
}


RE: script for open all contacts window by texhk on 08-26-2009 at 12:33 AM

thz for reply! I'm a newbie in scripting, can you teach me how to put these into a .plsc file? or how can make it works?


RE: script for open all contacts window by matty on 08-26-2009 at 02:12 AM

Dempsey's reply to Pack the script


RE: RE: script for open all contacts window by texhk on 08-26-2009 at 02:17 AM

quote:
Originally posted by matty
Dempsey's reply to Pack the script

thz a lot!!!(Y)(Y)(Y)
RE: script for open all contacts window by texhk on 08-27-2009 at 12:14 AM

i already try the script but it only open some of my contacts, around 20 out of 40, and i also try another script to open offline contacts but it's not work..... could you please give me a help? thank you so much!


for offline contacts: (not work, the result is just same as "STATUS_OFFLINE")
============================================
for ( var oContact = new Enumerator(Messenger.MyContacts); !oContact.atEnd(); oContact.moveNext() ) {
     if ( oContact.item().Status > STATUS_ONLINE && oContact.item().Blocked === false ) {
        Messenger.OpenChat( oContact.item() ).OpenChat;
    }
}
============================================


RE: script for open all contacts window by matty on 08-27-2009 at 01:05 AM

quote:
Originally posted by texhk
Messenger.OpenChat( oContact.item() ).OpenChat;
This is not valid...
RE: script for open all contacts window by texhk on 08-27-2009 at 01:49 AM

=====================
for ( var oContact = new Enumerator ( Messenger.MyContacts ); !oContact.atEnd(); oContact.moveNext() ) {
    Messenger.OpenChat ( oContact.item() );
}
=====================

but for open online contacts, these only can open half of online contacts.


RE: script for open all contacts window by matty on 08-27-2009 at 12:52 PM

Like I said it is a memory intensive task. I would recommend doing something like this:

Javascript code:
// create an array to hold the contact objects
var objContacts = new Array();
 
function OnEvent_Initialize ( ) {
    // verify user is logged on before doing anything
    if ( Messenger.MyStatus < STATUS_INVISIBLE ) return;
    // enumerate all contacts on the list
    for ( var oContact = new Enumerator ( Messenger.MyContacts ); !oContact.atEnd ( ); oContact.moveNext ( ) ) {
        // save all contacts to an array
        objContacts.push ( oContact.item ( ) );
    }
    // create a timer to open the contacts
    MsgPlus.AddTimer ( 'OpenContacts' , 250 );
}
 
function OnEvent_SigninReady ( ) {
    OnEvent_Initialize ( );
}
 
function OnEvent_Timer ( sTimer ) {
    // open the chat window for the contact and remove them from the array
    // The shift() method is used to remove and return the first element of an array.
    Messenger.OpenChat ( objContacts.shift ( ) );
    // check if there are any more contacts left to open chat windows for if so keep the timer going
    if ( objContacts.length > 0 ) MsgPlus.AddTimer ( sTimer , 250 );
}