What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » How to open group chat windows

How to open group chat windows
Author: Message:
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: RE: How to open group chat windows
quote:
Originally posted by Plan-1130
Global variables have to be defined before anything else, like shown in my example, you can't define global variables any other way AFAIK.
Global variables can be defined anywhere in the code as long as they are outside any function and before the code where you use them. Though usually not good practice, the next code is perfectly valid:

[code]function Hello() {
    Debug.Trace(myglobalvariable);
}

var myglobalvariable = 'Hello';

function World() {
    Debug.Trace('World');
}

Hello();
World();


quote:
Originally posted by Poki
Well, let me show you what my problem was, may be you figure it out.

I had....
var sEmails = new Array("mail1@hotmail.com","mail2@hotmail.com","mail3@hotmail.com");

var ContactoUno = Messenger.MyContacts.GetContact(sEmails[0]);
var ContactoDos = Messenger.MyContacts.GetContact(sEmails[1]);
var ContactoTres = Messenger.MyContacts.GetContact(sEmails[2]);

before any function, when I realised I needed global variables in order to be accessed by any function, but the fact was that I had to redefine ContactoUno, ContactoDos, ContactoTres y every function I wanted to use it because I'd get an error if I didn't...
So, they are global but need to be defined in every function? in that case the script worked indeed... or what else could be wrong?


All the variables you defined there are global already.

Your problem is that you don't have valid values defined to them when the script starts.

Scripts are started before objects like Messenger are fully available. Thus when the script engine comes to ContactoUno it tries to parse/execute those methods from the Messenger object but they aren't available yet, hence the error.

That's exactly why you need to use events like OnEvent_Initialize(bMessengerStart), or in the above case even better OnEvent_SigninReady(sEmail).



Study the Official Plus! Live Scripting Documentation and the JScript 5.6 Documentation.


This post was edited on 11-05-2006 at 11:11 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
11-05-2006 10:58 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
How to open group chat windows - by Poki on 11-01-2006 at 12:31 AM
RE: How to open group chat windows - by ins4ne on 11-01-2006 at 12:33 AM
RE: How to open group chat windows - by Poki on 11-01-2006 at 01:37 AM
RE: How to open group chat windows - by deAd on 11-01-2006 at 02:10 AM
RE: How to open group chat windows - by Poki on 11-01-2006 at 11:41 AM
RE: RE: How to open group chat windows - by Felu on 11-01-2006 at 11:45 AM
RE: How to open group chat windows - by Poki on 11-01-2006 at 03:05 PM
RE: How to open group chat windows - by deAd on 11-01-2006 at 10:56 PM
RE: How to open group chat windows - by Poki on 11-02-2006 at 10:59 AM
RE: How to open group chat windows - by Matti on 11-02-2006 at 04:13 PM
RE: How to open group chat windows - by Poki on 11-02-2006 at 05:52 PM
RE: How to open group chat windows - by Matti on 11-02-2006 at 06:00 PM
RE: How to open group chat windows - by Felu on 11-02-2006 at 06:00 PM
RE: How to open group chat windows - by Poki on 11-02-2006 at 06:03 PM
RE: How to open group chat windows - by Plan-1130 on 11-02-2006 at 09:46 PM
RE: How to open group chat windows - by Poki on 11-02-2006 at 10:18 PM
RE: How to open group chat windows - by deAd on 11-02-2006 at 10:42 PM
RE: How to open group chat windows - by Poki on 11-02-2006 at 10:43 PM
RE: How to open group chat windows - by Plan-1130 on 11-03-2006 at 11:18 AM
RE: How to open group chat windows - by Poki on 11-03-2006 at 10:13 PM
RE: How to open group chat windows - by Plan-1130 on 11-04-2006 at 06:52 PM
RE: How to open group chat windows - by Poki on 11-04-2006 at 07:19 PM
RE: How to open group chat windows - by Plan-1130 on 11-04-2006 at 07:40 PM
RE: RE: How to open group chat windows - by CookieRevised on 11-05-2006 at 10:58 PM
RE: How to open group chat windows - by Poki on 11-05-2006 at 06:42 PM
RE: How to open group chat windows - by Poki on 11-05-2006 at 11:24 PM
RE: RE: How to open group chat windows - by CookieRevised on 11-05-2006 at 11:29 PM
RE: How to open group chat windows - by Poki on 11-09-2006 at 03:17 PM
RE: How to open group chat windows - by Felu on 11-09-2006 at 03:24 PM
RE: How to open group chat windows - by Plan-1130 on 11-09-2006 at 03:34 PM
RE: How to open group chat windows - by Poki on 11-09-2006 at 03:52 PM
RE: How to open group chat windows - by Plan-1130 on 11-09-2006 at 04:07 PM
RE: How to open group chat windows - by CookieRevised on 11-09-2006 at 05:33 PM
RE: How to open group chat windows - by Poki on 11-09-2006 at 05:41 PM


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