Shoutbox

need help writing a script - 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: need help writing a script (/showthread.php?tid=66191)

need help writing a script by ganate123 on 09-13-2006 at 07:40 PM

i cant figure this one out...
i want to make it so when <email adress> signs in it opens a chat window for <contacts email> but i tryed everything and i couldnt get it... also im new so any help is appreaciated


RE: need help writing a script by Jesus on 09-13-2006 at 07:46 PM

code:
function OnEvent_ContactSignin(Email)
{
Messenger.OpenChat(Email)
}

haven't tested, but should work
RE: need help writing a script by Shondoit on 09-13-2006 at 07:59 PM

No, you need the Contact, not the email, so it should be:
According to the scripting doc, an email works too

code:
function OnEvent_ContactSignin (Email) {
   var Contact = Messenger.MyContacts.GetContact(Email)
   Messenger.OpenChat(Contact)
}
(edit: put it in code tags)
RE: need help writing a script by Jesus on 09-13-2006 at 08:05 PM

yeah at first I thought that I needed the contact too, but the scripting doc proved us wrong :)


RE: need help writing a script by ganate123 on 09-13-2006 at 10:10 PM

ok thanks for the help but i think im doin somethin wrong
this is what i have so far

function OnEvent_ContactSignin ('example@hotmail.com') {
   var Contact = Messenger.MyContacts.GetContact('example@hotmail.com')
   Messenger.OpenChat(Contact)
}

whats wrong?


RE: need help writing a script by Shondoit on 09-13-2006 at 10:20 PM

You should not replace the 'Email' parameter

When the function 'OnEvent_ContactSignin' is called as an event, it passes one parameter named Email, so you know who signed in...
If you want to do this for only one person, you should check if the Email parameter is the same as the email of the person you want

function OnEvent_ContactSignin (Email) {
   if (Email == "example@hotmail.com") {
      var Contact = Messenger.MyContacts.GetContact(Email)
      Messenger.OpenChat(Contact)
   }
}


RE: need help writing a script by ganate123 on 09-13-2006 at 10:36 PM

ok that works and now i understand it but i just read what i wanted for a script and it was a lil confuzing.  what i meant was when my email signs in i want it to automatically open a convo window of one of my friends.  like i sign in and if their online or offline it brings up the window.

but thanks for the first script. i love it but i would still like the one i just described agian


RE: need help writing a script by Shondoit on 09-13-2006 at 10:42 PM

function OnEvent_Signin (Email) {
   var Contact = Messenger.MyContacts.GetContact("example@hotmail.com")
   Messenger.OpenChat(Contact)
}

Perhaps you should have a look in the scripting documentation


RE: need help writing a script by ganate123 on 09-13-2006 at 11:58 PM

i did.  i learn better by example but yea the script you gave me opens any contact that comes online :S umm heres the script in entirety



function OnEvent_ContactSignin (Email) {
    if (Email == "HerEmail@hotmail."); {
    var Contact = Messenger.MyContacts.GetContact(Email);
     Messenger.OpenChat(Contact);
    }
}

function OnEvent_Signin (Email) {
    var Contact = Messenger.MyContacts.GetContact("HerEmail@hotmail.com")
    Messenger.OpenChat(Contact)
}


ok so it opens any contact that comes online and i only want this script to function on my email death.to.emo@hotmail.com

thanks for all your help


RE: need help writing a script by cloudhunter on 09-14-2006 at 12:30 AM

Forget the top bit of the script... Just use this.

code:
function OnEvent_Signin (Email) {
var Contact = Messenger.MyContacts.GetContact("HerEmail@hotmail.com");
Messenger.OpenChat(Contact);
}

Remember to put ; at the end of every line, to terminate the line.

Cloudy