Shoutbox

[Problem] ScriptMenu Limit - 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: [Problem] ScriptMenu Limit (/showthread.php?tid=68587)

[Problem] ScriptMenu Limit by Huhu_Manix on 11-18-2006 at 12:44 AM

Hi,

I've made a script to copy contact's name, email, psm into the clipboard. All contacts are grouped into the script menu but i saw there's a limitation, i can't put all contact, i tried with submenu but the problem is still here.

So i ask you if there's a way to remove the limitation ?

[Image: attachment.php?pid=754664]


RE: [Problem] ScriptMenu Limit by Felu on 11-18-2006 at 03:38 AM

The list might get too long depending on the no of contacts. All of them won't fit on the screen so why not make a window with a ListViewControl to do th same?


RE: [Problem] ScriptMenu Limit by Huhu_Manix on 11-18-2006 at 11:33 AM

Because i prefer use the scriptmenu, it's more easy than open a window... ^^

But if there's really no way to show all contact on the list i'll use a window as you said. :s


Someone know why there's this limitation ? *-)


RE: [Problem] ScriptMenu Limit by alexp2_ad on 11-18-2006 at 11:36 AM

Are you sure that's the max you can get?  Check out the activities launcher script I made, the menu gets far longer than that. :S


RE: [Problem] ScriptMenu Limit by Felu on 11-18-2006 at 12:11 PM

quote:
Originally posted by alexp2_ad
Are you sure that's the max you can get?  Check out the activities launcher script I made, the menu gets far longer than that. [Image: msn_confused.gif]
Yea you should see a Down Arrow there and should be able to scroll 8-).
RE: [Problem] ScriptMenu Limit by Huhu_Manix on 11-18-2006 at 12:47 PM

Yes, there's 4 buttons by submenu. When i remove 1 or 2 buttons by submenu, i can show more contacts.

When i don't use submenu, i see a down arrow, but the limitation is still here ! :@

I've seen the scriptmenu's return into the debug window and that's good, there's all contacts. ^o)


Code :

code:
function tronq(mail,lght){
    mail = MsgPlus.RemoveFormatCodes(mail);
    mail = mail.split("\"").join('\\\"');
    mail = mail.split("<").join("");
    mail = mail.split(">").join("");
    if(mail.length>lght)return mail.substring(0, lght-3)+"...";
    return mail;
}
function copy(str){
    var size = str.length*2+2;
    var GMEM_MOVEABLE = 0x2;
    var GMEM_SHARE = 0x2000;
    var GMEM_ZEROINIT = 0x40;
    var memtype = GMEM_MOVEABLE | GMEM_SHARE | GMEM_ZEROINIT;
    if (Interop.Call("User32", "OpenClipboard", 0)){
    var heap = Interop.Call("Kernel32", "GlobalAlloc", 0, size);
    var p = Interop.Call("Kernel32", "GlobalLock", heap);
    Interop.Call('Kernel32','RtlMoveMemory',p,str,size);
    Interop.Call("Kernel32", "GlobalUnlock", heap);
    if (Interop.Call("User32", "OpenClipboard", 0)){
    Interop.Call("User32", "EmptyClipboard");
    Interop.Call("User32", "SetClipboardData", 13, heap);
    Interop.Call("User32", "CloseClipboard");
    }
    }
}
function OnEvent_MenuClicked(MenuItemId,Location,OriginWnd){
    if(MenuItemId=="me"){if(Location==2)OriginWnd.EditText_ReplaceSel(Messenger.MyEmail);else copy(Messenger.MyEmail);}
    if(MenuItemId=="me_NAME"){if(Location==2)OriginWnd.EditText_ReplaceSel(Messenger.MyName);else copy(Messenger.MyName);}
    if(MenuItemId=="me_PSM"){if(Location==2)OriginWnd.EditText_ReplaceSel(psm);else copy(Messenger.MyPersonalMessage);}
    if(MenuItemId=="me_2"){if(Location==2)OriginWnd.EditText_ReplaceSel(Messenger.MyName+" - "+Messenger.MyPersonalMessage);else copy(Messenger.MyName+" - "+Messenger.MyPersonalMessage);}
    var Contacts = Messenger.MyContacts;
    var e = new Enumerator(Contacts);
    for(; !e.atEnd(); e.moveNext()){
        var Contact = e.item();
        var mail = Contact.Email;
        var name = Contact.Name;
        var psm = Contact.PersonalMessage;
        if(MenuItemId==mail){if(Location==2)OriginWnd.EditText_ReplaceSel(mail);else copy(mail);}
        if(MenuItemId==mail+"_NAME"){if(Location==2)OriginWnd.EditText_ReplaceSel(name);else copy(name);}
        if(MenuItemId==mail+"_PSM"){if(Location==2)OriginWnd.EditText_ReplaceSel(psm);else copy(psm);}
        if(MenuItemId==mail+"_2"){if(Location==2)OriginWnd.EditText_ReplaceSel(name+" - "+psm);else copy(name+" - "+psm);}
    }
}

function OnGetScriptMenu(Location){
    var xmlMenu = new String();
    xmlMenu += '<ScriptMenu>';
    xmlMenu += '<SubMenu Label="Vous">';
    xmlMenu += '<MenuEntry Id="me">'+tronq(Messenger.MyEmail, 60)+'</MenuEntry>';
    xmlMenu += '<MenuEntry Id="me_NAME">Pseudo - '+tronq(Messenger.MyName, 60)+'</MenuEntry>';
    xmlMenu += '<MenuEntry Id="me_PSM">PSM - '+tronq(Messenger.MyPersonalMessage, 60)+'</MenuEntry>';
    xmlMenu += '<MenuEntry Id="me_2">Pseudo + PSM</MenuEntry>';
    xmlMenu += '</SubMenu>';
    var Contacts = Messenger.MyContacts;
    var e = new Enumerator(Contacts);
    for(; !e.atEnd(); e.moveNext()){
        var Contact = e.item();
        var mail = Contact.Email;
        xmlMenu += '<SubMenu Label="'+mail+'">';
        xmlMenu += '<MenuEntry Id="'+mail+'">'+tronq(mail, 60)+'</MenuEntry>';
        xmlMenu += '<MenuEntry Id="'+mail+'_NAME">Pseudo - '+tronq(Contact.Name, 60)+'</MenuEntry>';
        xmlMenu += '<MenuEntry Id="'+mail+'_PSM">PSM - '+tronq(Contact.PersonalMessage, 60)+'</MenuEntry>';
        xmlMenu += '<MenuEntry Id="'+mail+'_2">Pseudo + PSM</MenuEntry>';
        xmlMenu += '</SubMenu>';
    }
    xmlMenu += '</ScriptMenu>';
    Debug.Trace(xmlMenu);
    return xmlMenu;
}

The 'tronq()' function just limit the text to X character, remove < and > and replace " by \".