What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » automatic nudge

Pages: (2): « First [ 1 ] 2 » Last »
automatic nudge
Author: Message:
Wartender
New Member
*


Posts: 5
Joined: Aug 2008
O.P. Undecided  automatic nudge
Hi, i just started scripting, and i'm wondering if there's a way to automatically send a nudge to a contact as soon as he/she signs in. (or if you sign in and he/she is already signed in)
08-26-2008 08:17 PM
Profile E-Mail PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: automatic nudge
code:
function OnEvent_ContactSignin(Email){
        Messenger.OpenChat(Email).SendMessage("/nudge");
}

<Eljay> "Problems encountered: shit blew up" :zippy:
08-26-2008 08:21 PM
Profile PM Find Quote Report
Wartender
New Member
*


Posts: 5
Joined: Aug 2008
O.P. RE: automatic nudge
does that work even if you're the one signing in and the other contact is already signed in? (and thanks)

p.s. the email goes in quotes right? (sorry i'm retarded)
i just tried it substituting both Emails for the actual e-mail with and without quotes and it won't start for either, with quotes, it tells me:
Error: Expected identifier (code: -2146827278)
and with quotes it tells me:
Error: Conditional compilation is turned off (code: -2146827258)
08-26-2008 08:27 PM
Profile E-Mail PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: automatic nudge
The code I made will send a nudge to anyone in your list that signs in. To do it for specific contacts, you should read up on IF statements.

The word Email is a variable and so does not use quotes. It is an argument being passed from the event so that you know which user has signed in. You then use that to open the conversation window and send the nudge.

PS: Try not to double post. Just use the EDIT button to the bottom right of your previous message ;)
<Eljay> "Problems encountered: shit blew up" :zippy:
08-26-2008 08:34 PM
Profile PM Find Quote Report
Wartender
New Member
*


Posts: 5
Joined: Aug 2008
O.P. RE: automatic nudge
ok so this works: (how is it that you display code?)
function OnEvent_ContactSignin(Email){
if (Email == "person's@email.com"){       
Messenger.OpenChat(Email).SendMessage("/nudge");
}
}
just one question, will it work if i sign in and the person is already signed in?
and if it doesn't, can you tell me how to detect if a contact is signed in?
oh and i just found out that even with that modification the code still nudges whoever signs in.
and btw it also nudges every second (i don't really mind that but it'd be nice to take it off

This post was edited on 08-26-2008 at 08:59 PM by Wartender.
08-26-2008 08:50 PM
Profile E-Mail PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: automatic nudge
Use [code]...[/code] tags

Did you save the script because from what I see, you should only be nudging "person's@email.com"

As for doing it when you sign in, you need to find the status of a contact on the OnEvent_SigninReady event (Use the official documentation to read up about this)
<Eljay> "Problems encountered: shit blew up" :zippy:
08-26-2008 09:00 PM
Profile PM Find Quote Report
Wartender
New Member
*


Posts: 5
Joined: Aug 2008
O.P. RE: automatic nudge
ok so i have:
code:
function OnEvent_SigninReady(Email){
Contacts.GetContact("Persons@email.com");
if ( Status != 1 ){
var v = "Persons@email.com";
Messenger.OpenChat(v).SendMessage("/nudge");
}
}
function OnEvent_ContactSignin(Email){
       if (Email == "Persons@email.com"){
        Messenger.OpenChat(Email).SendMessage("/nudge");
}
}

i have yet to find out if i nudge anyone who logs in or if it was my mistake, and i also have to find out if the signing in one works
for the status, do i have to use just the number, or do i have to write the whole STATUS_OFFLINE (1) ?
and != is not equal to, like in c right?, and can i use if to check if two strings are equal (if i have to use the whole STATUS_OFFLINE (1) thing)?

This post was edited on 08-26-2008 at 09:16 PM by Wartender.
08-26-2008 09:13 PM
Profile E-Mail PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: RE: automatic nudge
code:
function OnEvent_Initialize(MessengerStart){
        if(Messenger.MyStatus > 1){
                OnEvent_SigninReady(Messenger.MyEmail);
        }
}

function OnEvent_SigninReady(Email){
        var v = "Persons@email.com"
        if(Messenger.MyContacts.GetContact(v).Status >= 3)){
                Messenger.OpenChat(v).SendMessage("/nudge");
        }
}

function OnEvent_ContactSignin(Email){
        if (Email == "Persons@email.com"){
                Messenger.OpenChat(Email).SendMessage("/nudge");
        }
}

This should be right. Try to see the changes I've made.

The status property can be either the CONSTANT or the numerical value, although the constant is only supported in 4.60(?) and higher. The status should be either 3 or a higher number if the contact is online. Also, if you're going to use a variable such as v, it's probably best to use it for more than one line OR leave it as a string instead of assigning it altogether. Seeing as you need to use the email address twice, you can set the variable.  I added the OnInitialize function for a very good reason. Lets see if you can tell me why :p

This post was edited on 08-26-2008 at 09:46 PM by Spunky.
<Eljay> "Problems encountered: shit blew up" :zippy:
08-26-2008 09:27 PM
Profile PM Find Quote Report
roflmao456
Skinning Contest Winner
****

Avatar

Posts: 955
Reputation: 24
30 / Male / Flag
Joined: Nov 2006
Status: Away
RE: automatic nudge
try this out :P:
code:
var closewnd = true; // Close chat window after sending nudge
var email = ""; // Email of the contact. Leave blank for all contacts.

function OnEvent_ContactSignin(Email){
if(Email == email || !email){
var ChatWnd = Messenger.OpenChat(Email);
Interop.Call('User32', 'PostMessageW', ChatWnd.Handle, 0x0111,  689, 0x0000);
if(closewnd) Interop.Call('User32', 'PostMessageW', ChatWnd.Handle, 0x0111,  20001, 0x0000);
}
}
function OnEvent_Initialize(MessengerStart){
if(Messenger.MyStatus>0) OnEvent_SigninReady(Messenger.MyEmail);
}
function OnEvent_SigninReady(Email){
if(email){
var Contact = Messenger.MyContacts.GetContact(email);
if(Contact.Status > 2){
var ChatWnd = Messenger.OpenChat(email);
Interop.Call('User32', 'PostMessageW', ChatWnd.Handle, 0x0111,  689, 0x0000);
if(closewnd) Interop.Call('User32', 'PostMessageW', ChatWnd.Handle, 0x0111,  20001, 0x0000);
}
}
/*Warning: This code may lag your computer to death. Uncomment the proceding block of code if you really want to use it. It will send nudges to ALL online contacts and optionally close the window (see variable closewnd).*/
/*
var online = new Array();
if(!email){
for(var e=new Enumerator(Messenger.MyContacts);!e.atEnd();e.moveNext()){
var Contact = e.item();
if(Contact.Status > 2) online.push(Contact.Email);
}
for(i in online){
var ChatWnd = Messenger.OpenChat(online[i]);
Interop.Call('User32', 'PostMessageW', ChatWnd.Handle, 0x0111,  689, 0x0000);
if(closewnd) Interop.Call('User32', 'PostMessageW', ChatWnd.Handle, 0x0111,  20001, 0x0000);
}
}
*/
}
[quote]
Ultimatess6
: What a noob mod
08-26-2008 09:39 PM
Profile PM Web Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: automatic nudge
Rofl, I think that code is a bit to advanced as they appear to be learning the basics of Plus! scripting and won't know much about Interops or array methods etc.

I was trying to teach them slowly and to not overwhelm them  ;)
<Eljay> "Problems encountered: shit blew up" :zippy:
08-26-2008 09:42 PM
Profile PM Find Quote Report
Pages: (2): « First [ 1 ] 2 » 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