home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: OtherApp
/
OtherApp.zip
/
rhinodem.zip
/
rcdemo.dat
/
compuser.rrx
< prev
next >
Wrap
Text File
|
1995-09-29
|
3KB
|
159 lines
/*
* sample RhinoCom script that connects to CompuServe
*/
/*
* Load all the system functions
* ( we will use SysSleep )
*/
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs
/*
* create convenient symbols for carriage return,
* newline and control-C
*/
CR = '0d'x
NL = '0a'x
ctrlc = '03'x
/*
* Check the phone number field of the RhinoCom Notebook.
* If the number has not been filled in, ask the user for one,
* and place it in the field.
*/
RQUERY 'phone-number'
phone = rc
if phone = '' then do
ENTRYFIELD '"Enter Phone Number" "Dialing CompuServe"'
phone = rc
if phone = '' then signal error1
rset 'phone-number' phone
end
/*
* Do the same thing for the Username field. This is a
* little different because Username is a named macro.
* Notice that we add a CR to the users response.
*/
RQUERY '@username'
username = rc
if username = '' then do
ENTRYFIELD '"Enter Compuserve User ID" "Dialing CompuServe"'
username = rc
if username = '' then signal error1
NMDefine "named M'username'"username
end
/*
* And again for the password. Notice that the entryfield for
* this one echoes *'s instead of the characters typed.
*/
RQUERY 'password'
password = rc
if password = '' then do
ENTRYFIELD 'UNREADABLE "Enter Password" "Dialing CompuServe"'
password = rc
if password = '' then signal error1
rset 'password' password
end
/*
* set up a response string that will execute the named macro "username"
* when it sees the "User ID:" prompt from CompuServe
*/
RESPONSE 1 MATCH '/User ID:/ /EXEC username/'
/*
* set up a response string that will send the password
* when it sees the prompt from CompuServe
*/
RESPONSE 2 MATCH '/Password:/ /EXEC password/'
/*
* In the rare case that we get the "Host Name" prompt,
* we want to reply "CIS"
*/
RESPONSE 3 MATCH '/Host Name:/ /WRITE CIS'CR'/'
/*
* Now that the response strings are ready and waiting, we will
* start a dial. Because the Dial is started in another thread,
* we cannot be sure how far along it is when the script resumes.
*/
DIAL
call SysSleep 1
rsay CR||NL||'Now Dialing Compuserve . . .'||CR||NL||CR||NL
/*
* CompuServe does not give an obvious signal when it is connected,
* so we will wait for the modem to signal "Connected", then send
* a Control-C to wake up CompuServe.
*/
RQUERY "@Connect"
connect_string = rc
TIMEOUT 45
WAITFOR connect_string
if rc \= 0 then signal error2
call SysSleep 1
/*
* SEND ctrl C, this will trigger the pre-defined response strings
*/
SEND ctrlc
TIMEOUT 30
WAITFOR ' choice '
if rc \= 0 then signal error2
RESPONSE 1 CANCEL
RESPONSE 2 CANCEL
RESPONSE 3 CANCEL
/*
* Go to the Rhintek forum. When we get there it will prompt "Press <CR> !"
* We want the script to supply the response to this prompt.
*/
RESPONSE 4 '/<CR>/ /'CR'/'
SEND 'GO Rhintek'||CR
WAITFOR ' choice '
RESPONSE 4 CANCEL
exit
/*
* signal error - user aborted from an Entryfield
*/
error1:
rsay 'Compuserve Dial aborted'
exit
/*
* signal error - failed to get an expected prompt
* we want to be sure to clean up the response strings
*/
error2:
rsay 'Compuserve Connection failed.'
RESPONSE 1 CANCEL
RESPONSE 2 CANCEL
RESPONSE 3 CANCEL
exit