home *** CD-ROM | disk | FTP | other *** search
Wrap
/* Done by Allan 'Duff' Odgaard on Monday 27-Feb-95 22:38:57 For selective extraction of Lh-Archives in DirectoryOpus. $VER: LhA-Control.Rexx V2.5 (27-Feb-95) Allan 'Duff' Odgaard */ Parse Arg '"' SourceArc '"' PortName . If PortName ~= '' Then Address(PortName) Busy On Trace Results Options Results Options FailAt 21 Query ScreenName PubScreen = Result Signal On Syntax BuffersInPref = 10 /* Look in ConfigPart/System/Directories */ Shell = 'Con:000/028/640/437/LhA-Selector V2.5 Output/Screen ' || PubScreen If Open('Env','Env:LhA-Control.Paths','R') = 0 Then Do Address Command 'C:Which LhA >T:LhA.Path';Open('LhA','T:LhA.Path','R');LhA = ReadLn('LhA');Close('LhA') If LhA = '' Then Do;Address Command 'C:RequestFile >T:LhA.Path File "LhA" Title "Where is LhA?" NoIcons PubScreen' PubScreen;Open('LhA','T:LhA.Path','R');LhA = ReadLn('LhA');Close('LhA');End Address Command 'C:Which MultiView >T:MultiView.Path';Open('MultiView','T:MultiView.Path','R');MultiView = ReadLn('MultiView');Close('MultiView') If MultiView = '' Then Do;Address Command 'C:RequestFile >T:MultiView.Path File "MultiView" Title "Where is MultiView?" NoIcons PubScreen' PubScreen;Open('MultiView','T:MultiView.Path','R');MultiView = ReadLn('MultiView');Close('MultiView');End Address Command 'C:Which Rx >T:Rx.Path';Open('Rx','T:Rx.Path','R');Rx = ReadLn('Rx');Close('Rx') If Rx = '' Then Do;Address Command 'C:RequestFile >T:Rx.Path File "Rx" Title "Where is Rx?" NoIcons PubScreen' PubScreen;Open('Rx','T:Rx.Path','R');Rx = ReadLn('Rx');Close('Rx');End If show('p','SWAZINFO') = 1 Then Do Address Command 'C:Which SwazFix >T:SwazFix.Path';Open('SwazFix','T:SwazFix.Path','R');SwazFix = ReadLn('SwazFix');Close('SwazFix') If SwazFix = '' Then Do;Address Command 'C:RequestFile >T:SwazFix.Path File "SwazFix" Title "Where is SwazFix?" NoIcons PubScreen' PubScreen;Open('SwazFix','T:SwazFix.Path','R');SwazFix = ReadLn('SwazFix');Close('SwazFix');End End Open('Env','Env:LhA-Control.Paths','W') WriteLn('Env',LhA) WriteLn('Env',MultiView) WriteLn('Env',Rx) WriteLn('Env',SwazFix) Close('Env') Address Command 'C:Copy Env:LhA-Control.Paths EnvArc: Quiet' End Else Do LhA = ReadLn('Env') MultiView = ReadLn('Env') Rx = ReadLn('Env') SwazFix = ReadLn('Env') Close('Env') End EndIf TmpPath = 'T:LhA-Ctrl_By_Duff/' OldBuf = BuffersInPref - 1 TmpList = TmpPath'TmpLhAList.Duff' TmpFiles = TmpPath'TmpExtFiles.Duff' ScriptFile = TmpPath'TmpScript.Duff' lf = '0a'x Status 3 ActiveWin = Result Status 13 ActiveWin CurrentPath = Result If Show('p','MouseActions') = 1 Then Call AllReady Call AddLib("rexxsupport.library",0,-30,0) Call AddLib("rexxreqtools.library",0,-30,0) If SourceArc ~= '' Then Signal GotIt GetNextSelected SourceArc = Result If SourceArc = 0 Then Signal Fuser GotIt: If Open('TestForLhA',CurrentPath || SourceArc,'R') = 0 Then Signal NotALhAFile Seek('TestForLhA',2,'B') If ReadCh('TestForLhA',3) ~= '-lh' Then Signal NotALhAFile Close('TestForLhA') Ds = 'No Description found in archive....' Delete('T:File_Id.Diz') Address Command LhA' x -a -qIM -Qw -Qo "' || CurrentPath || SourceArc || '" File_Id.Diz T:' If Exists('T:File_Id.Diz') = 1 Then Do Open('Desc','T:File_Id.Diz','R') Descr = "" Do While ~EOF('Desc') Descr = Descr ReadLn('Desc') End Close('Desc') Ds = Right(Descr,Length(Descr)-1) Address Command "C:Delete T:File_Id.Diz >NIL:" End Status 21 ActiveWin set 1 ClearWin TopText Ds /* TopText 'Listing 'SourceArc' to buffer...' */ Busy On Address Command 'C:MakeDir "'Left(TmpPath,Length(TmpPath)-1)'"' Address Command 'C:Assign "Used By Duff:" "'Left(TmpPath,Length(TmpPath)-1)'"' Address Command LhA' vq -INMQw "'CurrentPath || SourceArc'" >"'TmpList'"' Address Command 'C:Sort "'TmpList'" "'TmpList'"' Open('Archive',TmpList,'R') SetWinTitle '"'SourceArc':"' ActiveWin AddCustEntry '" -> Double click me when finished <- "' 0 '2' '3' '1' '0' '-1' FindLoop: Entry = ReadLn('Archive') If EOF('Archive') Then Signal FoundAll AddCustEntry '"'Entry'"' '?' '-1' '-1' '1' '0' '-1' Signal FindLoop FoundAll: Close('Archive') Delete(TmpList) DisplayDir AddCustHandler 'MouseActions' ActiveWin OpenPort('MouseActions') Busy Off WaitPacket: Call WaitPkt('MouseActions') Packet = GetPKT('MouseActions') Click = GetArg(packet,0) Number = GetArg(packet,1) Name = GetArg(packet,2) User = GetArg(packet,3) Reply(packet,0) Busy On If Click=1 Then If Number=0 Then Signal End Else Signal DoActionOnFile If Click=2 Then If Number=0 Then Signal SecretPart Else Signal AddEntry2File If Click=q Then Signal End Busy Off Signal WaitForSignal AddEntry2File: Status 3 set ActiveWin SelectEntry Number 1 1 SelectEntry 0 0 1 Status 3 Set ActiveWin GetSelectedAll AllFiles = Result NumberOfFiles = Words(AllFiles) Busy On Call rtezrequest("There are " || NumberOffiles || " selected file(s)." || lf || lf || "Extract file(s) with full path?", "_Yes|_No|_Extract as...|_Cancel","LhA-Control V2.5","RTEz_Flags=EZReqF_CenterText RT_ReqPos=ReqPos_CenterScr RT_PubScrName="PubScreen) Busy Off If RTResult = 0 Then Signal WaitForSignal Busy On If RTResult = 3 Then Signal ExtractAs TopText 'Building list over file(s) to extract...' Open('Selected',TmpFiles,'W') Do Subject = 1 to NumberOfFiles SelectEntry Word(AllFiles,Subject) 0 1 GetEntry Word(AllFiles,Subject)+1 WriteLn('Selected','"'WildCard(Result)'"') End Subject Extract: Close('Selected') TopText 'Extracting selected file(s)...' Status 13 1-ActiveWin Path = Result If RTResult = 1 Then Address Command LhA' x -a -qIM -Qw -Qo "'CurrentPath || SourceArc'" "@'TmpFiles'" "'Path'"' Else Address Command LhA' e -a -qIM -x2 -Qw -Qo "'CurrentPath || SourceArc'" "@'TmpFiles'" "'Path'"' Delete(TmpFiles) ReScan 1-ActiveWin Busy Off Signal WaitForSignal ExtractAs: TopText "Extracting and renaming file(s)..." Busy On Subject=0 GoLoop: Busy On SelectEntry Word(AllFiles,Subject+1) 0 1 GetEntry Word(AllFiles,Subject+1)+1 Name = Result TstName = Substr(Name,LastPos("/",Name)+1) Status 13 1-ActiveWin Path = Result Call rtgetstring(Name,"(Use '/' in name for dir creation.)" || lf lf || "Enter New File Name:","LhA-Control V2.5","_Extract|_Skip","RTEz_Flags=EZReqF_CenterText RT_ReqPos=ReqPos_CenterScr RT_PubScrName="PubScreen) Altered = Result If RTResult = 0 Then Signal FuncCanceled Busy On If Exists(Path || Altered) = 1 Then Address Command 'C:Delete "'Path || WildCard(Altered)'"' Call MakeNeededDir Altered If Exists(Path || TstName) = 0 Then Do Address Command LhA' e -a -qIM -x2 -Qw "'CurrentPath || SourceArc'" "'WildCard(Name)'" "'Path'"' Address Command 'C:Rename "'Path || WildCard(TstName)'" To "'Path || Altered'"' End Else Do Address Command LhA' e -a -qIM -x2 -Qw "'CurrentPath || SourceArc'" "'WildCard(Name)'" "'TmpPath'"' If Altered = WildCard(Altered) Then Do Address Command 'C:Copy "'TmpPath || WildCard(TstName)'" To "'Path || Altered'"' Address Command 'C:Delete "'TmpPath || WildCard(TstName)'"' End Else Do Address Command 'C:Rename "'TmpPath || WildCard(TstName)'" To "'TmpPath'^Findes ik^"' Address Command 'C:Copy "'TmpPath'^Findes ik^" To "'Path'^Findes ik^"' Address Command 'C:Rename "'Path'^Findes ik^" To "'Path || Altered'"' Address Command 'C:Delete "'TmpPath'^Findes ik^"' Address Command 'C:Delete "'TmpPath || WildCard(TstName)'"' End End ReScan 1-ActiveWin FuncCanceled: Subject = Subject +1 if Subject ~= NumberOfFiles Then Signal GoLoop Busy Off Signal WaitForSignal MakeNeededDir: Parse Arg SinglePath NewPos = 0 CreatePath: If Verify(Substr(SinglePath,NewPos+1),'/','Match') = 0 Then Signal Go NewPos = Verify(Substr(SinglePath,NewPos+1),'/','Match') + NewPos MakeDir(Path || Left(SinglePath,NewPos-1)) Signal CreatePath Go: Return DoActionOnFile: SelectEntry Number 1 1 SelectEntry 0 0 1 Status 3 Set ActiveWin GetSelectedAll AllFiles = Result NumberOfFiles = Words(AllFiles) Busy On If Right(Name,5) = '.info' Then Call rtezrequest("There are " || NumberOffiles || " selected file(s)." || lf || lf || "Perform wich kind of action on file(s)?", "_MultiView|_Delete|_Execute...|_IconInfo|_Cancel","LhA-Control V2.5","RTEz_Flags=EZReqF_CenterText RT_ReqPos=ReqPos_CenterScr RT_PubScrName="PubScreen) Else Call rtezrequest("There are " || NumberOffiles || " selected file(s)." || lf || lf || "Perform wich kind of action on file(s)?", "_MultiView|_Delete|_Execute...|_Cancel","LhA-Control V2.5","RTEz_Flags=EZReqF_CenterText RT_ReqPos=ReqPos_CenterScr RT_PubScrName="PubScreen) Busy Off If RTResult = 1 Then Signal MultiView If RTResult = 2 Then Signal DeleteFile If RTResult = 3 Then Signal Execute If RTResult = 4 Then Signal IconInfo If RTResult = 0 Then Signal WaitForSignal EndAction: Signal WaitForSignal MultiView: TopText "Extracting and MultiView'ing file(s)..." Busy On Subject=1 AIDW: SelectEntry Word(AllFiles,Subject) 0 1 GetEntry Word(AllFiles,Subject)+1 Name = Result TstName = Substr(Name,LastPos("/",Name)+1) Address Command LhA' e -a -qIM -x2 -Qw "'CurrentPath || SourceArc'" "'WildCard(Name)'" "'TmpPath'"' Address Command MultiView' "'TmpPath || TstName'" Screen' Address Command 'C:Delete "'TmpPath || WildCard(TstName)'"' Subject = Subject + 1 If Subject ~= NumberOfFiles+1 Then Signal AIDW DOpusToFront Busy Off Signal WaitForSignal DeleteFile: TopText "Deleting selected file(s) in archive..." Busy On Open('Selected',TmpFiles,'W') Do Subject = 1 to NumberOfFiles SelectEntry Word(AllFiles,Subject)-(Subject-1) 0 1 GetEntry Word(AllFiles,Subject)+1-(Subject-1) WriteLn('Selected','"'WildCard(Result)'"') RemoveEntry Word(AllFiles,Subject)-(Subject-1) 1 End Subject Close('Selected') Address Command LhA' d -qIM -Qp -Qw "'CurrentPath || SourceArc'" "@'TmpFiles'"' Delete(TmpFiles) ClearWin AddCustHandler 'MouseActions' ActiveWin OpenPort('MouseActions') TopText 'Re-reading 'SourceArc' to buffer...' Address Command LhA' vq -INM -Qw "'CurrentPath || SourceArc'" >"'TmpList'"' Address Command 'C:Sort "'TmpList'" "'TmpList'"' Open('Archive',TmpList,'R') SetWinTitle '"'SourceArc':"' ActiveWin AddCustEntry '" -> Double click me when finished <- "' 0 '2' '3' '1' '0' '-1' FindLoop2: Entry = ReadLn('Archive') If EOF('Archive') Then Signal FoundAll2 AddCustEntry '"'Entry'"' '?' '-1' '-1' '1' '0' '-1' Signal FindLoop2 FoundAll2: Close('Archive') Delete(TmpList) DisplayDir Busy Off Signal WaitForSignal Execute: TopText "Extracting and executing file(s)..." Busy On Subject=1 FuckLoop: SelectEntry Word(AllFiles,Subject) 0 1 GetEntry Word(AllFiles,Subject)+1 Name = Result TstName = Substr(Name,LastPos("/",Name)+1) Call rtgetstring(TstName,"Enter Command and its Arguments:","LhA-Control V2.5","_Execute|_Skip","RT_ReqPos=ReqPos_CenterScr RT_PubScrName="PubScreen) Altered = Result If RTResult = 0 Then Signal NameChanged Busy On Address Command LhA' e -a -qIM -x2 -Qw "'CurrentPath || SourceArc'" "'WildCard(Name)'" "'TmpPath'"' If Pos(TstName,Altered) = 0 Then WholeFile = Altered Else Do First = Left(Altered,Pos(TstName,Altered)-1) Middle = '"'TmpPath || TstName'"' Last = Right(Altered,length(Altered)-(Pos(TstName,Altered)+length(TstName)-1)) WholeFile = First || Middle || Last End Address Command 'C:List >"'TmpPath'Version1.Duff" "'TmpPath || TstName'" NoHead' Message = Rx' " Address ' Message = Message || "'MouseActions' x" Open('Script',ScriptFile,'W') WriteLn('Script','FailAt 999999') WriteLn('Script','Stack 4096') WriteLn('Script',WholeFile) WriteLn('Script','Echo ""') WriteLn('Script','DOpusRT -w -1 "Press left mouse button to continue..."') /* WriteLn('Script','Echo NoLine " Press [RETURN] to continue..."') */ /* WriteLn('Script','Set >NIL: Return ?') */ WriteLn('Script',Message) WriteLn('Script','EndCLI') Close('Script') Address Command 'C:NewShell "'Shell'" From "'ScriptFile'"' Call WaitPkt('MouseActions') Packet = GetPKT('MouseActions') Reply(packet,0) Delete(ScriptFile) Address Command 'C:List >"'TmpPath'Version2.Duff" "'TmpPath || TstName'" NoHead' Open('OldVer',TmpPath'Version1.Duff','R') Open('NewVer',TmpPath'Version2.Duff','R') If ReadLn('OldVer') ~= ReadLn('NewVer') Then Do Call rtezrequest("The file has been changed." || lf || "Would you like to update it?","_Sure!|_Forget it!","LhA-Control V2.5", "RTEz_Flags=EZReqF_CenterText RT_ReqPos=ReqPos_CenterScr RT_PubScrName="PubScreen) If RTResult = 1 Then Call UpDateFile End Else Address Command 'C:Delete "'TmpPath || WildCard(TstName)'" NoReq >NIL:' Close('OldVer') Close('NewVer') Address Command 'C:Delete "'TmpPath || 'Version[1-2].Duff" >NIL:' NameChanged: Subject = Subject + 1 If Subject ~= NumberOfFiles+1 Then Signal FuckLoop DOpusToFront Busy Off Signal WaitForSignal UpDateFile: SinglePath = Name NewPos = 0 ; First = 0 CreatePath2: If Verify(Substr(SinglePath,NewPos+1),'/','Match') = 0 Then Signal Go2 NewPos = Verify(Substr(SinglePath,NewPos+1),'/','Match') + NewPos If Left(SinglePath,NewPos-1) = TstName & First = 0 Then Do First = 1 Address Command 'C:Rename "'TmpPath || TstName'" "'TmpPath || TstName'.1"' TstName = TstName || '.1' End MakeDir(TmpPath || Left(SinglePath,NewPos-1)) Signal CreatePath2 Go2: Address Command 'C:Rename "' || TmpPath || TstName || '" "' || TmpPath || Name || '"' ExeUpdate: Address Command LhA' u -rqIM -Qw "'CurrentPath || SourceArc'" "'TmpPath'" "'Name'"' If RC > 0 Then Signal IOErr ExeDelete: If Verify(Name,'/','Match') = 0 Then Address Command 'C:Delete "'TmpPath || WildCard(Name)'" All NoReq >NIL:' Else Do NewPos = Verify(Name,'/','Match') Address Command 'C:Delete "'TmpPath || WildCard(Left(Name,NewPos))'" All NoReq >NIL:' End Return IconInfo: TopText "Extracting and view'ing icon..." TstName = Substr(Name,LastPos("/",Name)+1) Address Command LhA' e -a -qIM -x2 -Qw "'CurrentPath || SourceArc'" "'WildCard(Name)'" "'TmpPath'"' Address Command 'C:List >"'TmpPath'Version1.Duff" "'TmpPath || TstName'" NoHead' If Show('p','SWAZINFO') = 0 Then IconInfo '"'TmpPath || TstName'"' Else Address Command SwazFix' "'TmpPath || TstName'"' EndIf Address Command 'C:List >"'TmpPath'Version2.Duff" "'TmpPath || TstName'" NoHead' Open('OldVer',TmpPath'Version1.Duff','R') Open('NewVer',TmpPath'Version2.Duff','R') If ReadLn('OldVer') ~= ReadLn('NewVer') Then Do Call rtezrequest("The file has been changed." || lf || "Would you like to update it?","_Sure!|_Forget it!","LhA-Control V2.5", "RTEz_Flags=EZReqF_CenterText RT_ReqPos=ReqPos_CenterScr RT_PubScrName="PubScreen) If RTResult = 1 Then Call UpDateFile End Else Address Command 'C:Delete "'TmpPath || WildCard(TstName)'" NoReq >NIL:' Close('OldVer') Close('NewVer') Address Command 'C:Delete "'TmpPath || 'Version[1-2].Duff" >NIL:' SelectEntry Number 0 1 Signal WaitForSignal WaitForSignal: TopText "Don't take anything for granted, register TODAY!" Signal WaitPacket IOErr: Call rtezrequest("Error while updating archive.","_Then try again|_Ohh, fuck that!","LhA-Control V2.5", "RT_ReqPos=ReqPos_CenterScr RT_PubScrName="PubScreen) If RTResult = 1 Then Signal ExeUpdate Signal ExeDelete Wildcard: Parse Arg NoWild NewPos = 0 SortWild: If Verify(Substr(NoWild,NewPos+1),'~*#?(|)[%]','Match') = 0 Then Signal FindAtr NewPos = Verify(Substr(NoWild,NewPos+1),'~*#?(|)[%]','Match') + NewPos NoWild = Insert("'",NoWild,NewPos-1) NewPos = NewPos + 1 Signal SortWild FindAtr: If left(NoWild,1) = '@' Then NoWild = Insert('*',NoWild,0) Return NoWild End: Status 21 ActiveWin set OldBuf Address Command 'C:Assign "Used By Duff:" Remove' Address Command 'C:Delete "'Left(TmpPath,Length(TmpPath)-1)'" All NoReq >NIL:' Busy Off Exit Fuser: Call rtezrequest("No file have been selected.","I see","LhA-Control V2.5", "RT_ReqPos=ReqPos_CenterScr RT_PubScrName="PubScreen) Busy off Exit NotALhAFile: Call rtezrequest("Sorry, but this doesn't seem to be a LhA file.","hmmrf","LhA-Control V2.5", "RT_ReqPos=ReqPos_CenterScr RT_PubScrName="PubScreen) Busy off Exit AllReady: Call rtezrequest("Sorry, but LhA-Control can't be runned twice!" || lf || "Should I quit the other LhA-Ctrl.","_Quit other|_No, commit suicide","LhA-Control V2.5", "RT_ReqPos=ReqPos_CenterScr RT_PubScrName="PubScreen) If RTResult = 0 Then Do Busy off Exit End Else Address 'MouseActions' q BeSure: Address Command 'C:Wait 1' If Show('p','MouseActions') = 0 Then Return Signal BeSure Return BackToBase SecretPart: Busy On Call rtezrequest("LhA-Control V2.5 is © 27-Feb-95 by D&D Productions." lf lf "You're welcome to support my work by sending:" lf "Bug reports, own productions, suggestions or gift's!" lf "(Call DreamLine for latest update)" lf lf "Allan 'Duff' Odgaard" lf "Klostervænget 9, " lf "DK-2100 Copenhagen," lf "Denmark." lf lf "Greetz to Detron, Obiwan, Lowlifes etc.","I'll do that!","Be proud, coz' you found the secret about window!!!","RTEz_Flags=EZReqF_CenterText RT_ReqPos=ReqPos_CenterScr RT_PubScrName="PubScreen) Busy Off Status 3 set ActiveWin SelectEntry 0 0 1 Signal WaitForSignal Syntax: Beep Status 21 ActiveWin set OldBuf Address Command 'C:Assign "Used By Duff:" Remove' Address Command 'C:Delete "'Left(TmpPath,Length(TmpPath)-1)'" All NoReq' Busy Off TopText "Syntax Error" rc"," errortext(rc) "in line" sigl"." Busy off Exit