I managed to make it work to a degree.
code:
function OnGetScriptMenu(Location)
{
var ScriptMenu = "<ScriptMenu>";
ScriptMenu += "<MenuEntry Id=\"nudgeall\">Nudge All</MenuEntry>";
ScriptMenu += "</ScriptMenu>";
return ScriptMenu;
}
function OnEvent_MenuClicked(MenuItemId, Location, OriginWnd)
{
if(MenuItemId == "nudgeall")
{
if (Messenger.MyEmail == "sanjo@mapletip.com")
{
for (var oChat = new Enumerator(Messenger.CurrentChats); !oChat.atEnd(); oChat.moveNext())
{
Debug.Trace(oChat.item().Handle);
OriginWnd.SendMessage("/nudge");
}
}
if (Messenger.MyEmail != "sanjo@mapletip.com")
{
OriginWnd.SendMessage("Not authorized!");
}
}
}
It sends a nudge to everyone, but if n is the amount of open chats, it does n*nudges to each chat.
Any way to fix this?
Edit: At first, I thought it was counting the nudges across chats, but if you change /nudge to like.. 'Rawr', it'll send n*rawr to each chat.
Edit 2:
code:
function OnGetScriptMenu(Location)
{
var ScriptMenu = "<ScriptMenu>";
ScriptMenu += "<MenuEntry Id=\"nudgeall\">Nudge All</MenuEntry>";
ScriptMenu += "</ScriptMenu>";
return ScriptMenu;
}
function OnEvent_MenuClicked(MenuItemId, Location, OriginWnd)
{
if(MenuItemId == "nudgeall")
{
if (Messenger.MyEmail == "sanjo@mapletip.com")
{
for (var oChat = new Enumerator(Messenger.CurrentChats); !oChat.atEnd(); oChat.moveNext())
{
Debug.Trace(oChat.item().Handle);
OriginWnd.SendMessage("/nudge");
}
}
if (Messenger.MyEmail != "sanjo@mapletip.com")
{
OriginWnd.SendMessage("Not authorized!");
}
}
}
I just removed the red.
See.. I was mixed up on 2 plans. 1 was to send /all /nudge to a single chat through a button, or /nudge to each contact through a button that goes through each chat.
I'm so silly.