home *** CD-ROM | disk | FTP | other *** search
- /*
- $VER: FIDEdit.dopus5 1.0 (19.7.96)
- Written by Edmund Vermeulen (edmundv@grafix.xs4all.nl).
-
- ARexx script for Directory Opus 5 to edit File IDs in archives.
-
- Function : ARexx DOpus5:ARexx/FIDEdit.dopus5 {Qp}
- */
-
- editor='TTX WAIT' /* for TurboText */
-
- /*
- editor='Ed' /* for AmigaDOS Ed */
- editor='CED -keepio' /* for CygnusED 3.5 */
- */
-
-
- parse arg portname .
-
- if portname='' then
- portname='DOPUS.1'
- address value portname
-
- options results
- options failat 21
-
- lf='0a'x
-
- lister query source
- if rc>0 then
- exit
- parse var result handle .
-
- lister set handle busy on
-
- lister query handle path
- srcpath=result
-
- lister query handle selfiles stem files.
-
- lister set handle progress files.count 'FIDEdit'
-
- if exists('T:FILE_ID.DIZ') then do
- command wait protect name 'T:FILE_ID.DIZ' set 'RWD'
- address command 'Delete >NIL: T:FILE_ID.DIZ QUIET'
- end
-
- do i=0 to files.count-1
- lister query handle abort
- if result then
- signal quitit
-
- lister set handle progress count i+1
- lister set handle progress name files.i
- lister query handle entry files.i stem fileinfo.
-
- thisfile='"'srcpath||fileinfo.name'"'
- ext=reverse(fileinfo.name)
- parse var ext ext '.'
- ext=upper(reverse(ext))
-
- select
- when ext='LHA'|ext='LZH'|ext='RUN' then
- address command 'LhA >NIL: e -q -x0 -Qw -Qo' thisfile 'T: FILE_ID.DIZ'
- when ext='LZX' then
- address command 'LZX >NIL: x' thisfile 'FILE_ID.DIZ T:'
- when ext='DMS' then
- address command 'DMSDescript >NIL: x T:FILE_ID.DIZ' thisfile
- otherwise
- nop
- end
-
- command wait protect name 'T:FILE_ID.DIZ' set 'RWD'
-
- repack=0
- do forever
- fid=''
- illegal=0
- if open('fileid','T:FILE_ID.DIZ','r') then do
- lines=0
- do while ~eof('fileid') & lines<=12
- idline=compress(readln('fileid'),'"'||'0d1a'x)
- if ~(idline=='' & eof('fileid')) then do
- lines=lines+1
- if lines>12 then do
- fid=fid||lf||lf||'[> 12 lines]'
- illegal=1
- end
- else do
- if length(idline)>44 then do
- idline=left(idline,44)'... [> 44 chars]'
- illegal=1
- end
- if fid~=='' then
- fid=fid||lf
- fid=fid||idline
- end
- end
- end
- call close('fileid')
- end
- else
- fid='No File ID found!'
-
- if repack then
- dopus request '"'fid'" Repack|Edit|Cancel|Abort'
- else
- dopus request '"'fid'" Next|Edit|Abort'
- select
- when rc=0 then
- signal quitit
- when rc=1 then do
- if illegal then do
- dopus request '"Illegal File ID!" Back|Cancel'
- if rc=0 then
- leave
- end
- else
- leave
- end
- when rc=2 then do
- address command editor 'T:FILE_ID.DIZ'
- dopus front
- repack=1
- end
- when rc=3 then do
- repack=0
- leave
- end
- end
- end
-
- if repack & ~illegal then do
- address command 'Rename T:File_Id.Diz T:FILE_ID.DIZ QUIET'
- command protect name '"T:FILE_ID.DIZ"' clear 'E'
- select
- when ext='LHA'|ext='LZH'|ext='RUN' then
- address command 'LhA >NIL: r -q -x0 -Qw -Qo' thisfile 'T:FILE_ID.DIZ'
- when ext='LZX' then
- address command 'LZX >NIL: r' thisfile 'T:FILE_ID.DIZ'
- when ext='DMS' then do
- address command 'DMSDescript >NIL: d' thisfile
- address command 'DMSDescript >NIL: a T:FILE_ID.DIZ' thisfile
- end
- otherwise
- nop
- end
- end
-
- address command 'Delete >NIL: T:FILE_ID.DIZ QUIET'
- lister select handle '"'fileinfo.name'"' off
- end
-
-
- quitit:
-
- lister clear handle progress
- lister refresh handle full
- lister set handle busy off
- address command 'Delete >NIL: T:FILE_ID.DIZ QUIET'
-