What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Nudge Open Chats

Nudge Open Chats
Author: Message:
vSanjo
New Member
*

Poookeemoonn~

Posts: 5
33 / Male / Flag
Joined: Jan 2010
O.P. Nudge Open Chats
I'm having a little trouble with making a script for a friend that nudges open chats only.
I was planning on using /nudge to send them.
It seemed simple enough at first but I just can't manage it now.
Any help would be appreciated. (:
02-01-2010 03:18 PM
Profile E-Mail PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Nudge Open Chats
Are you trying to nudge all open chat windows when you type /nudge?

Post your code and we can show you where you went wrong.
02-01-2010 03:28 PM
Profile E-Mail PM Find Quote Report
vSanjo
New Member
*

Poookeemoonn~

Posts: 5
33 / Male / Flag
Joined: Jan 2010
O.P. RE: Nudge Open Chats
I haven't got any right now. It just wasn't working at all.
Ideally, I want to have a menu button to nudge all open contacts. I was planning on using some way to send /nudge to all chats.
02-01-2010 03:44 PM
Profile E-Mail PM Web Find Quote Report
Mnjul
forum super mod
******

Avatar
plz wub me

Posts: 5396
Reputation: 58
– / Other / Flag
Joined: Nov 2002
Status: Away
RE: Nudge Open Chats
Does simply sending /all /nudge work?
02-01-2010 05:09 PM
Profile PM Web Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
RE: Nudge Open Chats
quote:
Originally posted by Mnjul
Does simply sending /all /nudge work?
Yes... that works apparently. :O
Just type that every time you need it or, if you really want to, make a quick text with a custom command for it. :)

Anyway, if you're looking to learn some scripting, this task can be a good exercise. When you got the command you're looking for when handling OnEvent_ChatWndSendMessage, iterate through the list of opened chat windows and send "/nudge" to each window. ;)
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
02-01-2010 05:16 PM
Profile E-Mail PM Web Find Quote Report
vSanjo
New Member
*

Poookeemoonn~

Posts: 5
33 / Male / Flag
Joined: Jan 2010
O.P. RE: Nudge Open Chats
Gah. It seemed too simple so I didn't bother testing. I didn't think command + command would work!
*gonk*

Okay, I can do this. (:
And Matti, the main problem Iwas having -was- moving from chat to chat. ):
02-01-2010 11:35 PM
Profile E-Mail PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Nudge Open Chats
Javascript code:
for (var oChat = new Enumerator(Messenger.CurrentChats); !oChat.atEnd(); oChat.moveNext()) {
    Debug.Trace(oChat.item().Handle);
}


This post was edited on 02-02-2010 at 12:32 AM by matty.
02-02-2010 12:31 AM
Profile E-Mail PM Find Quote Report
vSanjo
New Member
*

Poookeemoonn~

Posts: 5
33 / Male / Flag
Joined: Jan 2010
O.P. RE: Nudge Open Chats
I managed to make it work to a degree.
code:
function OnGetScriptMenu(Location)
{
    var ScriptMenu = "<ScriptMenu>";
    ScriptMenu += "<MenuEntry Id=\"nudgeall\">Nudge All</MenuEntry>";
    ScriptMenu += "</ScriptMenu>";
    return ScriptMenu;
}

function OnEvent_MenuClicked(MenuItemId, Location, OriginWnd)
{
    if(MenuItemId == "nudgeall")
    {
        if (Messenger.MyEmail == "sanjo@mapletip.com")
        {
            for (var oChat =  new Enumerator(Messenger.CurrentChats); !oChat.atEnd();  oChat.moveNext())
            {
                Debug.Trace(oChat.item().Handle);
                OriginWnd.SendMessage("/nudge");
            }
        }
        if (Messenger.MyEmail != "sanjo@mapletip.com")
        {
            OriginWnd.SendMessage("Not authorized!");
        }
    }
}


It sends a nudge to everyone, but if n is the amount of open chats, it does n*nudges to each chat.
Any way to fix this?

Edit: At first, I thought it was counting the nudges across chats, but if you change /nudge to like.. 'Rawr', it'll send n*rawr to each chat.

Edit 2:

code:
function OnGetScriptMenu(Location)
{
    var ScriptMenu = "<ScriptMenu>";
    ScriptMenu += "<MenuEntry Id=\"nudgeall\">Nudge All</MenuEntry>";
    ScriptMenu += "</ScriptMenu>";
    return ScriptMenu;
}

function OnEvent_MenuClicked(MenuItemId, Location, OriginWnd)
{
    if(MenuItemId == "nudgeall")
    {
        if (Messenger.MyEmail == "sanjo@mapletip.com")
        {
            for (var oChat =  new Enumerator(Messenger.CurrentChats); !oChat.atEnd();  oChat.moveNext())
            {
                Debug.Trace(oChat.item().Handle);

                OriginWnd.SendMessage("/nudge");
            }
        }

        if (Messenger.MyEmail != "sanjo@mapletip.com")
        {
            OriginWnd.SendMessage("Not authorized!");
        }
    }
}


I just removed the red.
See.. I was mixed up on 2 plans. 1 was to send /all /nudge to a single chat through a button, or /nudge to each contact through a button that goes through each chat.
I'm so silly.

This post was edited on 02-02-2010 at 02:54 PM by vSanjo.
02-02-2010 01:58 PM
Profile E-Mail PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Nudge Open Chats
This is happening because the OriginWnd parameter of the OnEvent_MenuClicked event is the Chat Window where the menu is clicked. This will never change unless you click the menu from another Chat Window.

You would need to use:
Javascript code:
oChat.item().SendMessage('/nudge');


But you also want to make sure that you can send the message to begin with:

Javascript code:
function OnGetScriptMenu(Location) {
    return '<ScriptMenu><MenuEntry Id="nudgeall">Nudge All</MenuEntry></ScriptMenu>';
}
 
function OnEvent_MenuClicked(MenuItemId, Location, OriginWnd) {
    if (Messenger.MyEmail === 'sanjo@mapletip.com') {
        if(MenuItemId === "nudgeall") {
            for (var oChat =  new Enumerator(Messenger.CurrentChats); !oChat.atEnd();  oChat.moveNext()) {
                if (oChat.item().EditChangeAllowed === true) {
                    oChat.item().SendMessage('/nudge');
                }
            }
        }
    }
    else {
        OriginWnd.SendMessage('Not authorized!');
    }
}


This post was edited on 02-02-2010 at 02:51 PM by matty.
02-02-2010 02:49 PM
Profile E-Mail PM Find Quote Report
« 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