What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Auto Answer 1.00

Auto Answer 1.00
Author: Message:
noXon
New Member
*


Posts: 1
Joined: Dec 2008
O.P. Auto Answer 1.00
Hello. I've tried to make an auto message on msn. But when I downloaded this script, I didn't know where to write any thing.


quote:
var
  LastUserMessage = '';
  AutoMessage = '';
  AutoSendTimerId = '2';
  AutoDelayTimerId = 'AutoSendDelay';
  LastChatWnd = null;
  NullChar = String.fromCharCode(0);
  WM_KEYDOWN = 0x0100;
  WM_KEYUP   = 0x0101;
  WM_CHAR    = 0x0102;
  SW_SHOWNORMAL = 1;
  FakeKey = 'T';

  AutoAnswerDLL = MsgPlus.ScriptFilesPath + '\\AutoAnswer.DLL';
  AutoAnswerConfigFile = MsgPlus.ScriptFilesPath + '\\AutoAnswer.INI'
  AutoAnswerConfigSection = 'Configuration';
  AutoAnswerCallGetResponse = 'GetResponse';
  // AutoAnswerCallFakeInput = 'FakeInput';
 
 
function IniReadInteger(Ident, Default)
{
  return Interop.Call('Kernel32', 'GetPrivateProfileIntW', AutoAnswerConfigSection , Ident, Default, AutoAnswerConfigFile);
}
 
function OpenContactChatWnd(Wnd)
{
  Contacts = new Enumerator(Wnd.Contacts);
  Contacts.moveFirst;
  Contact = Contacts.item();
  Messenger.OpenChat(Contact.Email);
}

// Used to fake an input to a chat window by posting keyboard events
function FakeInput(Wnd)
{
  // Initiate the chat window
  OpenContactChatWnd(Wnd);
  // Find the message edit window
  UIWnd = Interop.Call('User32', 'FindWindowExW', Wnd.Handle, 0, 'DirectUIHWND', null);
  if (UIWnd != 0)
  {
    Key = FakeKey.charCodeAt(0);
    VirtKey = Interop.Call('User32', 'MapVirtualKeyW', Key, 0);
    LParam = VirtKey << 16;
    // Fake a keystroke
    Interop.Call('User32', 'PostMessageW', UIWnd, WM_CHAR, Key, LParam || 0xC0000000);
  }
}

function StringOfChar(Char, Length)
{
  var S = '';
  while (S.length < Length)
  {
    S = S + Char;
  }
  return S
}

function OnEvent_Initialize(MessengerStart)
{
  TypingDelayPerChar = IniReadInteger('TypingDelayPerChar ', 125);
  ReadingDelayPerChar = IniReadInteger('ReadingDelayPerChar', 50);
  AutoResponseDelay = IniReadInteger('AutoResponseDelay', 300);
  MaxReplyLength = IniReadInteger('MaxReplyLength', 512);
}

function OnEvent_Uninitialize(MessengerExit)
{

}

function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind)
{
  LastChatWnd = null;
  if (MessageKind == 1)
  {
    if (Message != LastUserMessage)
    {
      // Save the chat window object
      LastChatWnd = ChatWnd;
      AutoMessage = StringOfChar(' ', MaxReplyLength);
      // Call the autoanswer dll
      Interop.Call(AutoAnswerDLL, AutoAnswerCallGetResponse, Origin, Message, AutoMessage);
      // Trim the returned message
      AutoMessage = AutoMessage.substring(0, AutoMessage.indexOf(NullChar));
      if (AutoMessage.length > 0)
      {
        // Start a timer to fake reading time
        MsgPlus.AddTimer(AutoDelayTimerId, (Message.length * ReadingDelayPerChar) + AutoResponseDelay);
      }
    }
    LastUserMessage = '';
  }
}

function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
  // Save the last message sent by this user
  LastUserMessage = Message;
}

function OnEvent_Timer(TimerId)
{
  // Cancel the timer since it has fired
  MsgPlus.CancelTimer(TimerId);
  if (TimerId == AutoSendTimerId)
  {
    if (LastChatWnd != null)
    {
      // Cancel the editing that FakeInput created
      LastChatWnd.EditText = '';
      // Send the automated response
      LastChatWnd.SendMessage(AutoMessage);
      LastChatWnd = null;
    }
  }
  if (TimerId == AutoDelayTimerId)
  {
    // FakeInput is used to make the other user think this one is typing
    FakeInput(LastChatWnd);
    MsgPlus.AddTimer(AutoSendTimerId , AutoMessage.length * TypingDelayPerChar);
  }
}

12-29-2008 06:04 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Auto Answer 1.00
And what are you trying to do exactly?
12-29-2008 06:57 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