What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Help] FTP upload

[Help] FTP upload
Author: Message:
rob_botch
Full Member
***

Avatar

Posts: 180
Reputation: 4
33 / Male / Flag
Joined: Apr 2006
O.P. [Help] FTP upload
I have written a script that uploads a file to an ftp server. This works perfectly when the server information (address, directory, username, password, port) are hardcoded. However, when I added the settings window to allow users to alter the information, the upload stopped working. Hardcoding then again works. Using Debug.Trace() to check the variables just before uploading reveals that they are, in fact, correct.

Is there anything that I have overlooked?

Thank you,
Robert
07-09-2006 08:50 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: [Help] FTP upload
Here is code I use for Screenshot Sender 4

code:
    function OnWndFTPUploadEvent_CtrlClicked(Wnd, sControlId){
        if(sControlId == 'BtnTest'){
            var tmpWnd = MsgPlus.CreateChildWnd(Wnd, "ss4_gui.xml", "WndFTPUploadTest", 67, 174, true);
            Wnd.SendControlMessage('BtnTest', WM_ENABLE, 0,0);
            var hConnection;
            var hOpen;
            var pFlag;
           
            if (PassiveConnection == true){    pFlag = 134217728; }
            else{ pFlag = 0; }
           
            hOpen = Interop.Call('wininet.dll', 'InternetOpenW', 'SS4 FTP Upload', 0, '', '', 0)
            hConnection = Interop.Call('wininet.dll', 'InternetConnectW', hOpen,
                                                                          Wnd.GetControlText('txtServer'),
                                                                          eval(Wnd.GetControlText('txtPort')),
                                                                          Wnd.GetControlText('txtLogin'),
                                                                          Wnd.GetControlText('txtPassword'),
                                                                          1,
                                                                          pFlag,
                                                                          0);
           
            var pParent = Interop.Call('user32', 'GetAncestor', tmpWnd.Handle, 2)
           
            Interop.Call('user32', 'ShowWindow', pParent, 0);
           
            if (hConnection > 0){
                Interop.Call('user32', 'MessageBoxW', 0, 'Connection to server successful', 'Successful', 64);
            }
            else{
                Interop.Call('user32', 'MessageBoxW', 0, 'Connection to server unsuccessful', 'Unsuccessful', 64);
            }
            Interop.Call('user32', 'ShowWindow', pParent, 1);
            Interop.Call('wininet.dll', 'InternetCloseHandle', hConnection);
            Interop.Call('wininet.dll', 'InternetCloseHandle', hOpen);
           
            tmpWnd.Close(1);
            Wnd.SendControlMessage('BtnTest', WM_ENABLE, 1,0);
        }
    }

This post was edited on 07-09-2006 at 04:34 PM by matty.
07-09-2006 04:32 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