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.
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
\".