Shoutbox

Is this possible to make? - 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: Is this possible to make? (/showthread.php?tid=93980)

Is this possible to make? by Barathrum on 02-28-2010 at 04:53 PM

Is it possible to make a Messenger Script that everytime any contact on my friend list would sign into messenger, it would open a chat window and say "Hello :)" and if possible then close that chat window, but this part doesn't matter.

Thank you for answering :)


RE: Is this possible to make? by Felu on 02-28-2010 at 04:56 PM

Yes, I believe it would be fairly easy to do.


RE: Is this possible to make? by billyy on 02-28-2010 at 05:45 PM

Yeah it's possible and fairly easy :P

JScript code:
function OnEvent_ContactSignin(email)
{
     /* Open a chat window */
     var Chat = Messenger.OpenChat(email);
 
     /* Say herraw */
     Chat.SendMessage("Hello :)");
 
     /* Close it */
     Chat.SendMessage("/close");
}


Actually it is as simple as that!
RE: Is this possible to make? by roflmao456 on 02-28-2010 at 05:55 PM

JScript code:
function OnEvent_ContactSignin(Email){
    var ChatWnd = Messenger.OpenChat(Email);
    if(ChatWnd.EditChangeAllowed){
        /* Send the message */
        ChatWnd.SendMessage("Hello :)");
   
        /* Close the ChatWnd */
        ChatWnd.SendMessage("/close");
        }
    /* Commented since this causes "we were unable to start conversation" error. (timer needed?) */
    //Interop.Call("user32", "SendMessageW", ChatWnd.Handle, 0x10, 0, 0);
    }


damn it billy :P
RE: Is this possible to make? by billyy on 02-28-2010 at 05:57 PM

Ah but you close the window so it's better anyway :P

edit:
Now mine does too (6)


RE: Is this possible to make? by CookieRevised on 02-28-2010 at 06:37 PM

Mind you that such scripts are extremely annoying!

If you do not want to be blocked in no time, then I very strongly encourage to not use such scripts.

Such a script/question pops up now and then, and each and every time people complain about it and the script dies quickly.

----------------------

PS: billy, roflmao456, before you use SendMessage() you best check if you can actually send the message. See the Plus! Scripting Documentation.


RE: Is this possible to make? by Felu on 02-28-2010 at 06:39 PM

Not to mention that if somebody has a connection problem, and signs-in and out often, would keep on getting the message again and again.


RE: Is this possible to make? by billyy on 02-28-2010 at 06:47 PM

Yeah i know felu :/

Ok i edited the script according to what cookie said and added something you might like also i could add like a function that makes it choose from a list of hellos and all.
But it IS true it MIGHT be anoying and people MIGHT start blocking you.

JScript code:
function OnEvent_ContactSignin(email)
{
     if(Messenger.MyStatus != 2)
     {
          /* Open a chat window */
          var Chat = Messenger.OpenChat(email);
         
          if(Chat.EditChangeAllowed == true)
          {
         
               /* Say herraw */
               Chat.SendMessage("Hello :)");
     
               /* What if you are busy? */
               if(Messenger.MyStatus == 4)
               {
                    Chat.SendMessage("I'm busy right now but I noticed you got online, gimme a sec!");
               }
               /* What if you will brb? */
               else if(Messenger.MyStatus == 5)
               {
                    Chat.SendMessage("Oh dang, brb!");
               }
               /* What if you are idle? */
               else if(Messenger.MyStatus == 6)
               {
                    Chat.SendMessage("Oh dang, sorry i gtg for a second...");
               }
               /* What if you are away? */
               else if(Messenger.MyStatus == 7)
               {
                    Chat.SendMessage("Oh dang i got to go! Sorry ill be back in a few...");
               }
               /* What if you are in a call? */
               else if(Messenger.MyStatus == 8)
               {
                    Chat.SendMessage("Oh brb phone!");
               }
               /* What if you are eating */
               else if(Messenger.MyStatus == 9)
               {
                    Chat.SendMessage("Oh brb got to eat!");
               }
         
               /* Close it */
               Chat.SendMessage("/close");
          }
     }
}


Off-Topic:
But w/e i'm off repping people :D

Edit:
Banned from repping people... ahw **** [Image: dodgy.gif]
RE: Is this possible to make? by foaly on 02-28-2010 at 08:09 PM

quote:
Originally posted by billyy
Javascript code:
               else if(Messenger.MyStatus == 8)
               {
                    Chat.SendMessage("Oh brb phone!");
               }
               /* What if you are eating */
               else if(Messenger.MyStatus == 8)
               {
                    Chat.SendMessage("Oh brb got to eat!");
               }



Something tells me you'll never have to eat...
RE: Is this possible to make? by billyy on 02-28-2010 at 08:34 PM

LOL thanks for that xD


RE: Is this possible to make? by whiz on 02-28-2010 at 09:23 PM

Also, rather than using loads of else if statements, try using switch:

Javascript code:
switch (Messenger.MyStatus)
{
    case 4: // busy
        // do something here
        break;
    case 5: // BRB
        // do something here
        break;
    // repeat for each status...
}


RE: Is this possible to make? by billyy on 02-28-2010 at 09:26 PM

I noticed it was possible, i just don't see the difference...
It's only easyer to read for people who... well...
it's just easyer for me >:l


RE: Is this possible to make? by CookieRevised on 03-01-2010 at 12:50 AM

quote:
Originally posted by billyy
I noticed it was possible, i just don't see the difference...
It's only easyer to read for people who... well...
it's just easyer for me >:l
Using Switch is shorter code and it is much faster code in execution.

Each time you do Else If Messenger.MyStatus, the interpreter needs to look up Messenger.MyStatus. This is of course useless because that variable isn't going to change between the If Then Else's.

Using a Switch statement makes that Messenger.MyStatus only needs to be looked up once.
RE: Is this possible to make? by djdannyp on 03-01-2010 at 11:21 AM

A lot of those statuses are depreciated though, your only choices now are "Available, Away, Busy and Offline"

So there's really only 2 of those that you could use the script for


RE: Is this possible to make? by Barathrum on 03-01-2010 at 03:19 PM

Thank you all, yes I know it could be annoying so I added some code that it will check if this user should get the msg or not.


RE: Is this possible to make? by Spunky on 03-01-2010 at 03:45 PM

quote:
Originally posted by djdannyp
A lot of those statuses are depreciated though, your only choices now are "Available, Away, Busy and Offline"

So there's really only 2 of those that you could use the script for

Various clients still show the old statuses IIRC and they are still sent correctly through the protocol, so some people will still see it correctly.
RE: Is this possible to make? by billyy on 03-01-2010 at 04:59 PM

But it's about the status of the user of the script O_o
They are totally right xD


RE: Is this possible to make? by CookieRevised on 03-01-2010 at 09:05 PM

quote:
Originally posted by billyy
But it's about the status of the user of the script O_o
Since they are still supported by Windows Live Messenger (eventhough, on screen, you don't see a visible difference between the various busy/online statusses), it is still possible that the user will have such a specific status. eg: by using another script which sets those statusses for example. Hence they should still be supported in the script (and in any other script for that matter).
RE: Is this possible to make? by billyy on 03-02-2010 at 06:30 AM

Oh yeh >_<
Well it won't happen much but at least those lines of code are justified :/


RE: Is this possible to make? by matty on 03-02-2010 at 02:10 PM

Plus! still supports assigning these status through the conversation.

/outlunch
/onphone
etc.

You can capture these messages in the OnEvent_ChatWndSendMessage and assign any DP or PSM you need to.