Good morning all:
I am attempting to trap a logon error in an FTP session.
KIX ver 4.22
WIN 2k Pro
Kixtarter 1.85

Code:
  

BREAK ON CLS

SHELL "%COMSPEC% /C FTP -i -s:C:\FTP\TESTOUT.txt > C:\errorlogs\TESTOUT.LOG"

? "@@ERROR: "+@ERROR
? "@@SERROR: "+@SERROR

IF @ERROR <> 0
? "@@ERROR : "+@ERROR+"@@SERROR : "+@SERROR
ENDIF


The FTP command file is
Code:
 

open FTPServer.Domain.com
CorrectUserCode
IncorrectPassword
CD TEST
lcd \
lcd FTP\test
MPUT *.txt
bye




OUTPUT

Login failed.

@ERROR: 0
@SERROR: The operation completed successfully.

OUTPUT
I have put an incorrect password in the FTP command file, but @ERROR returns "Operation completed successfully".
Yet "Login Failed." is printed to the screen. I would like to be able to trap the "Login Failed".
Thank you in advance for any help.


Thank you Richard and Howard for your suggestions, but I decided to try something different.

Code:
 

BREAK ON CLS

DIM $filename,$line,$login

;Create a list of files to be FTPed
SHELL "%COMSPEC% /C DIR C:\test /b /l > filelist.txt"

;FTP files and pipe output to text file
SHELL "%COMSPEC% /C FTP -i -s:C:\ftpcmds.txt > C:\ftpoutput.txt"

OPEN(1,"C:\test\filelist",2)

$filename = READLINE(1)

;Set login to failed
$login = 1

WHILE @ERROR = 0

OPEN(2,"C:\ftpoutput.txt",2)

$line = READLINE(2)

WHILE @ERROR = 0

IF INSTR($line,$filename)

;Must have at least logged in
$login = 0

;Read the next line
$line = READLINE(2)

;Then the file was FTPed
IF INSTR($line,"Transfer complete")

? "FTP Verfied for "+$filename

ELSE

? "FTP failed for "+$filename

ENDIF

ENDIF

$line = READLINE(2)
LOOP

$ = CLOSE(2)

$filename = READLINE(1)

LOOP

IF $login = 0
? "Login succeeded"
ELSE
? "Login failed "
ENDIF

$ = CLOSE(1)



I have tested for all cases of errors I could think of. I would appreciate any commmments , suggestions, or downright laughter at my amateur attempt.


Edited by Stanley (2004-11-01 10:14 PM)
_________________________
Taxation WITH representation isn't so hot, either!