What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Auto Responding Answering Machine Script (based on timeout not keywords)

Poll: Is this suggestion do-able? Or it already exists?
Yes, it's possible (but no one's done it yet)
Yes, it's possible (and it's already out there!)
No, it's impossible
No idea... Hmm...
[Show Results | Edit Poll]
Note: This is a public poll; other users will be able to see what you voted for.
Auto Responding Answering Machine Script (based on timeout not keywords)
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Auto Responding Answering Machine Script (based on timeout not keywords)
Here is something quick, dirty and untested:

Edit: Just realized it wont actually work because after you send a message it will be deleted from the object and the code will be fired again if they send another one...

Javascript code:
// Create an object container
var objChatWnd = {};
// Define the message to send
var sMessageToSend = 'I have not read your message yet. But don\'t worry; I will!';
 
// Capture any message we send and store them in the object container
function OnEvent_ChatWndSendMessage(oChatWnd, sMessage) {
    objChatWnd[oChatWnd.Handle] = {};
        objChatWnd[oChatWnd.Handle].oChatWnd = oChatWnd;
        objChatWnd[oChatWnd.Handle].sMessage = sMessage;
        objChatWnd[oChatWnd.Handle].nTimer = 0;
}
 
// Check if we sent the message or if the contact did
function OnEvent_ChatWndReceiveMessage(oChatWnd, sOrigin, sMessage, nMessageKind) {
    if (objChatWnd[oChatWnd.Handle].sMessage === sMessage &&
         sMessage !== sMessageToSend) {
        // Chances are that this is the message we just sent
        delete objChatWnd[oChatWnd.Handle];
        return sMessage;
    }
   
    if (Interop.Call('user32', 'GetForegroundWindow') !== oChatWnd.Handle) {
        // A message was received but the Window isn't in the foreground
        if (typeof objChatWnd[oChatWnd.Handle] !== 'object') {
            // Also this is the first message received from the contact
            //we wont acount for consecutive messages
            objChatWnd[oChatWnd.Handle] = {};
                objChatWnd[oChatWnd.Handle].oChatWnd = oChatWnd;
                objChatWnd[oChatWnd.Handle].nTimer = 0;
            MsgPlus.AddTimer(oChatWnd.Handle, 100);
        }
    }
}
 
// If we haven't opened the message in a minute then reply otherwise increment our counter
function OnEvent_Timer(sTimerId) {
    // Chat window is open nothing further to be done here
    if (Interop.Call('user32'. 'GetForegroundWindow') === sTimerId) {
        /* by not deleting the object the code should never fire if the contact sends another message
        after we say we didn't read it yet */

        //delete objChatWnd[sTimerId];
        return;
    }
 
    // Chat window hasn't been opened yet but a minute hasn't passed... increment the counter
    if (objChatWnd[sTimerId].nTimer / 100 !== 60) { // 1 minute
        ++objChatWnd[sTimerId].nTimer;
        MsgPlus.AddTimer(sTimerId, 100);
    } else {
    // Message hasn't been read in a minute send the message if we are allowed
        if (objChatWnd[sTimerId].oChatWnd.EditChangeAllowed === true) {
            objChatWnd[sTimerId].oChatWnd.SendMessage(sMessageToSend);
        }
    }
}


This post was edited on 02-19-2010 at 02:29 PM by matty.
02-18-2010 03:25 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Auto Responding Answering Machine Script (based on timeout not keywords) - by lowaloysius on 01-17-2010 at 04:09 PM
RE: Suggestion - by stoshrocket on 01-17-2010 at 04:34 PM
RE: Suggestion - by Chrissy on 01-17-2010 at 08:18 PM
RE: Suggestion - by stoshrocket on 01-17-2010 at 08:25 PM
RE: Auto Responding Answering Machine Script (based on timeout not keywords) - by lowaloysius on 01-18-2010 at 05:23 AM
RE: Auto Responding Answering Machine Script (based on timeout not keywords) - by matty on 01-18-2010 at 02:30 PM
RE: RE: Auto Responding Answering Machine Script (based on timeout not keywords) - by lowaloysius on 01-18-2010 at 03:08 PM
RE: Auto Responding Answering Machine Script (based on timeout not keywords) - by matty on 01-18-2010 at 03:29 PM
RE: RE: Auto Responding Answering Machine Script (based on timeout not keywords) - by lowaloysius on 01-19-2010 at 01:33 AM
RE: Auto Responding Answering Machine Script (based on timeout not keywords) - by matty on 02-18-2010 at 03:25 PM
RE: Auto Responding Answering Machine Script (based on timeout not keywords) - by billyy on 02-18-2010 at 07:54 PM
RE: Auto Responding Answering Machine Script (based on timeout not keywords) - by matty on 02-18-2010 at 08:05 PM
RE: Auto Responding Answering Machine Script (based on timeout not keywords) - by billyy on 02-18-2010 at 08:14 PM
RE: Auto Responding Answering Machine Script (based on timeout not keywords) - by matty on 02-18-2010 at 08:17 PM
RE: Auto Responding Answering Machine Script (based on timeout not keywords) - by billyy on 02-18-2010 at 08:25 PM
RE: Auto Responding Answering Machine Script (based on timeout not keywords) - by matty on 02-18-2010 at 08:44 PM
RE: Auto Responding Answering Machine Script (based on timeout not keywords) - by billyy on 02-18-2010 at 10:01 PM
RE: Auto Responding Answering Machine Script (based on timeout not keywords) - by lowaloysius on 02-19-2010 at 05:21 AM
RE: Auto Responding Answering Machine Script (based on timeout not keywords) - by matty on 02-19-2010 at 12:54 PM
RE: Auto Responding Answering Machine Script (based on timeout not keywords) - by billyy on 02-19-2010 at 05:02 PM


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