home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
515.lha
/
BackTalk_v1.40
/
rexx_examples
/
kill_script.bt
< prev
Wrap
Text File
|
1991-06-08
|
2KB
|
88 lines
/* This will kill all ONSTRINGS */
/*
If your script uses ONSTRINGn/OFFSTRINGn it will probably be spending
much of it's time waiting for a message from BackTalk. The following
script will send a message to "BT_msg" with the command "DIE". If
your script looks for this message you can then do whatever cleanup
is necessary (ie., get out of your event loop and call RESET) and
terminate the script.
*/
address "BT_msg" DIE
MESSAGE "-----------------------"
MESSAGE "| SCRIPT KILLED |"
MESSAGE "-----------------------"
---------------------------------------------------------------------------
/*
here is an example script that specifically looks for the "DIE" message.
*/
---------------------------------------------------------------------------
/* DIE example */
options results
if ~show('l', "rexxsupport.library") then
addlib('rexxsupport.library',0,-30,0)
keepgoing = TRUE;
myport = openport("BT_msg")
if myport = 0 then do
MESSAGE " "
MESSAGE "-----------------------"
MESSAGE "| PORT ALREADY IN USE |"
MESSAGE "-----------------------"
exit
end
ONSTRING3 "brb"
do while keepgoing = TRUE
packet = getpkt("BT_msg")
do while packet = '00000000'x
call waitpkt("BT_msg")
packet = getpkt("BT_msg")
end
arg0 = getarg(packet)
call reply(packet,0)
select
when arg0 = "DIE" then do
RESET
closeport("BT_msg")
exit
end
when arg0 = 'MATCH3' then call dobrb
otherwise nop
end
end
dobrb:
GETLINE
str = result
good = pos('(', str)
if good = 1 then do
comma = pos(',', str)
endparen = pos(')', str);
comma = comma + 1
str = substr(str, comma, endparen - comma)
if str = "sja" then
return(0)
SENDNCR "See ya in a few, "
SEND str
end
return(0)