Animl
10-04-2006, 08:25 PM
I'm having some error problems on something that looks easy, but obviously I'm not catching it. I used the FTP Plugin example from the help page and trying to download a text file from the the NWS ftp server. I can get the file real easy using a browser. But for some reason using HTTP or FTP don't seem to work for me. I assume I should be using the FTP plugin to get a file from an ftp?
The code I am trying should be below,..
-- step 1: connect anonymously to cdrom.com
FTP.Connect("ftp.tgftp.nws.noaa.gov");
err = Application.GetLastError();
if err ~= FTP.OK then
Dialog.Message("Error", _tblErrorMessages[err]);
end
-- step 2: change to the directory where the text file is located
FTP.ChangeDir("/data/forecasts/zone/in");
err = Application.GetLastError();
if err ~= FTP.OK then
Dialog.Message("Error", _tblErrorMessages[err]);
end
-- step 3a: enable the status dialog's cancel button
StatusDlg.ShowCancelButton();
-- step 3b: show the status dialog
StatusDlg.Show();
-- step 3c: download the file as <temp>\Hamlet.txt
FTP.Download("inz001.txt", "\\AutoPlay\\Docs\\alerts\\inz001.txt");
err = Application.GetLastError();
-- step 3d: hide the status dialog
StatusDlg.Hide();
-- step 4: log off
FTP.Disconnect();
-- ...now check whether FTP.Download generated an error
if err == FTP.OK then
Dialog.Message("Success!", " was downloaded successfully!");
else
Dialog.Message("Error", _tblErrorMessages[err]);
end
The code I am trying should be below,..
-- step 1: connect anonymously to cdrom.com
FTP.Connect("ftp.tgftp.nws.noaa.gov");
err = Application.GetLastError();
if err ~= FTP.OK then
Dialog.Message("Error", _tblErrorMessages[err]);
end
-- step 2: change to the directory where the text file is located
FTP.ChangeDir("/data/forecasts/zone/in");
err = Application.GetLastError();
if err ~= FTP.OK then
Dialog.Message("Error", _tblErrorMessages[err]);
end
-- step 3a: enable the status dialog's cancel button
StatusDlg.ShowCancelButton();
-- step 3b: show the status dialog
StatusDlg.Show();
-- step 3c: download the file as <temp>\Hamlet.txt
FTP.Download("inz001.txt", "\\AutoPlay\\Docs\\alerts\\inz001.txt");
err = Application.GetLastError();
-- step 3d: hide the status dialog
StatusDlg.Hide();
-- step 4: log off
FTP.Disconnect();
-- ...now check whether FTP.Download generated an error
if err == FTP.OK then
Dialog.Message("Success!", " was downloaded successfully!");
else
Dialog.Message("Error", _tblErrorMessages[err]);
end