I need some help with some scripting, before i explain heres part of my code:
code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, Type) {
var Contacts = ChatWnd.Contacts;
var e = new Enumerator(Contacts);
var Contact = e.item();
var command = Message.substr(0,7);
var strMessage = Message.substr;
if (ChatOpen != true) {
if (command == "!secure") {
var ContactEmail = Contact.Email;
var Wnd = MsgPlus.CreateWnd("Interface.xml", "WndMain");
var ChatWindowID = ChatWnd;
Wnd.SetControlText("lblChatting",ContactEmail)
ChatOpen = true;
}
}
if (Contact.Email != Messenger.MyEmail) {
var strCurrentChat = Wnd.GetControlText("txtChat");
Wnd.SetControlText("txtChat","<" + Contact.Email + "> " + Message + "\r\n");
}
return Message;
}
What i want to do is make Wnd a constant/global variable so i can always access it because i need to keep using it everytime a message is recieved. So what im asking is if there is a way to make global variables OR if i can iterate through the windows and find the one with the id of WndMain. I really need help with this, thanks.
/-- Malekith