Shoutbox

Chat window open - 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: Chat window open (/showthread.php?tid=64188)

Chat window open by mlevit on 07-29-2006 at 05:14 AM

Hey,

Im trying to get something to work here

code:
var e = new Enumerator(Messenger.MyContacts);
       
        for(; !e.atEnd();  e.moveNext())
        {
            var Contact = e.item();
            Contact.Blocked = "True";
        }


Thats my code, it just iterates through all the messenger contacts. Now what i want is, when it gets to a contact the the user is currently talking to (has the contacts window open) it will not block them ie. if window.open = true etc

Does anybody know the code for this?

Thanks
RE: Chat window open by matty on 07-29-2006 at 06:03 AM

There isn't a way to iterate through the opened conversations. Basically what your doing there is blocking every single contact on your list. As well the .Blocked property accepts booleans (true/false) not strings. So it would be

code:
var e = new Enumerator(Messenger.MyContacts);
        for(; !e.atEnd();  e.moveNext())
        {
            var Contact = e.item();
            Contact.Blocked = true;
        }


Cheap way to do it would be to enum all the IMWindowClass windows store their handles in an array, then for each contact open a chat window and check if the handle existed in the array if it did block them, if it didn't close the window. That is going to be VERY slow but the only way I can see of doing it.

I just noticed the ChatWnds Object.

code:
Debug.Trace("Currently opened chat windows:");
var Windows = Messenger.CurrentChats;
var e = new Enumerator(Windows);
for(; !e.atEnd(); e.moveNext())
{
    var ChatWindow = e.item();
    Debug.Trace(" Handle: " + ChatWindow.Handle);
}

So iterate through the chat windows and instead of tracing the handle, have another function to iterate through ChatWindow.Contacts.

[offtopic]
Anyone ever have out of body experiences? Like you feel like your not actually where you are, right now as I am typing this it feels like I am behind myself looking down.
[/offtopic]
RE: Chat window open by mlevit on 07-29-2006 at 08:26 AM

Ok... what ive tried doing is this, i would run the for loop which should block every contact.

Then i would run

code:
function openedChats()
{
    var Windows = Messenger.CurrentChats;
    var e = new Enumerator(Windows);
    for(; !e.atEnd(); e.moveNext())
    {
        var ChatWindow = e.item();
        ChatWindow.Blocked = false;
    }
}

Which should unblock the current contacts i have open.

I get this an error:

code:
Error: Object doesn't support this property or method.
       Line: 110. Code: -2146827850.

Line 110: ChatWindow.Blocked = false;

I get this because i iterate through chat windows, not the actual contacts themselves. Is there a way of getting the contact from the chat window and then unblocking them?
RE: Chat window open by markee on 07-29-2006 at 08:36 AM

Try this code instead, it uses two enumerators to get the current chat windows and to get the contacts in those chats.  I think it should work, I havent tested it though I'm sorry.

code:
function openedChats()
{
var ChatWnds = Messenger.CurrentChats;
var e = new Enumerator(ChatWnds);
for(; !e.atEnd(); e.moveNext())
{
var ChatWnd = e.item();
var ChatWndContacts = ChatWnd.Contacts;
var e = new Enumerator(ChatWndContacts);
for(; !e.atEnd(); e.moveNext())
{
var Contact = e.item();
Contact.Blocked = false;
}
}
}

quote:
Originally posted by mlevit
I get this an error:

    code:Error: Object doesn't support this property or method.
           Line: 110. Code: -2146827850.



Line 110: ChatWindow.Blocked = false;

Weird, it works when you go through the entire contact list, but not when you go through your open contact list.

Any way around it?
The problem was you were trying to make the window unblocted, not the contacts in it.
RE: Chat window open by mlevit on 07-29-2006 at 08:41 AM

Hmm, doesnt seem to work, still blocks and leaves them blocked

Update: When i run Block All for the second time without unblocking anyone, the contacts that have their windows currently opened become unblocked.

markee your function works, but for some reason, only when it is run the second time by clicking Block All again. I have tried:

openedChats();
openedChats();

And it doesnt work. Only when i run the script 2 seperate times. Any ideas anyone?


RE: Chat window open by mlevit on 07-29-2006 at 11:08 AM

Couldn't get to work.

Final release of the script is Here

If anyone wants to have a crack at this, be my guest.

One other bug i had found was, when you block all/unblock all and then try to change your status it sometimes doesn't change and other times does after a minute or so.

Not sure what that could be.


RE: Chat window open by NanaFreak on 07-29-2006 at 01:01 PM

Maybe try this script that is already in the scripts database, I think it is what you are looking for.


RE: Chat window open by mlevit on 07-29-2006 at 01:05 PM

Yeah ive incorporated that script and have added my own few features and other users features.

This is why i am not submitting this script into the DB because half the work was done by Anthony Leach. I had just made this for my gf, so i customized it to make it easier to use etc.

I've offered it to the people here if they wish to use it or continue the script further.


RE: Chat window open by leachy08 on 08-02-2006 at 12:29 PM

hmm did a search for my name this thread appeared :p
I thought about doing this with my script whereas i would cycle through open contact windows and unblock them. But rushed it really so i just did it so that the person could just open the contact window and then they would become unblocked.

I can probally write the code for you and when i do i will post it here for you...

if i dont seem to be doing anything email me at:
leachy_ov_ashton@hotmail.com
I probally forgot :p

Done the code...

var Windows = Messenger.CurrentChats;
var e = new Enumerator(Windows);
for(; !e.atEnd(); e.moveNext())
{
    var ChatWindow = e.item();
    var Contacts = ChatWindow.Contacts;
    var f = new Enumerator(Contacts);
    for(; !f.atEnd(); f.moveNext()) {
        var Contact = f.item();
        Contact.Blocked=False;
    }
}
Will have to test and probally fix tonight when i get home... Should be home bout alf 5


RE: Chat window open by leachy08 on 08-04-2006 at 08:54 PM

completed teh code now. I simply cycles through contacts in the contact list and will check if there is a window currently open with the contact. If there is then it will skip the block for that contact.

Edit:
Forgot to mention i will post update soon and will give it to Patchou to update the scripts database.


RE: Chat window open by mlevit on 08-04-2006 at 10:48 PM

Could you post the JS file so i could implement the code?

Thanks


RE: Chat window open by Geo on 08-05-2006 at 02:48 PM

Cool.

I waiting to the final script with the function "don't block chat open Windows" included.

Good work. :D


RE: Chat window open by leachy08 on 08-08-2006 at 08:58 PM

Here's the full script with additions from Marat Levit and Intosia. Thanks to both of you for the additions.

I will send this to patchou when i get chance but here's the completed script:

Sorry for the delay....


RE: Chat window open by NanaFreak on 08-08-2006 at 09:04 PM

I just tested it and it works beautifuly so good job on making this script it is good when all you want to do is talk to 1 or 2 people and you have others hasling you. thank you:P


RE: Chat window open by leachy08 on 08-08-2006 at 09:10 PM

6 minutes... WOW that was fast :)
Dont thank just me. Most of the new code was written by Marat Levit and Intosia. I just created some new code to check if the contact had a window open with a person who is about to get blocked. If it did i didnt block them.

Once again Thanks to Marat Levit and Intosia


RE: Chat window open by mlevit on 08-08-2006 at 09:15 PM

Hey Anthony, just got the new script

Nice work mate, just couldn't get that damn blocking thing to not block the open windows :)

Thanks again


RE: Chat window open by leachy08 on 08-09-2006 at 07:49 AM

Should work... or didnt i understand that then? lol


RE: Chat window open by mlevit on 08-09-2006 at 09:40 AM

Yeah your script works fine, i was just saying that when i tried to do what you did i couldn't get it to work.

Its all good :D


RE: Chat window open by leachy08 on 08-09-2006 at 12:39 PM

Ahh i thought that at first but didnt understand lol :)

I think you got confused when using the Contacts and the Contact object which are 2 different objcects. Contacts holding all the contacts from the chatwnd and Contact holding all info for a contact. You would have just needed to iterate though the Contacts object.


RE: Chat window open by Geo on 08-09-2006 at 07:56 PM

Thanks for all. (Y)(Y)(Y):P


RE: Chat window open by leachy08 on 08-10-2006 at 08:00 AM

Your Welcome :)