Do you want the ability to prevent nudging if the script is "disabled" is that the affect you are trying to achieve?
Also I know you are new but you can cut down on some code for example:
jscript code:
// Create an object to store our sent messages
var mySentMessages = {};
var bEnabled = true;
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind) {
if (mySendMessages[ChatWnd.Handle] != Message) {
Debug.Trace("Message received");
if (Message != '/nudge') {
if (ChatWnd.Contacts.Count == 1 && bEnabled == true) {
for (var e = new Enumerator(ChatWnd.Contacts); !e.atEnd(); e.moveNext()) {
// store the new chat window in a variable
var pChat = Messenger.OpenChat(e.item().Email)
// check if the chat window's typing area is enabled and the user isn't blocked
if (pChat.EditChangeAllowed == true && e.item().Blocked == false) {
pChat.SendMessage('/nudge');
}
}
}
}
}
}
function OnEvent_ChatWndSendMessage(ChatWnd, Message){
mySentMessages[ChatWnd.Handle] = Message; // store the last sent message in an object
}
function OnEvent_ChatWndDestroyed(ChatWnd) {
delete mySentMessages[ChatWnd.Handle]; // delete the message from the object as it isn't needed anymore
}
/*
Use bEnabled to control whether or not you want the nudge to be sent.
When the user clicks the menu item to disable the script set bEnabled = false; and vice versa when they are enabling it.
*/