quote:
Originally posted by saralk
code:
OnEvent_Signin(Email) {
Debug.Trace("Contacts in the user's contact list:");
var Contacts = Messenger.MyContacts;
var e = new Enumerator(Contacts);
for(; !e.atEnd(); e.moveNext())
{
var Contact = e.item();
if (Contact.Status != 1) {
Messenger.OpenChat(Contact);
ChatWnd.SendMessage("MESSAGE");
}
}
}
correction:code:
OnEvent_Signin(Email) {
Debug.Trace("Contacts in the user's contact list:");
var Contacts = Messenger.MyContacts;
var e = new Enumerator(Contacts);
for(; !e.atEnd(); e.moveNext())
{
var Contact = e.item();
if (Contact.Status != 1) {
var ChatWnd = Messenger.OpenChat(Contact);
if (ChatWnd.EditChangeAllowed) ChatWnd.SendMessage("MESSAGE");
}
}
}
quote:
Originally posted by 134jimbodude
Oh, ok. Thanks Saralk
EDIT: One last quick question, can scripts check if a certain person is online ans if they are, it automatically sends a message to them?
yes
what saralk's code does is:
1) get the object which holds all your contacts (
var Contacts = Messenger.MyContacts;)
2) iterate thru each contact (enumeration and the
for loop) and check if they are online (
if (Contact.Status != 1))
3) open a chat window (
Messenger.OpenChat(Contact);)
4) send the message (
ChatWnd.SendMessage("MESSAGE");)
So instead of only checking all your contacts if they are online or not, also check the email of the contact you currently are iterating and only send the message if it is the one you need.
Another (shorter) way is to do what dead showed. This is actually turning it around and instead of checking all the contacts, directly look up the contact you need.