Shoutbox

Auto Responding Answering Machine Script (based on timeout not keywords) - 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: Auto Responding Answering Machine Script (based on timeout not keywords) (/showthread.php?tid=93564)

Auto Responding Answering Machine Script (based on timeout not keywords) by lowaloysius on 01-17-2010 at 04:09 PM

I've been looking for an answering machine script, which automatically responds with some pre-configured message if I don't view the message within a pre-set time.

So far the answering machine scripts I have seen only seem to be doing the automatic answering based on keywords / people, but none appears to be doing what I'm looking for.

I'm just wondering if this feature can be done by scripting extensions, or is this totally impossible. If it's possible, it'll be great if someone could code it! Feedback anyone? :)

P.S. If something like this is already out there, please point me to it - I've been browsing the scripts from start to end but can't find anything like that... TIA!


RE: Suggestion by stoshrocket on 01-17-2010 at 04:34 PM

Looking over the database I don't think it's been done yet, but it is certainly possible. However, I'm in the middle of my exams and suck at javascript, so I don't think I'd be the right person to try and code it. With a little knowledge and some time you could give it a go yourself though!


RE: Suggestion by Chrissy on 01-17-2010 at 08:18 PM

quote:
Originally posted by stoshrocket
Looking over the database I don't think it's been done yet, but it is certainly possible. However, I'm in the middle of my exams and suck at javascript, so I don't think I'd be the right person to try and code it. With a little knowledge and some time you could give it a go yourself though!
It's JScript is it not?
RE: Suggestion by stoshrocket on 01-17-2010 at 08:25 PM

quote:
Originally posted by krissy-afc
quote:
Originally posted by stoshrocket
Looking over the database I don't think it's been done yet, but it is certainly possible. However, I'm in the middle of my exams and suck at javascript, so I don't think I'd be the right person to try and code it. With a little knowledge and some time you could give it a go yourself though!
It's JScript is it not?
Indeed, but if I suck at Javascript I'm not going to be much better in JScript am I? :P
RE: Auto Responding Answering Machine Script (based on timeout not keywords) by lowaloysius on 01-18-2010 at 05:23 AM

i'm still trying to get the hang of jscript... never done it before... was reading the scripting help file but it'll take time cos i'm still trying to understand it...

hopefully someone more experienced is able to help create this script - i promise i'll rush to download and use it once it's done ;)


RE: Auto Responding Answering Machine Script (based on timeout not keywords) by matty on 01-18-2010 at 02:30 PM

This isn't as easy said as done.

Currently the only way to subclass the chat windows is to use an external library.

However before something like this can be done you need to answer a few questions.

  • How do you determine if the message is read? Would the counter only start if the window was minimized or would it be classified as read if the window is in the foreground?
  • What would happen if 2 messages are received 10 seconds apart, do you reset the timer? Add a second timer? Ignore all subsequent messages?

RE: RE: Auto Responding Answering Machine Script (based on timeout not keywords) by lowaloysius on 01-18-2010 at 03:08 PM

hi matty,

my answers below.

maybe to simplify things, let's tie it to the way the chat windows are behaving now...

when someone sends a message, it blinks if it's not in the foreground, and after some time of blinking, it stops blinking and stays 'lighted' (the orange colour if you get what i meant)...

so similarly, when the window stops blinking and stays lighted it can send the automated reply... of course, it'll be good if a time delay can be set so say after 5 mins if the window is still not brought to the foreground, the auto reply message gets sent...

quote:
Originally posted by matty
This isn't as easy said as done.

Currently the only way to subclass the chat windows is to use an external library.

However before something like this can be done you need to answer a few questions.

  • How do you determine if the message is read?
    --> much like the blinking window, once you bring the window to the foreground, it's considered 'read'.
    Would the counter only start if the window was minimized or would it be classified as read if the window is in the foreground?
    --> Counter will only start if the message is received and the chat window is not in the foreground
  • What would happen if 2 messages are received 10 seconds apart, do you reset the timer? Add a second timer? Ignore all subsequent messages?
    --> only the first message counts, much like the blinking window again - if you don't bring it to the foreground, it blinks for a while before staying 'lighted' instead of blinking continuously


hope this clarifies :)

so is it still do-able? or not possible at all?
RE: Auto Responding Answering Machine Script (based on timeout not keywords) by matty on 01-18-2010 at 03:29 PM

It is still doable. Just without writing an external library for it will be quite a bit memory intensive.


RE: RE: Auto Responding Answering Machine Script (based on timeout not keywords) by lowaloysius on 01-19-2010 at 01:33 AM

quote:
Originally posted by matty
It is still doable. Just without writing an external library for it will be quite a bit memory intensive.

hi matty,

does this mean you'll be able to work on it? and with the help of an external library?

anyway don't sound good if it's memory intensive so it sure sound like a very challenging one...

i'll await with great anticipation... :)
RE: Auto Responding Answering Machine Script (based on timeout not keywords) by matty on 02-18-2010 at 03:25 PM

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...

js 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);
        }
    }
}

RE: Auto Responding Answering Machine Script (based on timeout not keywords) by billyy on 02-18-2010 at 07:54 PM

Wait, i'm terible at english and i don't exactly understand what you are doing here... But wasnt there a limit of messages a script could send?! Wouldn't that mean that it would fail after that amount of messages is exceeded?


RE: Auto Responding Answering Machine Script (based on timeout not keywords) by matty on 02-18-2010 at 08:05 PM

The OP is looking for a script that will auto respond to a message if they haven't "read" it after a period of time. In this case if the message is sent and after 1 minute you dont bring the window to the foreground it will send an auto reply. Completly different than what was requested in the other thread...


RE: Auto Responding Answering Machine Script (based on timeout not keywords) by billyy on 02-18-2010 at 08:14 PM

but still... what if 20 people send a message, and you are not there... wouldnt it fail?


RE: Auto Responding Answering Machine Script (based on timeout not keywords) by matty on 02-18-2010 at 08:17 PM

What are the chances of 20 people sending you a message at the exact same time.

And there is a minute delay so there shouldn't be an opportunity of meeting the flood delay.


RE: Auto Responding Answering Machine Script (based on timeout not keywords) by billyy on 02-18-2010 at 08:25 PM

well not rly the same time... but if you are like watching some tv... and you have  load of friends who are all talking to you... don't you think it could happen? what would you do in that situation?
alltough i might be wrong here.. there was a script that i had that had send a friend about 30 buzzers :S


RE: Auto Responding Answering Machine Script (based on timeout not keywords) by matty on 02-18-2010 at 08:44 PM

Nudges are totally different. There is a flood protection but I doubt it will be hit because of the delay. I only put 1 minute for testing purposes.


RE: Auto Responding Answering Machine Script (based on timeout not keywords) by billyy on 02-18-2010 at 10:01 PM

hmm, i gues its unlikely enoug hto maake this script effective :/


RE: Auto Responding Answering Machine Script (based on timeout not keywords) by lowaloysius on 02-19-2010 at 05:21 AM

well billyy, are you able to improve on this script? it's most definitely a co-development effort since the code is made known and you had some comments about it... further, this code i believe matty did it quite quickly without much testing so it'll be good if you could help improve on it so that a good version can be released to the www :)


RE: Auto Responding Answering Machine Script (based on timeout not keywords) by matty on 02-19-2010 at 12:54 PM

No offense to billyy but I don't think his level of ability would be much assistance. I have a few ideas of how to fix it I just need to spend a few minutes looking over the code when I get to work.


RE: Auto Responding Answering Machine Script (based on timeout not keywords) by billyy on 02-19-2010 at 05:02 PM

Yeah no i haven't realy had the time to study this language much and im too much of a sleepy head to fix other peoples mistakes...
I'm just fooling around a bit, it could take hours of intense study to fully understan this all :/

edit:
okay hours, maybe a few days.. i realy wouldnt know since i have no idea what javascript is capable of atm.
I will maybe later try to understand more, and maybe one day i will actualy be good at this..
But atm i realy suck donkey ****z [Image: undecided.gif]