#FTPTimeout

System variable - FTP function.

The #FTPTimeout system variable specifies the number of seconds which WinTask should wait before reporting a runtime error when it tries to execute a FTP function.

Usage

Mainly used to increase the delay before an execution error is reported. For example, if a big file is downloaded from the FTP server to the local machine, the default timeout of 30 secs will stop the transfer. So before invoking the FTPGetFile function, add a line #FTPTimeout=120 if the file downloads in less than 120 seconds.

Syntax

#FTPTimeout = n

Remarks

When the n seconds have elapsed, if a FTP function execution is not finished, error management is launched. The default behavior (#IgnoreErrors=0) is that an error message is displayed and the script execution stops.

The default value for #FTPTimeout is 30 seconds.

If this variable is set to 0, WinTask waits forever.

See also

#IgnoreErrors

Example

 

#FTPTimeout = 5

Example code

This script downloads wintaskdemo.exe from www.wintask.com FTP server (the password is not correct on purpose!).

 

#IgnoreErrors=1

' Error management is now active in the script

 

#FTPTimeout=120

' Maximum wait is 10 seconds

 

FtpConnect(("www.wintask.com","ftp","PMJN1563hSWHXFj/CD")

' Connect to the FTP server

 

ret=FTPGetFile("c:\test","/wintaskdemo.exe")

' Download wintaskdemo.exe from the FTP server and save it under c:\test

 

' The return code is tested

if ret=0 then

msgbox("Download done")

else

msgbox("Increase the timeout")

endif

 

#IgnoreErrors=0

' Error management is turned off

 

FtpDisconnect() ' Terminates the FTP connection