What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Help with some code

Pages: (3): « First « 1 [ 2 ] 3 » Last »
Help with some code
Author: Message:
Jimbo
Veteran Member
*****

Avatar

Posts: 1650
Reputation: 18
32 / Male / Flag
Joined: Jul 2006
O.P. RE: Help with some code
quote:
Originally posted by deAd

code:
var sEmail = "email@address.com";
var oContact = Messenger.MyContacts.GetContact(sEmail);
if(oContact.Status != 1){
                    var ChatWnd = Messenger.OpenChat(sEmail);
                    ChatWnd.SendMessage("hi");
}


Thanks deAd
EDIT: Just added the coded and it sent 'hi' to my contact. Is there a way for it to only do it as a sign in?
Also whenever i go to plus preferences and click ok it sends 'hi' again:'( any way of stoppin this?

This post was edited on 10-02-2006 at 06:21 PM by Jimbo.
10-02-2006 06:17 PM
Profile E-Mail PM Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
RE: Help with some code
Sure.
code:
function OnEvent_Signin(sUserEmail){
var sEmail = "email@address.com";
var oContact = Messenger.MyContacts.GetContact(sEmail);
if(oContact.Status != 1){
var ChatWnd = Messenger.OpenChat(sEmail);
ChatWnd.SendMessage("hi");
}
}

This post was edited on 10-02-2006 at 06:22 PM by deAd.
10-02-2006 06:21 PM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Help with some code
too many people replying at the same time.... :dodgy:

Dead, even that code is not correct (or to put it in another way: shouldn't be used)...

corrected:
code:
var sEmail = "email@address.com";
var oContact = Messenger.MyContacts.GetContact(sEmail);
if (oContact.Status != 1) {
                    var ChatWnd = Messenger.OpenChat(sEmail);
                    if (ChatWnd.EditChangeAllowed) ChatWnd.SendMessage("hi");
}


@134jimbodude: I'd suggest to really take up the advise and get a book about basic programming as the questions you ask are extremely basic programming things though.

Also be advised that it is highly annoying for your contacts to recieve a message from you each time you log in (the same goes for those auto-greeting scripts which greet every person as soon as someone signs in).

This post was edited on 10-02-2006 at 06:24 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
10-02-2006 06:21 PM
Profile PM Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
RE: Help with some code
Cookie, that is just a check, and is not required. The same result will be produced if you do not add that if statement. Plus will not send the message if it can't.
10-02-2006 06:23 PM
Profile PM Find Quote Report
Jimbo
Veteran Member
*****

Avatar

Posts: 1650
Reputation: 18
32 / Male / Flag
Joined: Jul 2006
O.P. RE: Help with some code
So to put more emails in would i just do:
[code]
function OnEvent_Signin(sUserEmail){
var sEmail = "email@address.com;email@adress2.com";
var oContact = Messenger.MyContacts.GetContact(sEmail);
if(oContact.Status != 1){
                    var ChatWnd = Messenger.OpenChat(sEmail);
                    ChatWnd.SendMessage("hi");
}
}
10-02-2006 06:24 PM
Profile E-Mail PM Find Quote Report
saralk
Veteran Member
*****

Avatar

Posts: 2598
Reputation: 38
35 / Male / Flag
Joined: Feb 2003
RE: Help with some code
I feel like an idiot now. My code is nothing like what you actually wanted :(
The Artist Formerly Known As saralk
London · New York · Paris
Est. 1989
10-02-2006 06:25 PM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Help with some code
quote:
Originally posted by deAd
Cookie, that is just a check, and is not required. The same result will be produced if you do not add that if statement. Plus will not send the message if it can't.
That is not 'just' a check, it is actually very required as it is not always possible to send a message to a chat window (even if you just opened it).

quote:
Originally posted by saralk
I feel like an idiot now. My code is nothing like what you actually wanted :(
don't be, he first asked how to send a message to all online contacts which you indeed provided.

quote:
Originally posted by 134jimbodude
So to put more emails in would i just do:
code:
function OnEvent_Signin(sUserEmail){
var sEmail = "email@address.com;email@adress2.com";
var oContact = Messenger.MyContacts.GetContact(sEmail);
if(oContact.Status != 1){
                    var ChatWnd = Messenger.OpenChat(sEmail);
                    ChatWnd.SendMessage("hi");
}
}

no, absolutely not...

the variable sEmail is a string, it will be compared literally to the string which holds the email of the current contact object. Or in this specific code it will be passed to the GetContact function as the email to find.

"email@address.com;email@adress2.com" is not a valid email address and thus this will never work.

What you want is checking the email of the current contact object against a list or in other words against an array...

PS: make up your mind though, each time you request something different, which requires different code :p;)

This post was edited on 10-02-2006 at 06:30 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
10-02-2006 06:25 PM
Profile PM Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
RE: Help with some code
quote:
Originally posted by 134jimbodude
So to put more emails in would i just do:
No. You'd need an array of emails to loop through.
code:
function OnEvent_Signin(sUserEmail){
var sEmails = new Array("email@address.com","email2@address.com");
for(item in sEmails){
var oContact = Messenger.MyContacts.GetContact(sEmails[item]);
if(oContact.Status != 1){
var ChatWnd = Messenger.OpenChat(sEmails[item]);
ChatWnd.SendMessage("hi");
}
}
}


quote:
Originally posted by CookieRevised
quote:
Originally posted by deAd
Cookie, that is just a check, and is not required. The same result will be produced if you do not add that if statement. Plus will not send the message if it can't.
That is not 'just' a check, it is actually very required as it is not always possible to send a message to a chat window (even if you just opened it).
If you do not include this check, the message will not be sent. If you do include the check, the message won't be sent. Either way, the message will be sent only when it can be. I don't see the necessity of it :S it's not like it causes problems or something?

This post was edited on 10-02-2006 at 06:29 PM by deAd.
10-02-2006 06:27 PM
Profile PM Find Quote Report
Jimbo
Veteran Member
*****

Avatar

Posts: 1650
Reputation: 18
32 / Male / Flag
Joined: Jul 2006
O.P. RE: Help with some code
so everyone would this work:
code:
function OnEvent_Signin(sUserEmail){
var sEmails = new Array("bla@bla2.com","bla@bla3.com");
for(item in sEmails){
var oContact = Messenger.MyContacts.GetContact(sEmails[item]);
if(oContact.Status != 1){
var ChatWnd = Messenger.OpenChat(sEmails[item]);
ChatWnd.SendMessage("hi");
}
}
}


This post was edited on 10-02-2006 at 06:28 PM by Jimbo.
10-02-2006 06:27 PM
Profile E-Mail PM Find Quote Report
saralk
Veteran Member
*****

Avatar

Posts: 2598
Reputation: 38
35 / Male / Flag
Joined: Feb 2003
RE: Help with some code
quote:
Originally posted by 134jimbodude
so everyone would this work:
code:
function OnEvent_Signin(sUserEmail){
var sEmail = "bla@bla1.com;bla@bla2.com;bla@bla3.com";
var oContact = Messenger.MyContacts.GetContact(sEmail);
if(oContact.Status != 1){
var ChatWnd = Messenger.OpenChat(sEmail);
if (ChatWnd.EditChangeAllowed) ChatWnd.SendMessage("hi");
}
}



No, that requires a bit more thought, i'm working on it now.
The Artist Formerly Known As saralk
London · New York · Paris
Est. 1989
10-02-2006 06:28 PM
Profile PM Find Quote Report
Pages: (3): « First « 1 [ 2 ] 3 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On