automatic nudge - Printable Version
-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: automatic nudge (/showthread.php?tid=85610)
automatic nudge by Wartender on 08-26-2008 at 08:17 PM
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)
RE: automatic nudge by Spunky on 08-26-2008 at 08:21 PM
code: function OnEvent_ContactSignin(Email){
Messenger.OpenChat(Email).SendMessage("/nudge");
}
RE: automatic nudge by Wartender on 08-26-2008 at 08:27 PM
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)
RE: automatic nudge by Spunky on 08-26-2008 at 08:34 PM
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
RE: automatic nudge by Wartender on 08-26-2008 at 08:50 PM
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
RE: automatic nudge by Spunky on 08-26-2008 at 09:00 PM
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)
RE: automatic nudge by Wartender on 08-26-2008 at 09:13 PM
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)?
RE: RE: automatic nudge by Spunky on 08-26-2008 at 09:27 PM
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
RE: automatic nudge by roflmao456 on 08-26-2008 at 09:39 PM
try this out :
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);
}
}
*/
}
RE: automatic nudge by Spunky on 08-26-2008 at 09:42 PM
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
RE: automatic nudge by Wartender on 08-26-2008 at 09:43 PM
ok, the last part that i wrote works, but the first part about signing in doesn't, it tells me contacts is undefined code (wtf?)
(after placing the parenthesis that was missing [line 3] and taking out the extra one[line 9])
RE: automatic nudge by Spunky on 08-26-2008 at 09:46 PM
Sorry, I updated my post above. I don't have time to test my code lol
RE: automatic nudge by CookieRevised on 08-26-2008 at 11:28 PM
May I just friendly note that it is very annoying to your contacts when you send them a nudge each time they sign in or each time you've signed in! People who do that with me are instantly blocked for sure.
Your contact will already see that you've signed in with a Plus! toast window or in the contact list, no need for annoying nudges or 'hello' messages.
EDIT: quote: Originally posted by SpunkyLoveMuff
I was going to point this out, but I'm in a sadistic mood and decided to let them find out for themselves jk
lol.. you sadist you
RE: automatic nudge by Spunky on 08-26-2008 at 11:39 PM
quote: Originally posted by CookieRevised
May I just friendly note that it is very annoying to your contacts when you send them a nudge each time they sign in or each time you've signed in! People who do that with me are instantly blocked for sure.
Your contact will already see that you've signed in with a Plus! toast window or in the contact list, no need for annoying nudges or 'hello' messages.
I was going to point this out, but I'm in a sadistic mood and decided to let them find out for themselves jk
|