What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » CTRL+C | CTRL+V

CTRL+C | CTRL+V
Author: Message:
DyLaK
New Member
*


Posts: 3
Joined: Mar 2007
O.P. CTRL+C | CTRL+V
Hello, i want to use a bot which will talk with my contacts when im away. The bot is an aplication separate from messenger, and it works like this:

when I copy a sentence to the clipboard (ctrl+c), im saying that sentence to the bot, and he gives me an answer to the clipboard too, so if I paste it (ctrl+v), the answer will be shown.

what i want to do is to copy to the clipboard every message i recieve from a contact, (that action automatically will ask the bot) and then i want to paste from clipboard which the bot has answer (the bot automatically paste its answers to the clipboard).

I would be pleased if anyone could help me. Sorry for my english.
03-28-2007 12:41 PM
Profile E-Mail PM Find Quote Report
Felu
Veteran Member
*****


Posts: 2223
Reputation: 72
30 / Male / Flag
Joined: Apr 2006
Status: Away
RE: CTRL+C | CTRL+V
Have a look at [UPDATED] Clipboard Functions (that WORK) ;).
03-28-2007 02:43 PM
Profile E-Mail PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: CTRL+C | CTRL+V
Though, I would not recommend using copy/pasting at all for something like this (a communication between apps).

Copy/pasting is used in Windows everywhere, using it to communicate between apps will be troublesome, not reliable and may even interfear with normal copy/paste operations in Windows.

You better of using proper communication methods by sending application defined messages, using OLE, or even the extreme old DDE method, etc, which would still be 1000 times better (and way shorter to program) than using copy/pasting.

This post was edited on 03-28-2007 at 02:49 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
03-28-2007 02:48 PM
Profile PM Find Quote Report
DyLaK
New Member
*


Posts: 3
Joined: Mar 2007
O.P. RE: RE: CTRL+C | CTRL+V
quote:
Originally posted by Felu
Have a look at [UPDATED] Clipboard Functions (that WORK) ;).



thanks! i will have a look later to check if it works.

CookieRevised, i suppose thats not the best way to do that, but what you say is very difficult to do for me, so if the the copy/pasting works fine while im awat from keyboard, its ok.


EDIT: i have tried the code, and it works, but not at all. I think its using a lot the clipboard so after a few messages i cant access to it. I think that maybe if I use a delay it will work fine. My code is something like this:

code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, User, Message, Kind) {
    if (botActive[ChatWnd.Handle] == true) {
        if (Kind == 1 && User != Messenger.MyName) {
            var m = Message.toLowerCase();
            writeClipboard(m);
            var mbot = readClipboard();
            mbot = mbot.toLowerCase();
            while((m == mbot) || (mbot = false)){
                mbot = readClipboard();
                mbot = mbot.toLowerCase();
            }
            ChatWnd.SendMessage(readClipboard());
            contador = contador + 1;
            if(contador == 5){
                clearClipboard();
                contador = 0;
            }
        }   
    }
}

how can i improve it?


This post was edited on 03-28-2007 at 07:44 PM by DyLaK.
03-28-2007 06:38 PM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: RE: RE: CTRL+C | CTRL+V
quote:
Originally posted by DyLaK
CookieRevised, i suppose thats not the best way to do that, but what you say is very difficult to do for me.
Using copy/pasting is a hell more difficult to properly program than using any other method.

quote:
Originally posted by DyLaK
code:
(...)
how can i improve it?
Quit frankly: don't and use the methods I suggested. Using copy/paste is never going to work properly.

This post was edited on 03-28-2007 at 11:50 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
03-28-2007 11:48 PM
Profile PM Find Quote Report
DyLaK
New Member
*


Posts: 3
Joined: Mar 2007
O.P. RE: CTRL+C | CTRL+V
finally i fixed it with a delay function. messenger freezes during that delay, but i only want it when im away, so it works perfect for me :)

here is the code:
code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, User, Message, Kind) {
    if (botActive[ChatWnd.Handle] == true) {
        if (Kind == 1 && User != Messenger.MyName) {
            var m = Message.toLowerCase();
            writeClipboard(m);
            pause(500);
            var mbot = readClipboard();
            mbot = mbot.toLowerCase();
            ChatWnd.SendMessage(mbot);
            clearClipboard();
        }
    }
}

function pause(milisegundos){
    var date = new Date();
    var curDate = null;
    do{
        curDate = new Date();
    } while (curDate - date < milisegundos);
}
03-29-2007 12:25 AM
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