How to open group chat windows - 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: How to open group chat windows (/showthread.php?tid=67917)
How to open group chat windows by Poki on 11-01-2006 at 12:31 AM
Hi everyone! Must admit I'm a newbie here. Before making this question I've already looked for it in the phorum, but couldn't figure it out.
So,
I want to open a multi-chat window for a few friends that I have to check if they are online. I figured out how to do it individually, but couldn't find the option for opening multi chat window, or inviting someone to an already active chat window.
Any ideas??
Thanks in advance, Pok.
RE: How to open group chat windows by ins4ne on 11-01-2006 at 12:33 AM
click the 'add contact' button
RE: How to open group chat windows by Poki on 11-01-2006 at 01:37 AM
Yeah, I know that. What I was talking about was how to script that.
Any thoughts?
RE: How to open group chat windows by deAd on 11-01-2006 at 02:10 AM
You can use ChatWnd.SendMessage("/invite email"). This sends the /invite command.
RE: How to open group chat windows by Poki on 11-01-2006 at 11:41 AM
Ok, thanks. That seems to work.
So another question, I really don't know much about Jscript, so, how do I immply some variable in the text? I mean, that email is actually my var semails[i] with 0<i<6....
RE: RE: How to open group chat windows by Felu on 11-01-2006 at 11:45 AM
quote: Originally posted by Poki
Ok, thanks. That seems to work.
So another question, I really don't know much about Jscript, so, how do I immply some variable in the text? I mean, that email is actually my var semails[i] with 0<i<6....
See the Windows Script 5.6 Documentation. It has good information on JScript.
RE: How to open group chat windows by Poki on 11-01-2006 at 03:05 PM
Well, thanks for the advice. I'm reading the documentation.
RE: How to open group chat windows by deAd on 11-01-2006 at 10:56 PM
code: ChatWnd.SendMessage("/invite " + semails[i]);
Is that what you meant?
RE: How to open group chat windows by Poki on 11-02-2006 at 10:59 AM
That's it. I figured out.
Now I'm trying to count how many contacts are present in the chat window.
I've found this:
var WndContacts = iOriginWnd.Contacts;
if(WndContacts.Count == 2){do some stuff}
but I'm having problems agains..
anybody??
great help guys, I would never make a script without your help.
RE: How to open group chat windows by Matti on 11-02-2006 at 04:13 PM
What is the problem? How can we help if you don't point out what's going wrong?
We'd like to help, but we can't answer if there is no clear question.
RE: How to open group chat windows by Poki on 11-02-2006 at 05:52 PM
Ok. So I'm probably not clear enough.
Again, very thankful for all your help. I expect to share my knowledge back...once I master this thing.
So, now I'm trying the OnEvent_ContactSignIn, but the script doesn't run in that case.
I'm just adding;
function OnEvent_ContactSignin("somemail@hotmail.com")
{
}
and that's it, it doesn't work. Neither when I put inside the function some dumb statement as
var ChatWnd = Messenger.OpenChat(sEmails[0]);
if (ChatWnd.EditChangeAllowed) ChatWnd.SendMessage("bla bla bla");
Do you know why??
RE: How to open group chat windows by Matti on 11-02-2006 at 06:00 PM
quote: Originally posted by Poki
code: function OnEvent_ContactSignin("somemail@hotmail.com")
{
}
Function parameters aren't meant to work that way. A parameter is to retrieve information from the function call, and then process it. What you want is to check if the email matches a certain e-mail address.
Therefore, you need this code:
code: function OnEvent_ContactSignin(Email) {
if(Email == "someone@hotmail.com") {
//Do your thing here
}
}
More information about declaring correct functions in JavaScript
RE: How to open group chat windows by Felu on 11-02-2006 at 06:00 PM
quote: Originally posted by Poki
function OnEvent_ContactSignin("somemail@hotmail.com")
{
}
code: function OnEvent_ContactSignin(Email){
if(Email =="something@hotmail.com"){
//do something
}
}
RE: How to open group chat windows by Poki on 11-02-2006 at 06:03 PM
That's right! Thanks again. I'm in my way to make a good (at least for me) script..
So, this is finally going to work!
Almost all my script is working fine, so my last problem seems to be just and if condition...
(promise I will post it after all this)
I have...
if ((Email==sEmails[1]) && (ContactoUno.Status != 1) ){
//do some stuff
}
but it doesn't do the stuff, even after sEmails[1] logs in, and the other one is connected.
I asume the AND condition is right, isn't it? (&&), and I'm sure that the conditions are ok, so? i don't know...
RE: How to open group chat windows by Plan-1130 on 11-02-2006 at 09:46 PM
the && is correct, what you could do is use Debug.Trace(ContactoUno.Status); to show values of variables, if it gives an error, you know hte variable is wrong
RE: How to open group chat windows by Poki on 11-02-2006 at 10:18 PM
Ok. I'm trying, but actually I don't understand how to use the Debug..
I'm already enabling debuggin options, but what's supposed to happen? what's the debug window? it seems like i'm having a very stupid problem!
Maybe I've found my mistake, but I'm not quite sure. Is it possible that if I've defined a variable in the SignInReady function, is it local and won't work in ContactSignIn function???
RE: How to open group chat windows by deAd on 11-02-2006 at 10:42 PM
quote: Originally posted by Poki
Maybe I've found my mistake, but I'm not quite sure. Is it possible that if I've defined a variable in the SignInReady function, is it local and won't work in ContactSignIn function???
Yes. What's in the variable?
RE: How to open group chat windows by Poki on 11-02-2006 at 10:43 PM
ok, that worked fine once I've realised about the global variable.
but what about the debugging? how to do it? i'm lost
RE: How to open group chat windows by Plan-1130 on 11-03-2006 at 11:18 AM
Main window of WLM > Plus! >Scriptdebugger
It's a window that displays useful information on errors etc.
You can add a line, like a variable to show the contents of the variable.
If it's null it's empty, if it's NaN, it's Not a Number etc. etc.
As it's called debug, you can de-bug your program/script
RE: How to open group chat windows by Poki on 11-03-2006 at 10:13 PM
So...I might found the problem, so here's the question, do I have to redefine global variables in every function??
Particulary in OnEvent_SingInReady function??
But....are functions where I do not have to redefine them? or in every function do i?
10q....
RE: How to open group chat windows by Plan-1130 on 11-04-2006 at 06:52 PM
Global variables are globaly defined, which means you don't have to redefine them again, in no function.
Once defined they are accessable everywhere in all the code.
Local variables, have to be redefined in every function and will be deleted from the memory once the function has ended.
This example will explain:
code: var GlobalVariable;
function Blah(ParsedVariable1)
{
var LocalVariable = "value";
GlobalVariable = "value too";
Blah2(ParsedVariable1);
}
function Blah2(ParsedVariable2)
{
//GlobalVariable is still "value too",
//LocalVariable isn't accessible (but exists in the memory, since Blah isn't yet ended, which will end as soo as Blah2 end, because i called Blah2 inside Blah, as Blah will then wait for Blah2 to end)
//ParsedVariable2 is the same as ParsedVariable1
//ParsedVariable isn't accessible (see LocalVariable)
}
Hope this helps
RE: How to open group chat windows by Poki on 11-04-2006 at 07:19 PM
Yeah, but there is still something that I do not understand.
Do I have to make it explicit that they are global variables? I mean, in Matlab i define, global MyVar...
But, here it seems that it's just defining it outside every function. Is it like that or something else? Because, in that case, I got a problem because my script wasn't taking global variables correctly..I had to redefine them in every function to make it work, even though I defined them outside...so I don't find the problem...
RE: How to open group chat windows by Plan-1130 on 11-04-2006 at 07:40 PM
Global variables have to be defined before anything else, like shown in my example, you can't define global variables any other way AFAIK.
RE: How to open group chat windows by Poki on 11-05-2006 at 06:42 PM
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?
RE: RE: How to open group chat windows by CookieRevised on 11-05-2006 at 10:58 PM
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.
RE: How to open group chat windows by Poki on 11-05-2006 at 11:24 PM
Well, thanks, that was really useful.
So, let me see if I undestood, I had to define the global variables just as I did, but...
don't give them any value before objects like Messenger are fully loaded, so the assignment of the variable had to be done maybe in OnEvent_SignInReady(email), because there I can be sure that Messenger object is ready and there would be no problem in assigning the correct value....
(just verbalizing for myself...)
Again, thanks to every one who helped me in this attempt to make a script...I'll be posting it soon.
Seeya.
RE: RE: How to open group chat windows by CookieRevised on 11-05-2006 at 11:29 PM
quote: Originally posted by Poki
Well, thanks, that was really useful.
So, let me see if I undestood, I had to define the global variables just as I did, but...
don't give them any value before objects like Messenger are fully loaded, so the assignment of the variable had to be done maybe in OnEvent_SignInReady(email), because there I can be sure that Messenger object is ready and there would be no problem in assigning the correct value....
Absolutely correct
RE: How to open group chat windows by Poki on 11-09-2006 at 03:17 PM
Well, finally....
It's done.
May I ask you....how do I export my script so is it downloadable and ready to go?
I only have my .js script, but have several friends who won't know how to make it run unless I do something like that.
RE: How to open group chat windows by Felu on 11-09-2006 at 03:24 PM
quote: Originally posted by Poki
Well, finally....
It's done.
May I ask you....how do I export my script so is it downloadable and ready to go?
I only have my .js script, but have several friends who won't know how to make it run unless I do something like that.
Seek the Messenger Plus! Live Scripting documentation for Packing your Script. To submit your script to the Scripts Database read Submit Instructions.
RE: How to open group chat windows by Plan-1130 on 11-09-2006 at 03:34 PM
You can get a script packager of MPScripts Tools website, this basicly does all the work for you
RE: How to open group chat windows by Poki on 11-09-2006 at 03:52 PM
Well, I've read the MPL scripting guide and there, it says:
make an ScriptInfo.xml with the other files, then zip it but, change its file extension so it can be interpreted as a MPL script.
I did that, but when trying to install it, Messenger says
"The file you try to load does not appear to be a valid Messenger Plus! script pack."
But the .js script is doing ok, so the problem seems to be how to pack it.
What am I missing??
RE: How to open group chat windows by Plan-1130 on 11-09-2006 at 04:07 PM
As i said, use the script packager
RE: How to open group chat windows by CookieRevised on 11-09-2006 at 05:33 PM
quote: Originally posted by Poki
Well, I've read the MPL scripting guide and there, it says:
make an ScriptInfo.xml with the other files, then zip it but, change its file extension so it can be interpreted as a MPL script.
I did that, but when trying to install it, Messenger says
"The file you try to load does not appear to be a valid Messenger Plus! script pack."
But the .js script is doing ok, so the problem seems to be how to pack it.
What am I missing??
The problem is not how to pack it, because for that you simply zip all the files into 1 zip file (and rename the .ZIP extension to .PLSC)...
Your problem is most likely that your files (ScriptInfo.xml and/or yourscript.js) are not in unicode format but in text format.
Look at the example given in the scripting docs for the ScriptInfo.xml file (many scripts you can download from the forum and even on the official script database do not include a fully proper ScriptInfo.xml with all the tags; eg: the header tags quite often are missing). When you've edited the official example to suite your needs save it as "Unicode" in notepad.
This is also explained somewhere in the scripting docs...
RE: How to open group chat windows by Poki on 11-09-2006 at 05:41 PM
It worked! 10q!
|