What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Chat window open

Pages: (3): « First [ 1 ] 2 3 » Last »
Chat window open
Author: Message:
mlevit
Junior Member
**


Posts: 50
Reputation: 2
37 / Male / –
Joined: Sep 2005
O.P. Chat window open
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
07-29-2006 05:14 AM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Chat window open
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]

This post was edited on 07-29-2006 at 07:15 AM by matty.
07-29-2006 06:03 AM
Profile E-Mail PM Find Quote Report
mlevit
Junior Member
**


Posts: 50
Reputation: 2
37 / Male / –
Joined: Sep 2005
O.P. RE: Chat window open
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?

This post was edited on 07-29-2006 at 08:36 AM by mlevit.
07-29-2006 08:26 AM
Profile PM Find Quote Report
markee
Veteran Member
*****

Avatar

Posts: 1622
Reputation: 50
36 / Male / Flag
Joined: Jan 2006
RE: Chat window open
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.

This post was edited on 07-29-2006 at 08:37 AM by markee.
[Image: markee.png]
07-29-2006 08:36 AM
Profile PM Find Quote Report
mlevit
Junior Member
**


Posts: 50
Reputation: 2
37 / Male / –
Joined: Sep 2005
O.P. RE: Chat window open
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?

This post was edited on 07-29-2006 at 09:44 AM by mlevit.
07-29-2006 08:41 AM
Profile PM Find Quote Report
mlevit
Junior Member
**


Posts: 50
Reputation: 2
37 / Male / –
Joined: Sep 2005
O.P. RE: Chat window open
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.
07-29-2006 11:08 AM
Profile PM Find Quote Report
NanaFreak
Scripting Contest Winner
*****


Posts: 1476
Reputation: 53
32 / Male / Flag
Joined: Jul 2006
RE: Chat window open
Maybe try this script that is already in the scripts database, I think it is what you are looking for.
07-29-2006 01:01 PM
Profile PM Find Quote Report
mlevit
Junior Member
**


Posts: 50
Reputation: 2
37 / Male / –
Joined: Sep 2005
O.P. RE: Chat window open
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.

This post was edited on 07-30-2006 at 11:07 PM by mlevit.
07-29-2006 01:05 PM
Profile PM Find Quote Report
leachy08
Junior Member
**


Posts: 35
Joined: Jul 2006
RE: Chat window open
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

This post was edited on 08-02-2006 at 12:58 PM by leachy08.
08-02-2006 12:29 PM
Profile E-Mail PM Find Quote Report
leachy08
Junior Member
**


Posts: 35
Joined: Jul 2006
RE: Chat window open
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.

This post was edited on 08-04-2006 at 08:56 PM by leachy08.
08-04-2006 08:54 PM
Profile E-Mail PM Find Quote Report
Pages: (3): « First [ 1 ] 2 3 » Last »
« Next Oldest Return to Top Next Newest »


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