Metropoli BBS
VIEWER: login2.rx MODE: TEXT (ASCII)
/* A REXX sample to show how to log into a bbs and do 
   work automatically */

'TIMEOUT 60'   /* general time out */

/***** Wait for name prompt or bail out *****/
'WAIT "Name?"'

IF RC=0 THEN 
DO /* received 'Name?' */
   'SEND "Zaphod^M"'
END
ELSE
DO /* Ouch, 'Name?' was not received */
   'WRITELN "ERROR (Name)!!"'
   SIGNAL BailOut   /* this command jumps to the end */
END


/***** Wait for password prompt or bail out *****/
'WAIT "Password?"'

IF RC=0 THEN 
DO /* received 'Password?' */
   'SEND "HeartOfGold^M"'
END
ELSE
DO /* Ouch, 'Password?' was not received */
   'WRITELN "ERROR (Password)!!"'
   'HANGUP'
   SIGNAL BailOut
END


/***** Skip host's intro screens             *****/
/***** (and probably security feature)       *****/

'REPLY "Press ENTER to continue" "^M"' 
'REPLY "Enter your birthdate" "030466^M"' 

'WAIT "Main Menu"'    /* we just assume that it will work */

'REPLY "Press ENTER to continue"'  /* cancel REPLY command */
'REPLY "Enter your birthdate"'


/***** Wait for the prompt and go to the      *****/
/***** mail area and download a mail packet   *****/
/***** using the Zmodem protocol              *****/

'WAIT "your choice>"'
'SEND "MAIL^M"'

'WAIT "your choice>"'
'SEND "RECEIVE^M"'

'WAIT "protocol>"'
'SEND "Zmodem^M"'

/* download into C:\MAIL directory */
'DOWNLOAD Z "C:\MAIL"'


/***** Go back to the main menu and log off   *****/

'SEND "QUIT^M"'

'WAIT "your choice>"'
'SEND "LOGOUT^M"'


BailOut:  /* this is the target for the SIGNAL command */ 
'HANGUP'
[ RETURN TO DIRECTORY ]