$VER: Online Dictionary and Thesaurus 2.5 (12.11.00)
This script uses the Merriam-Webster site .
www.m-w.com
requires AWNP 2.52+
*/
if ~show('L','rexxsupport.library') then
if ~addlib('rexxsupport.library',0,-30,0) then
exit(20)
if show('P','DICTTHESAR') then do
address DICTTHESAR 'front'
exit
end
rxPort = address()
if abbrev(rxPort,'AWEB.') then do
'get screen var screen'
screen=' ps 'screen' '
end
else screen=''
nl='a'x
delaybub=0
call setdefaults()
call buildgui()
do while ~eof(ca)
call checkrx()
if delaybub>0 then do
delaybub=delaybub-1
if delaybub=0 then do
bubbleon=newbub
call topipe('bubble top 'bubx 'left 'buby 'gt "'help.newbub'"')
end
end
call topipe('tick 50')
in= readln(ca)
parse var in in1 in2 in3 in4 in5 .
if (in1='help' & helpon~=0 ) then do
call bubble(in2)
end
if in1='active' then call bubble(0)
if in1='key' then call key()
if in1='gadget' then call gadget()
if in1='iconify' then call iconify(in2)
if in1='menu' then call menu()
if in1='close' then call windowclosed()
if in1='arexx' then call rxhst()
end
exit
key:
scrpos=topipe('id 'txtgad)
if (in2=77) then do
do i=0 for pcnt
if poslist.i>scrpos then break
end
if i=pcnt then i=i-1
call topipe('id 'txtgad' scroll -1')
call topipe('id 'txtgad' scroll' poslist.i)
end
if (in2=76) then do
do i=0 for pcnt
if scrpos<=poslist.i then break
end
if i>0 then i=i-1
call topipe('id 'txtgad' scroll' poslist.i)
end
return
gadget:
call bubble(0)
if in2=wordgad then do
parse var in . . w
logon=1
call getword(w)
end
if in2=quitgad then exit
if in2=levelgad then level=in3
if in2=bookgad then book=in3
if in2=cleargad then call clearlog()
if in2=savegad then do
call writeln(ca,'id 'filegad' s 1 save 1 fn "'filename'"')
parse value readln(ca) with res1 '"' res2 '"'
if (res1>0) then do
filename=res2
call writeln(ca,'id 'txtgad' read')
len=readln(ca)
data=readch(ca,len)
if( open(out,res2,'W')) then do
call writech(out,data)
call close(out)
end
end
end
return
windowclosed:
exit
return
setdefaults:
parse source . . called .
logging=1
oldpos=0
poslist.0=0
pcnt=1
level=0
book=0
filename=''
scrpos=''
prono=''
theno=''
envname='onlinedictionary'
call getenv()
abouttx=' Online Dictionary & Thesaurus *nVers 2.5 *nArexx Host DICTTHESAR*nAuthor William Parker*nGUI by AWNPipe:'
return
buildgui:
call open(ca,"awnpipe:dict/-2052/xc")
call topipe(screen 'it "Dict Thesa" "Online Dictionary & Thesaurus" sk v defg ig h state m a 'window' ii "'called'"' )
lay1=topipe(' layout weih 0')
call topipe(' label gt "_Word: " ua')
wordgad=topipe('string chl lj')
help.wordgad=' Enter word to look up '
levelgad=topipe('chooser cl "First|Major|All" pu weiw 0')
help.levelgad='Select look up depth*n First Entry*n Major Entries*n All Entries'
bookgad=topipe('chooser cl "Dictionary|Thesaurus" pu weiw 0')
help.Bookgad='Select book to search in*n Dictionary definition*n Thesaurus information'
call topipe(' le')
txtgad=topipe('textfield ro arrows')
help.txtgad=' This area displays the retrieved definitions. It is read only *n but you may drag and copy the results to the clipboard. *n The cursor keys can be used to scroll the information.'
lay2=topipe(' layout weih 0')
abortgad=topipe('button pb gt "_Abort" dis 1')
help.abortgad=' Abort multiple retrieval*navailable for major and all*noptions'
savegad=topipe('button gt "_Save Log"')
help.savegad=' Save retrieved definitions to a file '
cleargad=topipe('button gt "_Clear Log"')
help.cleargad=' Remove all retrieved definitions '
call writeln(ptx,screen 'db dg "D&T info" q cm v m a ')
call writeln(ptx,'layout defn 2 weiw 10 si fpat="5555aaaa" cj v b 0'nl'space trans minh 2'nl'laYOUT DEFN 2 fpat="5555aaaa" cj b 0'nl'space trans minw 5'nl'layout weih 0 weiw 0 so'nl'label gt " *n'arg(2)'*n "')
call writeln(ptx,'le'nl'space trans minw 5'nl'le'nl'button gt " OK " c weiw 0'nl'le'nl'open'nl)
if arg(1)~=0 then call writeln(ptx,'tick 'arg(1))
else call writeln(ptx,'m')
call close(ptx)
return(0)
menu:
if in2=1 then do
if ~show('P','MIAMI.1') then do
if in3=1 | in3=1 | in3=6 then do
call showtx(200,' Miami is not running ')
return()
end
address command 'Run >NIL: Miami:Miami '
do 5 while ~show('P','MIAMI.1')
address command 'waitforport MIAMI.1'
end
if rc=5 then return()
end
if in3=1 then address MIAMI.1 'OFFLINE'
if in3=6 then address MIAMI.1 'QUIT'
if in3=0 then address MIAMI.1 'ONLINE'
if in3=3 then address MIAMI.1 'HIDE'
if in3=4 then address MIAMI.1 'SHOW'
if in3=2 | in3=0 | in3=1 then do
address MIAMI.1 'ISONLINE'
if rc then call showtx(400,' Miami is online ')
else call showtx(400,' Miami is offline ')
end
end
if in2=0 then do
if in3=0 then do
if in4=0 then call setenvarc()
if in4=1 then call unsetenvarc()
end
if in3=1 then call showtx(800,abouttx)
if in3=2 then do
helpon=in5
if helpon=0 then call bubble(0)
end
if in3=4 then exit
end
return()
iconify:
if arg(1)=1 then call topipe('id 0 s 32')
else call topipe('id 0 s 64')
call bubble(0)
return
getenv:
if(open(env,'env:'envname,'R')) then do
windows=readln(env)
filename=readln(env)
call close(env)
parse var windows wl wt ww wh .
window= 'top' wt 'left' wl 'width' ww 'height' wh
end
else window='tl width 400 height 200'
return
setenv:
call writeln(ca,'id 0 read')
windowr=readln(ca)
parse var windowr wl wt ww wh .
if (datatype(wt,N) &datatype(wl,N) &datatype(ww,N) & datatype(wh,N) ) then do