home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 3 Comm
/
03-Comm.zip
/
NSCKWQ.ZIP
/
IbmNsc.cmd
Wrap
OS/2 REXX Batch file
|
1992-12-06
|
8KB
|
246 lines
/*------------------------------------------------------------------*/
/* Log onto IBM NSC BBS, send pending QWK messages and download new.*/
/* The script assumes your settings on the board include: */
/* expert toggled on. */
/* */
/* Use of Zmodem has been replaced with YModemG here because of */
/* problems the NSC QWK support seems to have with Zmodem. */
/* */
/* Timeouts are set assuming a reasonable number of new messages. */
/* If your last message in each forum isn't reasonably current, */
/* you'll time out. */
/* */
/* This script assumes you have set the PmComm32 memo field to a */
/* string that consists of "First name", "Last Name", and "Password"*/
/* separated by white space. Example: */
/* */
/* Ron Hester mysecretpassword */
/* */
/* Be sure to set "Conferences" and "Reply_File", below, to relect */
/* your system and interests. */
/*------------------------------------------------------------------*/
/* User info */
Conferences = '6 30 36 1 18 3 4 5' /* List of conferences to capture */
Reply_File="D:\PmComm\HostUp\NscBBS.rep" /* Packet to upload */
/* Switches */
dcds = 1 /* If modem supports dcd */
Use_Alarm = 1 /* Use completion sounds */
Signal ON SYNTAX NAME SYNTAX_ERROR
Parse arg port portname screen_handle dde_output dde_input semaphore
Parse source . . fn .
/* Constants */
cr = '0d'x
crlf = '0a0d'x
ctrl_K = '0b'x
Call RxFuncAdd "Init_32dll","RxPmC32","Init_32dll"
Call Init_32dll
Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
Call SysLoadFuncs
Call Clear
Call Alarm
Call Put_s 'Executing' fn '...'crlf,screen_handle
Call get_dial_memo dde_output,dde_input
parse var Result First_Name Last_Name Password
Call Read_timeout '60000',port
If dcds then Call Connected
Call Wait_fore 'First Name->',port,screen_handle
If result=0 then
Do
Call Alarm
Call Put_s crlf"Wait for 'First Name->' prompt has timed out -- disconnecting"crlf,screen_handle
If dcds then Call Connected
Exit
End
Call Flush
Call Put_s First_Name";"Last_Name";"Password||cr,port
Do Forever
If dcds then Call Connected
Call Wait_fore " to continue?",, /* 1 */
"ontinue?",, /* 2 */
"ulletins updated",, /* 3 */
" to abort scan.",, /* 4 */
"execute ?",, /* 5 */
port,screen_handle
Match=Result
If Match\=4 then Call Flush
Select
When Match=1 then Call Put_s cr,port
When Match=2 then Call Put_s "n",port
When Match=3 then
Do
Call Put_s "n"cr,port
Leave
End
When Match=4 then Call Put_s ctrl_K,port
When Match=5 then Leave
Otherwise
Call Timeout
End
End
If dcds then Call Connected
if stream(Reply_File,'c','query exists')\='' then
do
If dcds then Call Connected
Call put_s 'rep'cr,port
Call Read_timeout '120000',port
Call Wait_fore "abort:",port,screen_handle
Call Flush
Call Put_s "g"cr,port
Call Read_timeout '60000',port
Call Wait_fore " format...",port,screen_handle
Call Flush
Call YmodemG_send Reply_File,dde_output,dde_input
Call put_s crlf'RC from Delete='SysFileDelete(Reply_File)||crlf,screen_handle
If dcds then Call Connected
Call Wait_fore "execute ?",,
port,screen_handle
Call Flush
end
/*---------------------------------------------------------------*/
/* This convoluted block of code tries to cope with the tendency */
/* to skip right over the reply and treat it as a "R"ead request */
/*---------------------------------------------------------------*/
Call put_s 'qwk'cr,port
Call Read_timeout '90000',port
Call wait_fore 'quit?',, /* 1 */
'e(s)?',, /* 2 */
port,screen_handle
Match=Result
Call Flush
Select
When Match=1 then
nop
When Match=2 then /* try to resynch */
Do
Call put_s 'q'cr,port
Call Wait_fore "execute ?",,
port,screen_handle
Call Flush
Call put_s 'qwk'cr,port
Call wait_fore 'quit?',, /* 1 */
port,screen_handle
Call Flush
End
Otherwise
Call Timeout
End
If dcds then Call Connected
Call put_s 'nnn'cr,port /* The extra n's help avoid a problem */
Call wait_fore 'quit?',port,screen_handle
Call Flush
Call put_s Conferences||cr,port
Call Read_timeout '90000',port
Do Forever
If dcds then Call Connected
Call Wait_fore "canning message",, /* 1 */
"Creating QWK",, /* 2 */
port,screen_handle
Match=Result
If Match=1 then Iterate /* More time for new Scan */
Call Flush
If Match=2 then Leave /* Ready to download */
Call Timeout
End
Call Read_timeout '180000',port
Call Wait_fore "abort:",port,screen_handle
Call Flush
Call Put_s "g"cr,port
Call Read_timeout '45000',port
Call Wait_fore ").",port,screen_handle
Call Flush
Call Put_s crlf'Starting YmodemG Receive'crlf,screen_handle
Call YmodemG_receive dde_output,dde_input
Call Wait_fore "execute ?",port,screen_handle
Call Flush
Call Put_s "g"cr,port
Call Alarm
Exit
Timeout:
If dcds then Call Connected /* Timeout */
Call Alarm
Call Put_s crlf"Unexpected timeout, script is exiting"crlf,,
screen_handle
Call Alarm
Exit
/* Clear Screen Routine */
Clear: procedure expose screen_handle
Call put_s "1b5b324a"x,screen_handle
Return
/* A Procedure to see if the modem supports DCD and if see if we */
/* have a connection, if not then DROP the DTR and then RAISE the */
/* DTR again ... */
Connected: procedure expose port crlf screen_handle
Call DCD port
If result \= 1 then
Do
Call Beep 40,900
Call Put_s 'No Data Carrier Detect ...'||crlf,screen_handle
Call Drop_DTR port
Call Raise_DTR port
Say 'Script ended -' date() time()
Exit
End
Return
/* read through the rest of the buffer and display any characters */
/* that remain after the wait_fore string */
Flush: procedure expose port screen_handle
Do while char_avail(port)>0
Call Put_s Get_ch(port),screen_handle
End
return
/* speedy NBC noise, courtesy of Dr. Scott Mack */
Alarm:
if Use_Alarm then
do
call beep 196,350
call beep 330,500
call beep 262,650
end
return
/* Standard handler for SIGNAL on ERROR, will help in the debuging */
syntax_error:
fp = filespec("path",fn)
fd = filespec("drive",fn)
errormsg='REXX error' rc 'in line' sigl':' errortext(rc)
errorfile = fd||fp||"SCRIPT.ERR"
rc = lineout(errorfile,date() time() fn '-' errormsg)
rc = lineout(errorfile,date() time() fn '-' sourceline(sigl))
Exit