Shoutbox

Send file - 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: Send file (/showthread.php?tid=84997)

Send file by SnuZZer on 07-24-2008 at 10:48 AM

Hey.

I'm working on a script, which should make it possible to send a file by a comment, but it doesn't send the file.

I'm quite sure, that this topic has been before, but I can't seem to find it.

Can anybody tell me, what I'm doing wrong?

quote:
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
    if(Message.substr(0, 6) == "!hitme")
    {
        if (Message.substr(Message.length-1, 1) != "\\")
        {
            Message += "\\";
        }
       
        ChatWnd.SendFile(Message.substr(7, Message.length-7).replace(/\\/gi,'\\\\'));
   
        ChatWnd.SendMessage("-> " + Message.substr(7, Message.length-7).replace(/\\/gi, "\\\\"));
    }
}

Thanks in advance.
RE: Send file by matty on 07-24-2008 at 01:19 PM

Why are you appending \ to the end of the message then when sending the file replacing all \ with \\ that makes no sense whatsoever.

What exactly is the the message you are inputting and what should the file be sending?


RE: RE: Send file by SnuZZer on 07-24-2008 at 01:24 PM

quote:
Originally posted by matty
Why are you appending \ to the end of the message then when sending the file replacing all \ with \\ that makes no sense whatsoever.

What exactly is the the message you are inputting and what should the file be sending?

I'm adding a \ to the end and replacing \ with \\ because, that's what I was told to do in an earlier script, I've made.

I'm sending the following:
quote:
!hitme C:\Documents and Settings\Basse\Dokumenter\Billeder\Elisabeths konfirmation, 4. maj 2008\Små\04052008071_600x800.jpg

And I'ld like it to send the picture, that I'm refering to after the command "!hitme".

The image will then be 04052008071_600x800.jpg
RE: Send file by matty on 07-24-2008 at 01:30 PM

code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message) {
    if(Message.substr(0, 6) == "!hitme") {
        if (Message.substr(Message.length-1, 1) != "\\") {
            Message += "\\";
        }
        ChatWnd.SendFile(Message.substr(7));
        ChatWnd.SendMessage("-> " + Message.substr(7));
    }
}

RE: RE: Send file by SnuZZer on 07-24-2008 at 01:49 PM

quote:
Originally posted by matty
code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message) {
    if(Message.substr(0, 6) == "!hitme") {
        if (Message.substr(Message.length-1, 1) != "\\") {
            Message += "\\";
        }
        ChatWnd.SendFile(Message.substr(7));
        ChatWnd.SendMessage("-> " + Message.substr(7));
    }
}


Still nothing. No errors in the debugtrace. Just sends the two messages - the command and the path. Dosn't send the image.
RE: Send file by matty on 07-24-2008 at 01:54 PM

Oops I can't believe I did that

code:
function OnEvent_ChatWndSendMessage( ChatWnd, Message ) {
    if( Message.substr( 0, 6 ) == "!hitme" ) {
        ChatWnd.SendFile( Message.substr( 7 ) );
        Debug.Trace( "-> " + Message.substr( 7 ) );
        return '';
    }
}

RE: Send file by matty on 07-24-2008 at 01:55 PM

quote:
Originally posted by SpunkyLoveMuff
you need to add

code:
return "";


To stop it sending the message to the contact. Have you also checked that the path is correct (IIRC you need to prefix it with another \)


You don't need to prefix anything if you are sending a file it is the same as using /sendfile.

You only need to prefix the path with \\ if you are adding it to an Image Element from somewhere other than the scripts folder.
RE: Send file by Spunky on 07-24-2008 at 02:08 PM

quote:
Originally posted by matty
quote:
Originally posted by SpunkyLoveMuff
you need to add

code:
return "";


To stop it sending the message to the contact. Have you also checked that the path is correct (IIRC you need to prefix it with another \)


You don't need to prefix anything if you are sending a file it is the same as using /sendfile.

You only need to prefix the path with \\ if you are adding it to an Image Element from somewhere other than the scripts folder.

Thats fine. I deleted the post when I saw yours as your answer was obviously more accurate anyway :p
RE: Send file by SnuZZer on 07-24-2008 at 03:19 PM

It works perfectly now! Many thanks, guys :-)