Shoutbox

active window - 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: active window (/showthread.php?tid=72433)

active window by Gareth_2007 on 03-08-2007 at 12:37 AM

hey how do i grab the the messenge i have just been sent in the active window? so merlin will only read the messege in the avtive chat window

i have tryed

function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message){
    var MyChatName = Messenger.MyName;
    var msg = Message;
   
    if ( ChatWnd != Active ) {
     if ( Origin != MyChatName ) {
        merlin.Show();
        merlin.Play("GetAttention");
        merlin.Play("GetAttentionReturn");
        merlin.Play("RestPose");
        merlin.Speak( Origin + " just said " + msg );
        }

any ideas? cheers


RE: active window by matty on 03-08-2007 at 07:02 AM

code:
function OnEvent_ChatWndReceiveMessage(oChatWnd, sOrigin, sMessage){
    var _active_window = Interop.Call('user32', 'GetForegroundWindow');

    if (oChatWnd.Handle === _active_window){
        if (sOrigin !== Messenger.MyName){
            merlin.Show();
            merlin.Play("GetAttention");
            merlin.Play("GetAttentionReturn");
            merlin.Play("RestPose");
            merlin.Speak(sOrigin + " says:" + nMessage);
        }
    }
}