FTP
The WinINet functions recognize only CERN type proxies (HTTP only) and the TIS FTP gateway (FTP only). If Microsoft Internet Explorer is installed, these functions also support SOCKS proxies. The proxy configuration is the part MS Interntet Explorer (see the Control panel).

You can use next functions:

Thread within session are executed consecutively.
TCPIP.Name(arg1, arg2, ...) Description Synchronize
TCPIP.FTPConnect(host, user, passwd, port, sessionId) The FTPConnect function creates a thread (sessionId) for your FTP clients.
Return Values: If the function succeeds (thread had been created), the return value is true, otherwise false.

When thread to terminate, it will cause your function WM_FTP(sessionId, type, error, result) from script (your callback function). Argument type will the "WM_FTPCONNECT" string.

no wait - create thread
TCPIP.FTPDisconnect(sessionId) Closes a single FTP session.
Return Values:
Returns TRUE if the session is successfully closed, or FALSE otherwise (sessionId is wrong).
wait
TCPIP.FtpGetCurrentDirectory(sessionId) The FtpGetCurrentDirectory function creates a thread (sessionId). Thread retrieves the current directory for the specified FTP session.
Return Values: If the function succeeds (thread had been created), the return value is true, otherwise false.

When thread to terminate, it will cause your function WM_FTP(sessionId, type, error, result) from script (your callback function). Argument type will the "WM_FTPGETCURRENTDIRECTORY" string.

no wait - create thread
TCPIP.FtpSetCurrentDirectory(sessionId, directory) The FtpSetCurrentDirectory function creates a thread (sessionId). Thread changes to a different working directory on the FTP server.
Return Values: If the function succeeds (thread had been created), the return value is true, otherwise false.

When thread to terminate, it will cause your function WM_FTP(sessionId, type, error, result) from script (your callback function). Argument type will the "WM_FTPSETCURRENTDIRECTORY" string.

Warning: The error code always will 0 (code does not depend on successful execution). Please, check result - the current directory after calling the functions FtpSetCurrentDirectory.
no wait - create thread
TCPIP.FTPls(sessionId) The FTPls function creates a thread (sessionId). Thread retrieves the list of the file and directory entries from current directory.
Return Values: If the function succeeds (thread had been created), the return value is true, otherwise false.

When thread to terminate, it will cause your function WM_FTP(sessionId, type, error, result) from script (your callback function). Argument type will the "WM_FTPLS" string. Argument result will the "file1|file2|...|fileN" string;

no wait - create thread
TCPIP.FTPmkdir(sessionId, dir) The FTPmkdir function creates a thread (sessionId). Thread creates a new directory on the FTP server.
Return Values: If the function succeeds (thread had been created), the return value is true, otherwise false.

When thread to terminate, it will cause your function WM_FTP(sessionId, type, error, result) from script (your callback function). Argument type will the "WM_FTPMKDIR" string.

no wait - create thread
TCPIP.FTPrmd(sessionId, dir) The FTPrmdir function creates a thread (sessionId). Thread removes the specified directory on the FTP server.
Return Values: If the function succeeds (thread had been created), the return value is true, otherwise false.

When thread to terminate, it will cause your function WM_FTP(sessionId, type, error, result) from script (your callback function). Argument type will the "WM_FTPRMD" string.

no wait - create thread
TCPIP.FTPputfile(sessionId, file) The FTPputfile function creates a thread (sessionId). Thread stores a file on the FTP server.
Return Values: If the function succeeds (thread had been created), the return value is true, otherwise false.

When thread to terminate, it will cause your function WM_FTP(sessionId, type, error, result) from script (your callback function). Argument type will the "WM_FTPPUTFILE" string.

no wait - create thread
TCPIP.FTPgetfile(sessionId, remotefile, newfile) The FTPgetfile function creates a thread (sessionId). Thread retrieves a file from the FTP server and stores it under the specified file name, creating a new local file in the process.
Return Values: If the function succeeds (thread had been created), the return value is true, otherwise false.

When thread to terminate, it will cause your function WM_FTP(sessionId, type, error, result) from script (your callback function). Argument type will the "WM_FTPGETFILE" string.

no wait - create thread
TCPIP.FTPrm(sessionId, file) The FTPrm function creates a thread (sessionId). Thread deletes a file stored on the FTP server.
Return Values: If the function succeeds (thread had been created), the return value is true, otherwise false.

When thread to terminate, it will cause your function WM_FTP(sessionId, type, error, result) from script (your callback function). Argument type will the "WM_FTPRM" string.

no wait - create thread
TCPIP.FTPmv(sessionId, existing_file, new_file) The FTPmv function creates a thread (sessionId). Thread deletes a file stored on the FTP server.
Return Values: If the function succeeds (thread had been created), the return value is true, otherwise false.

When thread to terminate, it will cause your function WM_FTP(sessionId, type, error, result) from script (your callback function). Argument type will the "WM_FTPMV" string.

no wait - create thread
Here's an example (you can see FTP in the netstat - command line tool):
// JScript: ftp.w_js
var host = "ftp.host.com"
var user = "user"
var password = "password"


Window.AppendMenu(0,"MF_STRING",100,"Open FTP");
Window.AppendMenu(0,"MF_STRING",200,"Close FTP");
Window.AppendMenu(0,"MF_STRING",300,"Get Current Directory");
Window.DrawMenuBar();


function WM_FTP(sessionId, type, error, result)
{Window.Delete(1);
 Window.TextOut(1,50,30,"type: " + type);
 Window.TextOut(1,50,50,"sessionId: " + sessionId);
 Window.TextOut(1,50,70,"error: " + error);
 Window.TextOut(1,50,90,"result: " + result);
 Window.UpdateWindow();
};


function WM_COMMAND(id)
{ switch(id){ 
    case 100: TCPIP.FTPConnect(host, user, password, 21, 800);
              break;
    case 200: TCPIP.FTPDisconnect(800);
              Window.Delete(1);
              Window.UpdateWindow();
              break;
    case 300: TCPIP.FTPGetCurrentDirectory(800);
  };
};
'VBScript: ftp.w_vbs
host = "ftp.host.com"
user = "user"
password = "password"

Window.AppendMenu 0,"MF_STRING",100,"Open FTP"
Window.AppendMenu 0,"MF_STRING",200,"Close FTP"
Window.AppendMenu 0,"MF_STRING",300,"Get Current Directory"
Window.DrawMenuBar

Function WM_FTP(sessionId,tp,err,result)
 Window.Delete 1
 Window.TextOut 1,50,30,"type: " & tp
 Window.TextOut 1,50,50,"sessionId: " & sessionId
 Window.TextOut 1,50,70,"error: " & err
 Window.TextOut 1,50,90,"result: " & result
 Window.UpdateWindow
End Function

Function WM_COMMAND(id)
 Select Case id
    Case 100
     TCPIP.FTPConnect host, user, password, 21, 800
    Case 200
     TCPIP.FTPDisconnect(800)
     Window.Delete(1)
     Window.UpdateWindow
    Case 300 
     TCPIP.FTPGetCurrentDirectory(800)
  End Select
End Function
content
The advanced scripting host. It is not wscript.exe!
Microsoft, JScript, VBScript, "Internet Explorer" are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.