home *** CD-ROM | disk | FTP | other *** search
- /*
- $VER: ArcAdd.dopus5 1.3 (20.9.95)
-
- Original Arexx scripts for DOpus4 by John Crookshank.
- MultiLZH1.dopus - Add files to list
- MultiLZH2.dopus - Archive files in list
-
- Updated for DOpus 5.11 and combined into one script by D.Clarke.
-
- Add to button/toolbar as follows:
- ---------------------------------------------------------------
- Arexx DOpus5:Arexx/ArcAdd.dopus5 {Ql} {Qp} [ARC | EDIT]
-
- Items checked: Run Asynchronously
- ---------------------------------------------------------------
- where: ARC = archive list contents, if ARC is not present, action will
- be to add selected items to list for archiving.
- EDIT = calls 'ed' to edit the archive list.
-
- ***** NOTE: If {Ql} and {Qp} are not present as above, this script will
- _NOT_ work.
-
- ===============================================================
- Search for line below 'Copy SYS:Useful/'||archiver||' T:' and edit to reflect
- your path to LhA, ZIP, and LZX.
- ===============================================================
-
- History: 1.0 - First version.
- 1.1 - Added ability to choose LhA/LZX archiver.
- - Added check for source lister when archiving list.
- - Some grammatical corrections.
- 1.2 - Added simple edit function. ie. it calls 'ed'.
- - Removed check for source lister.
- 1.3 - Now uses STEMs for getting files/dirs
- - Can now choose ZIP archiver, (mainly for dumping things
- to an I*M).
-
- */
-
- plural. = 's'
- plural.1 = ''
- thing = 1
- LF = '0a'x
-
- options results
- parse arg handle Port func .
-
- if upper(func) = 'EDIT' then
- do
- if exists('T:infiles.txt') then address command 'ed T:infiles.txt'
- exit
- end
-
- return = Open(infile,"T:infiles.txt","R")
- if return > 0 then do
- do until EOF(infile)
- name.thing = ReadLn(infile)
- thing = thing + 1
- end
- return = close(infile)
- if upper(func) = 'ARC' then
- do
- thing = thing - 2
- signal AddThem
- end
- else
- thing = thing - 1
- end
-
- address value port
- lister query handle selfiles stem files.
- lister query handle seldirs stem dirs.
-
- if files.count = 0 & dirs.count = 0 then do
- dopus request '"No files/dirs selected!" OK'
- exit
- end
-
- lister query handle path
- intpath = RESULT
- path = strip(intpath,B,'"')
-
- if left(path,8) = 'Ram Disk' then do
- parse var path ':' rest
- path = 'RAM:'||rest
- end
-
- indices = 0
- if files.count ~= 0 then do
- do until indices = files.count
- say files.indices
- lister select handle '"'||files.indices||'"' off
- lister refresh handle
- name.thing = '"'||path||strip(files.indices,B,'"')||'"'
- indices = indices + 1
- thing = thing + 1
- end
- end
-
- indices = 0
- if dirs.count ~= 0 then do
- do until indices = dirs.count
- say dirs.indices
- lister select handle '"'||dirs.indices||'"' off
- lister refresh handle
- name.thing = '"'||path||strip(dirs.indices,B,'"')||'/#?'
- indices = indices + 1
- thing = thing + 1
- end
- end
-
- address command
-
- return = open(outfile,"T:infiles.txt","W")
-
- counter = 1
- do until counter = thing
- return = WriteLn(outfile,name.counter)
- counter = counter + 1
- end
- return = Close(outfile)
-
- address value port
- thing = thing - 1
- mssg = thing || ' item' || plural.thing || ' now in the archive list.'
- dopus request '"'mssg'"' "OK"
- exit
-
-
- AddThem: /* Time to Archive */
-
- if thing < 1|left(name.1,1) ~='"' then do
- address value port
- dopus request '"No input files. You must first add files to the list." OK'
- exit
- end
-
- address value port
-
- lister query handle path
- path = strip(result,B,'"')
- if left(path,8) = 'Ram Disk' then do
- parse upper var path ':' rest
- path = 'RAM:'||rest
- end
-
- getname:
- dopus getstring '"Archive filename:" 40 "" OK|Cancel'
- outname = RESULT
-
- if outname = ''|outname = 'RESULT'|outname = '1' then do
- dopus request '"An output filename is required!" OK|Cancel'
- if RESULT = 1 then signal getname
- exit
- end
-
- dopus request '"Select archiver:" LhA|LZX|ZIP|Cancel'
- select
- when RC = 0 then
- exit
- when RC = 1 then
- archiver = 'LhA'
- when RC = 2 then
- archiver = 'LZX'
- when RC = 3 then
- archiver = 'ZIP'
- end
-
- address command
-
- test = upper(right(outname,4))
- if test = '.LHA'|test='.LZX' then outname = left(outname,length(outname) - 4)
-
- 'Copy SYS:Useful/'||archiver||' T:' /* Change to reflect your path to LhA/LZX */
- counter = 1
- do until counter > thing
- if archiver = 'LZX' then
- doscom = 'T:'||archiver||' >NIL: -r -e -a -3 u -- ' path||outname name.counter
- else
- if archiver = 'LhA' then
- doscom = 'T:'||archiver||' >NIL: -r -a u ' path||outname name.counter
- else
- doscom = 'T:'||archiver||' >NIL: -r -9 -k -q ' path||outname name.counter
- doscom
- counter = counter + 1
- end
-
- 'Delete T:infiles.txt quiet'
- 'Delete T:'||archiver||' quiet'
-
- address value port
- mssg = thing||' item'||plural.thing||' archived into'||LF||LF||path||outname||'.'||Lower(archiver)
- dopus request '"'mssg'" OK'
- exit
-
- Lower: procedure /* The opposite of UPPER, converts to lowercase */
- parse arg text .
- text = BITOR(text,'20'x)
- return(text)
-