home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / FileMover / Dopus5 / DC-OP55B.LZX / Opus5 / arexx / PopUpDisk.dopus5 < prev    next >
Encoding:
Text File  |  1996-05-03  |  2.5 KB  |  106 lines

  1. /*
  2.   $VER: PopUpDisk.dopus5 1.0 (15.2.95)
  3.   Written by Edmund Vermeulen (edmundv@grafix.xs4all.nl).
  4.  
  5.   ARexx script for the Directory Opus 5.5 'Disk inserted' script.
  6.   Function : ARexx      DOpus5:ARexx/PopUpDisk.dopus5
  7.  
  8.   Also, set both the 'Disk removed' and 'Startup' script to:
  9.   Function : AmigaDOS   C:Info >T:DeviceInfo
  10. */
  11.  
  12. options results
  13. address dopus.1
  14. options failat 21
  15. lf='0a'x
  16.  
  17. if ~exists('T:DeviceInfo') then do
  18.    address command 'Info >T:DeviceInfo'
  19.    exit
  20.    end
  21.  
  22. call open('devlist','T:DeviceInfo','r')
  23. do 3
  24.    call readln('devlist')
  25.    end
  26. n=0
  27. do until thisline=''
  28.    n=n+1
  29.    thisline=readln('devlist')
  30.    parse var thisline oldunit.n . . . . . . oldname.n
  31.    end
  32. call close('devlist')
  33.  
  34. address command 'Info >T:DeviceInfo'
  35. call open('devlist','T:DeviceInfo','r')
  36.  
  37. do 3
  38.    call readln('devlist')
  39.    end
  40. do until thisline=''
  41.    thisline=readln('devlist')
  42.    parse var thisline unit . . . . . . name
  43.    do i=1 to n
  44.       flag=(unit=oldunit.i)
  45.       if flag then do
  46.          if name~==oldname.i then
  47.             if name=='' then do  /* disk removed */
  48.                lister query all stem handle.
  49.                if rc=0&handle.count>0 then
  50.                   do i=0 to handle.count-1
  51.                      lister query handle.i path
  52.                      parse var result device ':'
  53.                      if device':'=unit then
  54.                         lister close handle.i
  55.                      end
  56.                end
  57.             else  /* new disk inserted */
  58.                signal promptdisk
  59.          leave
  60.          end
  61.       end
  62.    if ~flag&name~=='' then  /* new device mounted */
  63.       signal promptdisk
  64.    end
  65. call close('devlist')
  66. exit
  67.  
  68.  
  69. promptdisk:
  70.  
  71.    call close('devlist')
  72.  
  73.    lister query all stem handle.
  74.    if rc=0&handle.count>0 then do
  75.       flag=0
  76.       do i=0 to handle.count-1
  77.          lister query handle.i path
  78.          thispath=result
  79.          parse var thispath device ':'
  80.          if device':'=unit then do
  81.             flag=1
  82.             if exists(thispath) then
  83.                lister read handle.i thispath
  84.             else
  85.                lister read handle.i unit
  86.             end
  87.          end
  88.       if flag then
  89.          exit
  90.       end
  91.  
  92.    dopus front
  93.    dopus request '"New disk inserted in unit' unit'.'lf'In which lister do you want to read the directory?" New|Source|Dest|Cancel'
  94.    if rc=1 then
  95.       lister new unit
  96.    if rc=2 then do
  97.       lister query source
  98.       parse var result handle .
  99.       lister read handle unit
  100.       end
  101.    if rc=3 then do
  102.       lister query dest
  103.       parse var result handle .
  104.       lister read handle unit
  105.       end
  106.