Shoutbox

EMAIL VERIFICATION - 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: EMAIL VERIFICATION (/showthread.php?tid=61888)

EMAIL VERIFICATION by novolo on 06-28-2006 at 12:49 PM

Hi,   i made a script so that i could run apps remotely on my computer,  its simple actually,   the thing is,   i want it o be able only to one email...   my secconadary account...

here's the code (doesn't work)   anyone knows why?

code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind){
    var Contact = ChatWnd.Contacts;
    var e = new Enumerator(Contact);
    if (e < 2){
        if (Contact.Email == 'remotocasa@hotmail.com') {
            //PROGRAMAS
            if(Message == "!runNotepad"){
            ChatWnd.SendMessage("/run c:\\windows\\notepad.exe");
            ChatWnd.SendMessage("Notepad open");
            }
            if(Message == "!runMusic"){
            ChatWnd.SendMessage("/run c:\\music.mp3");
            ChatWnd.SendMessage("Listenning music");
            }
            if(Message == "!runNudge"){
            ChatWnd.SendMessage("/nudge");
            }
        }
    }
}

if i remove the email verification it works fine...      but i dont seem to be able to make this email thing to work!!
HELLPP
RE: EMAIL VERIFICATION by novolo on 06-28-2006 at 01:08 PM

Ok,  i just tested it,  and it doesn't work either   with  if(Origin == 'email@hotmail.com'){

so,  it has to be something else....


RE: EMAIL VERIFICATION by Bmw1000c on 06-28-2006 at 01:13 PM

and the "else"?
i don't know very much of programming, but i think that is there a "if", must to ve a "else", too


RE: EMAIL VERIFICATION by novolo on 06-28-2006 at 01:21 PM

not always,  you have to put an else if you want something to happen when the requirements are not met...   in this case i don't put an else because if not,  everyone who talks to me will receive whatever is in the else...  and i don't want that...


RE: EMAIL VERIFICATION by Bmw1000c on 06-28-2006 at 01:23 PM

uhuh ok, sorry =P


RE: EMAIL VERIFICATION by Ezra on 06-28-2006 at 01:37 PM

code:
function OnEvent_Initialize(MessengerStart)
{
}

function OnEvent_Uninitialize(MessengerExit)
{
}

function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind){
  var Contacts = ChatWnd.Contacts;
 
  if (Contacts.Count == 1)
  {
    var e = new Enumerator(Contacts);
    for (;!e.atEnd();e.moveNext())
    {
      var Contact = e.item();
      if (Contact.Email == 'xxx@yyy.zzz')
      {
        //PROGRAMAS
        if (Message == "!runNotepad")
        {
          ChatWnd.SendMessage("/run c:\\windows\\notepad.exe");
          ChatWnd.SendMessage("Notepad open");
        }
        if (Message == "!runMusic")
        {
          ChatWnd.SendMessage("/run c:\\music.mp3");
          ChatWnd.SendMessage("Listenning music");
        }
        if (Message == "!runNudge")
        {
          ChatWnd.SendMessage("/nudge");
        }
      }
    }
  }
}

That will work :D, tested it!

EDIT: changed it a little to make better use of cpu cycles :P
RE: EMAIL VERIFICATION by Bmw1000c on 06-28-2006 at 01:43 PM

it works!

edit

quote:
function OnEvent_Initialize(MessengerStart)
{
}

function OnEvent_Uninitialize(MessengerExit)
{
}

this isn't necessary

edit2: how can i had allow 2 mails?
RE: EMAIL VERIFICATION by novolo on 06-28-2006 at 01:46 PM

great,   IT WORKS GREAT!!   thnx  :D


RE: RE: EMAIL VERIFICATION by Mr. Bougo on 06-28-2006 at 03:02 PM

quote:
edit2: how can i had allow 2 mails?


change the
code:
if (Contact.Email == 'xxx@yyy.zzz')
to
code:
if (Contact.Email == 'xxx@yyy.zzz' || Contact.Email == "aaa@bbb.ccc")

RE: EMAIL VERIFICATION by Ezra on 06-28-2006 at 03:15 PM

Or use a fancy function like this:

code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind){
  var Contacts = ChatWnd.Contacts;
  var e = new Enumerator(Contacts);
  if (Contacts.Count == 1)
  {
    for (;!e.atEnd();e.moveNext())
    {
      var Contact = e.item();
      switch (Contact.Email)
      {
        case "xxx@yyy.zzz":
          run(ChatWnd, Message);
          break;
        case "xxx2@yyy.zzz":
          run(ChatWnd, Message);
          break;
      }
    }
  }
}

function run(ChatWnd, Message)
{
  //PROGRAMAS
  if (Message == "!runNotepad")
  {
    ChatWnd.SendMessage("/run c:\\windows\\notepad.exe");
    ChatWnd.SendMessage("Notepad open");
  }
  if (Message == "!runMusic")
  {
    ChatWnd.SendMessage("/run c:\\music.mp3");
    ChatWnd.SendMessage("Listenning music");
  }
  if (Message == "!runNudge")
  {
    ChatWnd.SendMessage("/nudge");
  }
}

RE: EMAIL VERIFICATION by RaceProUK on 06-28-2006 at 03:39 PM

code:
switch (Contact.Email)
      {
        case "xxx@yyy.zzz":
          run(ChatWnd, Message);
          break;
        case "xxx2@yyy.zzz":
          run(ChatWnd, Message);
          break;
      }
Cases fall through y'know:
code:
switch (Contact.Email)
      {
        case "xxx@yyy.zzz":
        case "xxx2@yyy.zzz":
          run(ChatWnd, Message);
          break;
      }
is equivalent.

Remember: there's no compiler to optimise scripts :P
RE: EMAIL VERIFICATION by novolo on 06-29-2006 at 02:31 AM

hi,  now,  one other thing...

is there a way to kill an application through srcipt?


RE: EMAIL VERIFICATION by rob_botch on 06-29-2006 at 09:41 AM

The reason checking the Origin didn't work was because the Origin is only the displayed name of the contact in the chat window