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

Send file
Author: Message:
SnuZZer
Full Member
***

Avatar

Posts: 114
32 / Male / Flag
Joined: Jun 2006
O.P. Send file
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.

This post was edited on 07-24-2008 at 10:49 AM by SnuZZer.
07-24-2008 10:48 AM
Profile E-Mail PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Send file
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?
07-24-2008 01:19 PM
Profile E-Mail PM Find Quote Report
SnuZZer
Full Member
***

Avatar

Posts: 114
32 / Male / Flag
Joined: Jun 2006
O.P. RE: RE: Send file
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
07-24-2008 01:24 PM
Profile E-Mail PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Send file
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));
    }
}
07-24-2008 01:30 PM
Profile E-Mail PM Find Quote Report
SnuZZer
Full Member
***

Avatar

Posts: 114
32 / Male / Flag
Joined: Jun 2006
O.P. RE: RE: Send file
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.
07-24-2008 01:49 PM
Profile E-Mail PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Send file
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 '';
    }
}

This post was edited on 07-24-2008 at 01:54 PM by matty.
07-24-2008 01:54 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Send file
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.
07-24-2008 01:55 PM
Profile E-Mail PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: Send file
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
<Eljay> "Problems encountered: shit blew up" :zippy:
07-24-2008 02:08 PM
Profile PM Find Quote Report
SnuZZer
Full Member
***

Avatar

Posts: 114
32 / Male / Flag
Joined: Jun 2006
O.P. RE: Send file
It works perfectly now! Many thanks, guys :-)
07-24-2008 03:19 PM
Profile E-Mail PM Web 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