This is happening because the OriginWnd parameter of the OnEvent_MenuClicked event is the Chat Window where the menu is clicked. This will never change unless you click the menu from another Chat Window.
You would need to use:
js code:
oChat.item().SendMessage('/nudge');
But you also want to make sure that you can send the message to begin with:
js code:
function OnGetScriptMenu(Location) {
return '<ScriptMenu><MenuEntry Id="nudgeall">Nudge All</MenuEntry></ScriptMenu>';
}
function OnEvent_MenuClicked(MenuItemId, Location, OriginWnd) {
if (Messenger.MyEmail === 'sanjo@mapletip.com') {
if(MenuItemId === "nudgeall") {
for (var oChat = new Enumerator(Messenger.CurrentChats); !oChat.atEnd(); oChat.moveNext()) {
if (oChat.item().EditChangeAllowed === true) {
oChat.item().SendMessage('/nudge');
}
}
}
}
else {
OriginWnd.SendMessage('Not authorized!');
}
}