home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Best of Mecomp Multimedia 1
/
Mecomp-CD.iso
/
amiga
/
tools
/
opus
/
opus-tools_4.x
/
dopuslharexx
/
arexx
/
getsizeslha.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1994-01-03
|
2KB
|
132 lines
/*rx
*
* GetSizesLhA.rexx - Find total size of all files selected in a DOpus
* LhA buffer window
*
* $VER: GetSizesLhA 40.2 (03/01/94) by Geoff Seeley
*
* Usage: ARexx command GetSizesLhA.rexx (from DOpus)
*
*/
/*---------------------------------------------------------------------------*/
/* misc. variables */
DOpusPort = 'DOPUS.1'
LhaExt1 = '.lha'
LhaExt2 = '.lzh'
/* make sure we've got somebody to talk to */
if showlist('Ports', DOpusPort) = 0 then do
say 'Directory Opus ARexx port not found. Aborting.'
call CleanUp
end
address 'DOPUS.1'
options results
/* get the path/name of the LhA archive file */
Status 14
LhaArchive = result
/* make sure it's an LhA archive listing buffer */
if right(LhaArchive, 4, ' ') ~= LhaExt1 & right(LhaArchive, 4, ' ') ~= LhaExt2 then do
Notify "Sorry, buffer isn't an LhA archive. You must use the ListLha button first."
call CleanUp
end
/* get total count of files */
Status 6
TotalFiles = result - 1
/* get total bytes in archive */
GetEntry TotalFiles
TotalBytes = result
TotalBytes = substr(TotalBytes, 1, 9)
TotalBytes = strip(TotalBytes)
/* adjust total for footer */
TotalFiles = TotalFiles - 2
/* get list of selected entries */
GetSelectedAll
SelectedEntries = result
if SelectedEntries = 'RESULT' then do
Notify "Please select file(s) to total..."
call CleanUp
end
NumberOfEntries = words(SelectedEntries)
Busy on
/* sum the files */
NumberOfBytes = 0
NumberOfFiles = 0
call SumEachFile
TopText "Files: " || NumberOfFiles || "/" || TotalFiles || " Bytes: " || NumberOfBytes || "/" || TotalBytes
Busy off
exit 0
/*----------------------------------------------------------------------------*/
SumEachFile: /* add each selected file to total */
do EntryNumber = 1 to NumberOfEntries
/* get entry number, retrieve entry */
Index = word(SelectedEntries, EntryNumber)
GetEntry Index + 1
Entry = result
/* grab file name/path */
File = substr(Entry, 10)
Size = substr(Entry, 1, 9)
NumberOfFiles = NumberOfFiles + 1
NumberOfBytes = NumberOfBytes + Size
/* make sure user see's the entry */
ScrollToShow Index
TopText "Files: " || NumberOfFiles || "/" || TotalFiles || " Bytes: " || NumberOfBytes || "/" || TotalBytes
end
return
/*---------------------------------------------------------------------------*/
CleanUp: /* clean up and exit */
Busy off
exit 0
return