ask \%u { username: }
askq \%p { \%u's password: }

; Settings for entire session.
;
define \%s 20		  ; Seconds to pause between each try
define \%n 7654321	  ; Phone number
set port com1		  ; Communication port
set modem pp14400	  ; Modem type (dial with PP14400.SCR)

set file type binary	  ; File transfer mode must be binary
set input timeout quit	  ; This is just to keep the script program short...
set count 50		  ; Try up to 50 times to send the file
goto nomsg		  ; Skip message the first time

:LOOP			  ; Come here to redial
hangup			  ; Give the phone line a rest
echo CONNECTION BROKEN.
echo Pausing for \%s seconds...
sleep \%s
Echo redialing...

:NOMSG
dial \%n		  ; Dial the phone number
if fail goto AGAIN	  ; Keep trying...
output \13		  ; System answered, send a carriage return
input 15 login:		  ; Get UNIX login prompt
output \%u\13		  ; Send user ID
input 8 Password:	  ; Get UNIX password prompt
output \%p\13		  ; Send password
input 60 {$ }		  ; Get UNIX system prompt
cd \budget		  ; CD to desired local source directory
output cd budget\13	  ; and remote destination directory
input 8 {$ }		  ; Get system prompt
out kermit -r\13	  ; kermit -r(eceive) on remote system
input 10 KERMIT READY	  ; Wait for READY message
pause 1			  ; Plus a second for safety
resend fy9495.wks	  ; RESEND the file
if success goto done	  ; Success means file is completely transferred

:AGAIN
if count goto LOOP	  ; Otherwise, try again.
Stop 1 Too many tries.	  ; Too many tries, give up.

:DONE
echo File transferred OK  ; Success, give message
output exit\13		  ; Log out from remote computer
pause 5			  ; Give it time...
hangup			  ; Hang up
stop 0 Script succeeded	  ; Finished, the end.