Automated Downloads

Project:Write a script to login to a host computer at a certain time of the day and download a specified file. In this example, we will wait for 2:00 AM, connect and login to a Unix system, and download a file using the Zmodem protocol.

Algorithm:Several items need to be either configured in a stored session file, or set dynamically via script. These include the connector and relevant connection information, userid and password to login to the system, the file transfer protocol used and any related parameters, the name of file to be transferred, and if appropriate, the name of the file to be stored locally. With this information available, the necessary steps are: Relevant Commands and Functions:

CONNECT — Open a session file with saved values for connector, host address, file transfer protocol, and related parameters.

See Also:
CONNECT — initiate the connection and optionally open a specified SES file
CONNECT( ) — indicates whether the session is connected
SET BINARYTRANSFERS — set the file transfer protocol
XFERCONFIG — set parameters for specified file transfer protocol
SET CONNECTION — set the connector
CONNCONFIG — set parameters for the specified connector

SET — assigns a value to a user defined variable. (Can also use the assignment operator, =)
WAIT UNTIL — Pauses execution until the specified time of day
TIME() — returns a string with the system time
TIMER RESET — resets the specified timer to zero
DATE() — returns a string with the date
SECONDS() — returns an integer with the number of seconds from a fixed date to the specified date and time
WHEN TIMER — activates when the specified time elapses

SEND — sends string to the host; may be used to send a command defined on the host to initiate the transfer on the host
FILE RECEIVE BINARY — initiates a file download in DynaComm
FILE SEND BINARY — initiates a file upload from DynaComm (not used in this example)
KERMIT commands — Remote Kermit commands used with Kermit Server
EXISTS( ) — Indicates if a file exists on local PC
FILE RENAME — Renames a local file
SEND — send commands to the host to log off.

SHOW — Display each script command as it is executed.
DISCONNECT — disconnects the session
WINDOW CLOSE — close the specified child window