home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga 13 / MA_Cover_13.bin / c / lzx&lha.dopus < prev    next >
Encoding:
Text File  |  1996-09-14  |  4.9 KB  |  10 lines

  1. /* DOPUS-LZX & LHA AREXX SCRIPT version 2.0 by Nightmare
  2.  * based on DOPUS-LHA AREXX SCRIPT by Michiel Pelt
  3.  * Lists first archive in current window and installs handler to handle.
  4.  * Double-click on 'Quit' to quit
  5.  * Double-click on 'AddFiles' to add selected files to the archive
  6.  * Double-click on 'ExtractSelected' to extract selected files from it
  7.  * Double-click on 'DeleteSelected' to remove selected files from it
  8.  * Click-m-click or double-click on files to extract single files
  9. */
  10. address 'DOPUS.1';options results;'busy on';'toptext lzx & lha interface';IF ~SHOW('L',"rexxsupport.library") THEN;DO;IF ADDLIB("rexxsupport.library",0,-30,0) THEN;'TopText' " ";ELSE;DO;'TopText' "Rexxsupport.library not found";EXIT 10;END;END;'getnextselected';archiefname=result;'status 13 -1';path=result;archief='"'path||archiefname'"';ext=upper(right(archiefname,3));OPENPORT('ARCPort');if ext="LZX" then CALL ShowArchive;else CALL ShowArchivel;'busy off';DO FOREVER;IF WAITPKT('ARCPort') THEN;DO;pakket=GETPKT('ARCPort');actie=GETARG(pakket,0);i=GETARG(pakket,1);text=GETARG(pakket,2);user=GETARG(pakket,3);REPLY(pakket,0);'busy on';IF actie=1 THEN 'OtherWindow';IF user=1 THEN;DO;'OtherWindow';'busy off';'cd "'path'"';'rescan';'cd' "sys:";EXIT;END;ELSE IF user=2 THEN;IF actie=1 THEN;DO;'status 13 -1';destpath=result;'GetNextSelected';filename=result;pragma('Directory',destpath);DO WHILE ~(filename=0);if ext="LZX" then ADDRESS COMMAND 'c:lzx -e -x -r a' archief '"'filename'"';else ADDRESS COMMAND 'c:lha -axre a' archief '"'destpath'" "'filename'"';'SelectFile "'filename'"' 0 1;'GetNextSelected';filename=result;END;'OtherWindow';if ext="LZX" then CALL ShowArchive;else CALL ShowArchivel;END;ELSE NOP;ELSE IF user=3 THEN;DO;'status 13 -1';destpath='"'result'"';'OtherWindow';'GetSelectedAll';nums=result;DO WHILE (nums~='');PARSE VAR nums num nums;IF ~(num=='') THEN;DO;'GetEntry' num+1;text=result;PARSE VAR text filename fnam2 siz .;if (length(siz)>0) then filename=filename fnam2;if ext="LZX" then ADDRESS COMMAND 'c:lzx x' archief '"'filename'"' destpath;else ADDRESS COMMAND 'c:lha x' archief destpath '"'filename'"';END;END;'OtherWindow';'Rescan';'OtherWindow';END;ELSE IF user=4 THEN;DO;'OtherWindow';'GetSelectedAll';nums=result;DO WHILE (nums~='');PARSE VAR nums num nums;IF ~(num=='') THEN;DO;'GetEntry' num+1;text=result;PARSE VAR text filename fnam2 siz .;if (length(siz)>0) then filename=filename fnam2;if ext="LZX" then ADDRESS COMMAND 'c:lzx d' archief '"'filename'"';else ADDRESS COMMAND 'c:lha d' archief '"'filename'"';END;END;if ext="LZX" then CALL ShowArchive;else CALL ShowArchivel;END;ELSE;DO;spac=' ';'status 13 -1';destpath='"'result'"';PARSE VAR text filename fnam2 siz .;if (length(siz)>0) then filename=filename fnam2;if ext="LZX" then ADDRESS COMMAND 'c:lzx x' archief destpath '"'filename'"';else ADDRESS COMMAND 'c:lha x' archief destpath '"'filename'"';'Rescan';'OtherWindow';END;'busy off';END;END;ShowArchive:;ADDRESS COMMAND 'c:lzx l' archief '>t:file';IF RC>0 THEN;DO;'TopText' "LZX-error";'busy off';EXIT 10;END;'ClearWin';'SetWinTitle' archiefname;OPEN('file','t:file','R');'AddCustEntry Quit 1 7 -1 1 1';'AddCustEntry AddFiles 2 7 -1 1 1';'AddCustEntry ExtractSelected 3 7 -1 1 1';'AddCustEntry DeleteSelected 4 7 -1 1 1';DO i=1 TO 8 WHILE ~EOF('file');entry=READLN('file');END;stop=0;spac=' ';DO WHILE (~EOF('file')&(stop ~=1));entry=READLN('file');filenam2='';IF ~(LEFT(entry,1)==':') THEN;DO;PARSE VAR entry osize psize ratio date time filename filenam2 ef .;if (length(date)>1)&length(filenam2)>0 then filename=filename filenam2;if length(date)<2 then entry=filenam2;else entry=filename;if (length(date)<2)&length(filenam2)>0 then filenam2='';IF LENGTH(osize)>0 THEN;DO;pos=MAX(45,(LENGTH(entry)+LENGTH(osize)+2));entry=OVERLAY(osize,entry,pos-LENGTH(osize));entry='"'entry'"';if (length(time)>0)&(ratio ~="-----") then 'AddCustEntry' entry '5 -1 -1 1 1';if ratio="-----" then 'AddCustEntry' entry '5 -1 -1 0 1';END;ELSE stop=1;END;END;CLOSE('file');'delete t:file';'AddCustHandler ARCPort';RETURN;ShowArchivel:;ADDRESS COMMAND 'c:lha >t:file v' archief;IF RC>0 THEN;DO;'TopText' "LHA-error";'busy off';EXIT 10;END;'ClearWin';'SetWinTitle' archiefname;OPEN('file','t:file','R');'AddCustEntry Quit 1 7 -1 1 1';'AddCustEntry AddFiles 2 7 -1 1 1';'AddCustEntry ExtractSelected 3 7 -1 1 1';'AddCustEntry DeleteSelected 4 7 -1 1 1';DO i=1 TO 5 WHILE ~EOF('file');entry=READLN('file');END;spac=' ';stop=0;DO WHILE (~EOF('file')&(stop ~=1));entry=READLN('file');IF ~(LEFT(entry,1)==':') THEN;DO;PARSE VAR entry osize psize ratio date time filename ef .;if length(ef)>0 then filename=filename ef;entry=filename;IF LENGTH(osize)>0 THEN;DO;pos=MAX(45,(LENGTH(entry)+LENGTH(osize)+2));entry=OVERLAY(osize,entry,pos-LENGTH(osize));entry='"'entry'"';if (length(filename)>0)&ratio ~="-----"&ef="" then 'AddCustEntry' entry '5 -1 -1 1 1';if ratio="-----" then 'AddCustEntry' entry '5 -1 -1 0 1';if length(ef)>0 then 'AddCustEntry' entry '5 -1 -1 1 1';END;ELSE stop=1;END;END;CLOSE('file');'delete t:file';'AddCustHandler ARCPort';RETURN