ftp automation

ScriptFTP

The professional tool to automate FTP, SFTP, FTPS and schedule FTP batch jobs

The forum is now read only. Please, go to the the main ScriptFTP website if you need help.
Post here if you experience file transfer problems or unexpected errors.
I am trying to add an email option to my script to update me on connection failed. The email side of it works really well, except for one problem, it always thinks that connection has failed, even when it hasn't.

the relevant part of my script is:
FTP Script
  1. OPENHOST("127.0.0.1","Test","password")
  2. IF($result!="OK")
  3.       PRINT("Cannot connect to FTP. Sending an email and aborting in 5 seconds.")
  4.       PRINT($blat_cmd_line_1)
  5.       EXEC($blat_cmd_line_1)
  6.       SLEEP(5)
  7.       EXIT(1)

The log file output is:
SETPORT("21")
Setting TCP port to 21.

OPENHOST("127.0.0.1","Test",******)
Connecting to 127.0.0.1
Resolving host name "127.0.0.1"
Connecting to 127.0.0.1 Port: 21
Connected to 127.0.0.1.
220 FileZilla Server version 0.9.41 beta
USER Test
331 Password required for Test
PASS password
230 Logged on
SYST
215 UNIX emulated by FileZilla
FEAT
211-Features:
MDTM
REST STREAM
SIZE
MLST type*;size*;modify*;
MLSD
UTF8
CLNT
MFMT
211 End
OPTS UTF8 ON
200 UTF8 mode enabled
PWD
257 "/" is current directory.

Connected.
Cannot connect to FTP. Sending an email and aborting in 5 seconds.
I then proceed to get an email telling me that the connection failed, despite it quite clearly telling me it has connected!

I have tried a couple of different FTP servers, just to make sure. Any ideas what I am doing wrong?
FTP Script
  1. $result=OPENHOST("127.0.0.1","Test","password")
  2. IF($result!="OK")
  3.       PRINT("Cannot connect to FTP. Sending an email and aborting in 5 seconds.")
  4.       PRINT($blat_cmd_line_1)
  5.       EXEC($blat_cmd_line_1)
  6.       SLEEP(5)
  7.       EXIT(1)
so close yet so far. Just needed to add '$result=' in front of the OPENHOST.

cheers,
Thanks Wandrey