home *** CD-ROM | disk | FTP | other *** search
/ Aminet 10 / aminetcdnumber101996.iso / Aminet / biz / dopus / Dopus511.lha / LhADirOpus5V10.lha / LhADir / arexx / LhADir-handler next >
Text File  |  1995-05-27  |  2KB  |  61 lines

  1. /*
  2.   $VER: LhADir-handler 1.0 (14.5.95)
  3.   Custom handler for LhADir.dopus5.
  4. */
  5.  
  6. options results
  7. options failat 11
  8.  
  9. parse arg portname
  10. parse var portname '.' portno
  11. address value portname
  12.  
  13. if ~show('l','rexxsupport.library') then
  14.    call addlib('rexxsupport.library',0,-30,0)
  15.  
  16. call openport('LhADir-handler'portno)
  17.  
  18. do forever
  19.    if waitpkt('LhADir-handler'portno) then do
  20.       packet=getpkt('LhADir-handler'portno)
  21.  
  22.       event=getarg(packet,0)
  23.       handle=getarg(packet,1)
  24.       name=getarg(packet,2)
  25.       user=getarg(packet,3)
  26.  
  27.       if event='doubleclick' then do
  28.          lister query handle entry '"'name'"' stem fileinfo.
  29.          if fileinfo.type>0 then do  /* it's a dir */
  30.             name=name'/'
  31.             cmd='GETDIR'
  32.             end
  33.          else
  34.             if pos(upper(right(name,4)),'.LHA.LZH.RUN')>0 then  /* archive in an archive */
  35.                cmd='GETDIR'
  36.             else
  37.                cmd='DOUBLECLICK'
  38.          address command 'Run >NIL: <NIL: rx DOpus5:arexx/LhADir.dopus5' cmd portname '"'name'"' handle
  39.          end
  40.  
  41.       if event='inactive' then do
  42.          lister query handle path
  43.          winpath=result
  44.          oldpath=getarg(packet,4)
  45.          test=upper(winpath)
  46.          if winpath=left(oldpath,length(winpath))&(pos('.LHA/',test)>0|pos('.LZH/',test)>0|pos('.RUN/',test)>0) then  /* user did parent */
  47.             address command 'Run >NIL: <NIL: rx DOpus5:arexx/LhADir.dopus5 GETDIR' portname '""' handle
  48.          else
  49.             address command 'Delete >NIL: T:LhADir.list'handle 'QUIET'  /* remove temp file */
  50.          end
  51.  
  52.       if event='drop' then do
  53.          name=strip(name,'t')
  54.          if right(name,1)=':' then
  55.             lister read handle '"'name'"' force  /* user dropped a volume icon */
  56.          end
  57.  
  58.       call reply(packet,0)
  59.       end
  60.    end
  61.