I currently have a button with the following code:
select all
"C:\Program Files\WinRAR\WinRAR.exe" m -r {sourcepath|nopath} @{O|filem}
Select all
Copy {f} MOVE TO {f|..\..}
@async dopusrt /cmd DELETE FILE={sourcepath$}
Go Up
It replaces a folder (currently viewed) with a rar file (with the folder name) whose contents is same as the folder contents
The problem with this is... the folder needs to be kept open in the source lister, until the whole operation is complete... coz, sometimes it takes a long time to create the rar file
I would like the button to be modified in a manner that it does the same thing, but I could continue viewing other folders without waiting for the operation to complete.
I think the problem is, that when you start the RAR operation and then reuse the current Lister
or open a new one and start performing other tasks, DOpus executes this part of the code:
Select all
Copy {f} MOVE TO {f|....} @async dopusrt /cmd DELETE FILE={sourcepath$}
Go Up
on the currently viewed folder? Perhaps you could insert some code that shows a dialog and asks
you to go back to the original folder to complete the operation?
@nofilenamequoting
@set OrigDir={sourcepath$|nopath}
@runmode hide
Go Up
"C:\Program Files\WinRAR\WinRAR.exe" m -r -ep1 "{$OrigDir}" "{$OrigDir}\*.*"
rmdir "{$OrigDir}"
Select "{$OrigDir}.rar"
As a bonus it won't delete anything that failed to be added to the RAR for some reason, and it will select the newly created RAR once it's finished.
(The only reason it's an MS-DOS mode button is that I wanted to use rmdir, instead of the Opus delete command, to ensure the original folder was only removed if it was now empty due to WinRAR cleaning it out.)
In XML for pasting:
<?xml version="1.0"?>
<button display="both">
<label>Turn current into RAR</label>
<tip>Creates a RAR of the current folder, deleting the folder in the process.</tip>
<icon1>#addtozip</icon1>
<function type="batch">
<instruction>@nofilenamequoting</instruction>
<instruction>@set OrigDir={sourcepath$|nopath}</instruction>
<instruction>@runmode hide</instruction>
<instruction>Go Up</instruction>
<instruction>"C:\Program Files\WinRAR\WinRAR.exe" m -r -ep1 "{$OrigDir}" "{$OrigDir}\*.*"</instruction>
<instruction>rmdir "{$OrigDir}"</instruction>
<instruction>Select "{$OrigDir}.rar"</instruction>
</function>
</button>
@Christiaan
thanks.. checked it out.. but, i would prefer something which would not involve any further input/intervention
@leo
oops!! it did not work.. and gave some strange error message..
I had "D:\Acads\Xaams\Q Papers" open.. and got this error message:
same is the case with other folders I checked...
and the error message is similar, but the folder mentioned is not always the first directory in the path ..sometimes it is a directory completely unrelated to the path
i could not figure out much