What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Help me please - Script with counter and auto-response

Pages: (3): « First « 1 [ 2 ] 3 » Last »
Help me please - Script with counter and auto-response
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Help me please - Script with counter and auto-response
You can work off of the following code. This will send a message to the contact and will reply each time they send a message.
Javascript code:
var objChatWnds = {};
var objMessages = { 0 : 'First Message',
                    1 : 'Send Message',
                    2 : 'Third Message'
                  };
 
function OnEvent_ChatWndSendMessage ( oChatWnd , sMessage ) {
    if ( typeof objChatWnds [ oChatWnd.Handle ] === 'undefined' ) {
        // initialize the counter
        objChatWnds [ oChatWnd.Handle ] = {};
        objChatWnds [ oChatWnd.Handle ].Counter = 0;
        objChatWnds [ oChatWnd.Handle ].Message = sMessage;
    }
}
 
function OnEvent_ChatWndReceiveMessage ( oChatWnd , sOrigin , sMessage , nMessageKind ) {
    OnEvent_ChatWndSendMessage ( oChatWnd , '' );
    if ( objChatWnds [ oChatWnd.Handle ] !== 3 && Messenger.MyStatus === STATUS_BUSY && objChatWnds [ oChatWnd.Handle ].Message !== sMessage ) {
        oChatWnd.SendMessage ( objMessages [ objChatWnds [ oChatWnd.Handle ] ] );
        ++objChatWnds [ oChatWnd.Handle ];
    }
}
 
function OnEvent_ChatWndDestroyed ( oChatWnd ) {
    if ( typeof objChatWnds [ oChatWnd.Handle ] === 'object' ) {
        delete objChatWnds [ oChatWnd.Handle ];
    }
}

10-05-2009 01:02 PM
Profile E-Mail PM Find Quote Report
sbari
New Member
*


Posts: 12
– / Male / Flag
Joined: Oct 2009
O.P. RE: Help me please - Script with counter and auto-response
thank you Matty
i have just a problem. i will go up : i will the script send the message : "/all 1st message" every 20 minutes and 5 minutes after a "/closeall 2nd message" (the command /closeall exist in other script) and in status "busy".

thank you very much for your help.
10-05-2009 04:35 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Help me please - Script with counter and auto-response
That makes no sense... anyone understand that?
10-05-2009 04:36 PM
Profile E-Mail PM Find Quote Report
sbari
New Member
*


Posts: 12
– / Male / Flag
Joined: Oct 2009
O.P. RE: Help me please - Script with counter and auto-response
sorry, i am french.
I explain :
I want  that the script send the first message every 20 minutes : "/all 1st message" and after 5 minutes the second message : "/closeall".


do you understand ? :(
10-05-2009 05:05 PM
Profile E-Mail PM Find Quote Report
sbari
New Member
*


Posts: 12
– / Male / Flag
Joined: Oct 2009
O.P. RE: RE: Help me please - Script with counter and auto-response
quote:
Originally posted by sbari
sorry, i am french.
I explain :
I want  that the script send the first message every 20 minutes : "/all 1st message" and after 5 minutes the second message : "/closeall".


do you understand ? :(


the script will an automatic bot : this script will send 2 messages :

      -> one message send every 20 minutes in the active windows only

      -> the second send every 5 minutes after the first message in the active windows only


thank you very much, because i try to script that but i don't understand :(
10-05-2009 05:13 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Help me please - Script with counter and auto-response
Not exactly what you asked for but I will explain what this does.

When your status changes to busy the timer starts. After 20 minutes it will send the first message to all open windows. After 5 minutes the next message is sent. However the second message is only sent every 25 minutes.
Javascript code:
var objMessages = { 0 : 'First Message',
                    1 : 'Send Message',
                  };
 
function OnEvent_MyStatusChange ( nStatus ) {
    if ( nStatus === STATUS_BUSY ) {
        MsgPlus.AddTimer ( 0 , 1200000 ); // 1000 (miliseconds) * 60 (seconds) * 20 (minutes)
    }
}
 
function OnEvent_Timer ( sTimer ) {
    SendMessage ( objMessages [ sTimer ] , Messenger.CurrentChats );
    if ( sTimer === 0 ) {
        MsgPlus.AddTimer ( 1 , 300000 ); // 1000 (miliseconds) * 60 (seconds) * 5 (minutes)
    } else if ( sTimer === 1 ) {
        MsgPlus.AddTimer ( 0 , 1200000 ); // 1000 (miliseconds) * 60 (seconds) * 20 (minutes)
    }
}
 
function SendMessage ( sText , oChatWnds ) {
    for ( var oChatWnd = new Enumerator ( oChatWnds ); !oChatWnd.atEnd(); oChatWnd.moveNext() ) {
        if ( oChatWnd.item().EditChangeAllowed === true ) {
            oChatWnd.item().SendMessage ( sText );
        }
    }
}


This post was edited on 10-08-2009 at 05:12 PM by matty.
10-08-2009 05:10 PM
Profile E-Mail PM Find Quote Report
sbari
New Member
*


Posts: 12
– / Male / Flag
Joined: Oct 2009
O.P. RE: Help me please - Script with counter and auto-response
thank you very much matty ;)
10-08-2009 09:09 PM
Profile E-Mail PM Find Quote Report
sbari
New Member
*


Posts: 12
– / Male / Flag
Joined: Oct 2009
O.P. RE: Help me please - Script with counter and auto-response
hello matty,
i'm sorry but your script have an error :

Erreur : Expected identifier, string or number (code : -2146827260)
       Fichier : compteur officiel.js. Ligne : 3.

thank's very much ;)
10-09-2009 10:40 AM
Profile E-Mail PM Find Quote Report
sbari
New Member
*


Posts: 12
– / Male / Flag
Joined: Oct 2009
O.P. RE: Help me please - Script with counter and auto-response
it is the ',' ;)
10-09-2009 10:42 AM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Help me please - Script with counter and auto-response
I am at work when I write the most of the scripts for this forum and cannot test them. Glad you were able to figure it out.
10-09-2009 12:52 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